Table of Contents
We used the official Capistrano recipe for Puma. capistrano-puma. It has monit scripts built-in to monitor puma server processes
OS level
sudo apt-get update
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
# Add `AuthenticationHelper` in spec/support/authentication_helper.rb | |
module AuthenticationHelper | |
def generate_token(user) | |
payload = { id: user.id.to_s } | |
JWT.encode payload, Rails.application.credentials.secret_key_base, 'HS256' | |
end | |
def sign_in(user) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# When you didn't shutdown the server wisely, | |
# you will encounter error that tells you the certain port is in use | |
# specially when running rails server | |
kill -9 $(lsof -i tcp:4000 -t) | |
# Note: | |
Change the `4000` upon on the port you are running on it |
OlderNewer