PUMA won't start after server restart

I deployed a project with capistrano but puma won't start after server restart.

I shoul do → cap production puma: start every time

I tried:

/etc/init.d/myscript

#!/bin/sh
/etc/init.d/puma_start.sh

      

puma_start.sh

#!/bin/bash 
puma -C /root/project/shared/puma.rb

      

but i have error

/usr/local/rvm/rubies/ruby-2.3.3/lib/ruby/site_ruby/2.3.0/rubygems.rb:270:in `find_spec_for_exe': can't find gem puma (>= 0.a) (Gem::GemNotFoundException)
    from /usr/local/rvm/rubies/ruby-2.3.3/lib/ruby/site_ruby/2.3.0/rubygems.rb:298:in `activate_bin_path'
    from /usr/local/rvm/gems/ruby-2.3.3@project/bin/puma:22:in `<main>'
    from /usr/local/rvm/gems/ruby-2.3.3@project/bin/ruby_executable_hooks:15:in `eval'
    from /usr/local/rvm/gems/ruby-2.3.3@project/bin/ruby_executable_hooks:15:in `<main>'

      

if i put in the console root@host:~# puma -C /root/project/shared/puma.rb

it works and everything is okey.

I think I have no correct path to gem puma

How can I start puma autostart after server restart
Thank you.

+3


source to share


1 answer


I found this http://codepany.com/blog/rails-5-puma-capistrano-nginx-jungle-upstart/

this was help for me ->

cd ~
$ wget https://raw.githubusercontent.com/puma/puma/master/tools/jungle/upstart/puma-manager.conf
$ wget https://raw.githubusercontent.com/puma/puma/master/tools/jungle/upstart/puma.conf

      

Open the downloaded puma.conf file and set the system user account for setuid and setguid. (in our case we are using the root account, but it is recommended to use a less privileged account):

vim puma.conf

setuid root
setgid root

      

Move the downloaded upstart files to / etc / init and create another puma.conf

$ sudo cp puma.conf puma-manager.conf /etc/init
$ sudo touch /etc/puma.conf

      



Open / etc / puma.conf and add the application path:

/root/name_of_your_app/current

      

Open / etc / init / puma.conf and find something like this

exec bundle exec puma -C /root/project/shared/puma.rb

      

and replace the path with puma.rb file

thank

0


source







All Articles