Last active
December 14, 2017 07:44
-
-
Save bsa7/9719095 to your computer and use it in GitHub Desktop.
Puma autostart with server (Puma 2.11.2, NGINX 1.4.6, Ubuntu Server 15.04 x64)
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
#!/usr/bin/env puma | |
env_current = 'my_app' #File.read("#{Rails.root}/../../env") | |
delpoy_path = "/home/my_user_name/projects/#{env_current}" | |
directory "#{delpoy_path}/current" | |
rackup "#{delpoy_path}/current/config.ru" | |
environment = env_current | |
pidfile "#{delpoy_path}/shared/tmp/pids/puma.pid" | |
state_path "#{delpoy_path}/shared/tmp/pids/puma.state" | |
stdout_redirect "#{delpoy_path}/shared/log/puma_error.log", "#{delpoy_path}/shared/log/puma_access.log", true | |
threads 0,16 | |
workers 0 | |
preload_app! | |
on_restart do | |
puts 'Refreshing Gemfile' | |
ENV["BUNDLE_GEMFILE"] = "#{delpoy_path}/current/Gemfile" | |
end |
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
@reboot /bin/bash -l -c "/home/slon/projects/wood/current/puma_wood_restart" |
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
source 'https://rubygems.org' | |
gem 'puma' | |
gem 'rails' | |
... |
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
cd /home/my_user_name/projects/my_app/current | |
kill -9 `cat /home/my_user_name/projects/my_app/shared/tmp/pids/puma.pid` | |
rm -f /home/my_user_name/projects/my_app/shared/tmp/sockets/*.* | |
RAILS_ENV=my_app puma -d -b "unix:///home/my_user_name/projects/my_app/shared/tmp/sockets/puma.sock" --control "unix:///home/my_user_name/projects/my_app/shared/tmp/sockets/pumactl.sock" --control-token ad9c7bad9c7bad9c7bad9c7adbc9ad7bca9d7cbad97cba9d7cbda9c7bad9c7bad9c7b |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment