Skip to content

Instantly share code, notes, and snippets.

@aujkis
Forked from Epigene/Puma auto startup workflow.md
Last active August 29, 2015 14:20
Show Gist options
  • Save aujkis/a45258a3234a08b10758 to your computer and use it in GitHub Desktop.
Save aujkis/a45258a3234a08b10758 to your computer and use it in GitHub Desktop.
# in config/puma.rb
app = "cpp" # App-specific
root = "/home/deployer/apps/#{app}"
workers 5
threads 1, 1
#preload_app!
rackup DefaultRackup
#port 9292
environment ENV['RACK_ENV'] || 'production'
daemonize true
# directory "#{root}/current"
pidfile "#{root}/puma/puma.pid"
stdout_redirect "#{root}/puma/puma.log", "#{root}/puma/puma_error.log"
bind "unix:/tmp/puma.socket"
#ssl_bind '127.0.0.1', '9292', { key: "/etc/ssl/server.key", cert: "/etc/ssl/cpp.chained.crt" }
activate_control_app
on_worker_boot do
# worker specific setup
# ActiveRecord::Base.establish_connection(config)
end
============================================
# Key insight at http://dev.mensfeld.pl/2014/02/puma-jungle-script-fully-working-with-rvm-and-pumactl/
1. Deploy with mina as usual, get puma to run with `mina boot` and `mina deploy`
2. Make the three files as described here https://github.com/puma/puma/tree/master/tools/jungle/init.d
3. Populate the files thusly
# /etc/init.d/puma | https://gist.github.com/Epigene/c7fa821d1babd429c7be # NB put real secret in export SECRET_KEY_BASE=32560bb
# /usr/local/bin/run-puma | https://gist.github.com/Epigene/637a295bcea88bcedca3
# /etc/puma.conf | line for every app, if one app, the line is "/home/deployer/apps/<app>/current,deployer"
3. Add puma folder in project /tmp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment