D
D
Dmitry Lebedev2015-04-08 08:09:18
Nginx
Dmitry Lebedev, 2015-04-08 08:09:18

How to make Puma start a Ruby on Rails site automatically?

Hello.
I have such a problem. There is a site on RoR, all this is spinning on Ubuntu 12.04 LTS. The site is powered by nginx+puma.
So, when the server is turned off, nginx, ror start automatically, but Puma does not want to, nginx gives a 404 error.
The developers said that you need to execute such a shaitan command:

cd /srv/www/myapp/current && ( RACK_ENV=production ~/.rvm/bin/rvm default do bundle exec puma -C /srv/www/myapp/shared/puma.rb )

After that, Puma starts and the site goes up.
So how can I add this script to startup? Or make a sh script and put it in rc.local or does Puma have its own autostarter?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Askhat Bikmetov, 2015-04-08
@k3NGuru

You can write an init script with this command. Or use foreman. Or schedule in cron via whenever using the :reboot keyword.
IMHO foreman is the best option.
gemfile

...
gem 'foreman'
...

Procfile
.env
$RAILS_ENV="production"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question