Summary:
- Add Capistrano and other relevant gems to Gemfile.
# Deployment
gem 'capistrano'
gem 'capistrano-rvm'
gem 'capistrano-rails'
gem 'capistrano-bundler'
Summary:
# Deployment
gem 'capistrano'
gem 'capistrano-rvm'
gem 'capistrano-rails'
gem 'capistrano-bundler'
Now, the final part of the initial deployment for Rails with RVM, Postgres, Ubuntu, NGINX, Capistrano, Puma 6 & Systemd.
Go to /etc/nginx/sites-available
Create a conf file, I usually name it after my app. For this tutorial, let's call it "website":
upstream puma_website {
server unix:///home/deploy/website/shared/sockets/puma.sock;
}
Assume the name of the application is "website":
For socket: sudo vi /etc/systemd/system/website_puma_production.service
[Unit]
Description=Puma Socket for website (production)
[Socket]
Install Redis:
[Unit]
Description=sidekiq
After=syslog.target network.target
The clean and secure way to allow the deploy user to run sudo commands without a password is to create a custom sudoers file in /etc/sudoers.d/.
Switch to root:
sudo su
Navigate to the sudoers directory:
cd /etc/sudoers.d/
Clear from console, all: | |
Sidekiq.redis(&:flushdb) |
sudo systemctl status sidekiq | |
sudo systemctl status sidekiq.service | |
sudo systemctl status redis | |
sudo systemctl status website_puma_staging.service (staging / production) | |
sudo systemctl status nginx |
sudo visudo deploy ALL=(ALL) NOPASSWD:ALL