Closed lnikell closed 8 years ago
Hey, could you please check if the version from repository work? You can do that by changing the source of gem in your Gemfile like this:
gem 'mina-puma', require: false, github: 'untitledkingdom/mina-puma'
Current released version of mina-puma
doesn't start puma
during restart if shutting it down crashed, for example because mina was not started at all (or at least mina-puma
couldn't detect that). If current repository version doesn't help, please send me your deploy.rb
and config/puma.rb
and I'll see if I can help :)
Thank you for reply @d4rky-p.l I'm using version from your repository.
require 'mina/multistage'
require 'mina/bundler'
require 'mina/rails'
require 'mina/git'
require 'mina/rvm'
require 'mina/puma'
set :shared_paths, ['config/database.yml', 'config/secrets.yml', 'config/puma.rb', 'log', 'tmp/pids', 'tmp/sockets', 'public/uploads', 'public/spree']
task :environment do
invoke :'rvm:use[ruby-2.2.2@default]'
end
task :setup => :environment do
queue! %[mkdir -p "#{deploy_to}/#{shared_path}/log"]
queue! %[chmod g+rx,u+rwx "#{deploy_to}/#{shared_path}/log"]
queue! %[mkdir -p "#{deploy_to}/#{shared_path}/config"]
queue! %[chmod g+rx,u+rwx "#{deploy_to}/#{shared_path}/config"]
queue! %[mkdir -p "#{deploy_to}/#{shared_path}/public/uploads"]
queue! %[chmod g+rx,u+rwx "#{deploy_to}/#{shared_path}/public/uploads"]
queue! %[mkdir -p "#{deploy_to}/#{shared_path}/public/spree"]
queue! %[chmod g+rx,u+rwx "#{deploy_to}/#{shared_path}/public/spree"]
queue! %(mkdir -p "#{deploy_to}/#{shared_path}/tmp/sockets")
queue! %(chmod g+rx,u+rwx "#{deploy_to}/#{shared_path}/tmp/sockets")
queue! %(mkdir -p "#{deploy_to}/#{shared_path}/tmp/pids")
queue! %(chmod g+rx,u+rwx "#{deploy_to}/#{shared_path}/tmp/pids")
queue! %[touch "#{deploy_to}/#{shared_path}/config/database.yml"]
queue! %[touch "#{deploy_to}/#{shared_path}/config/secrets.yml"]
queue! %[touch "#{deploy_to}/#{shared_path}/config/puma.rb"]
queue %[echo "-----> Be sure to edit '#{deploy_to}/#{shared_path}/config/database.yml', 'secrets.yml' and puma.rb."]
end
desc "Deploys the current version to the server."
task :deploy => :environment do
to :before_hook do
# Put things to run locally before ssh
end
deploy do
# Put things that will set up an empty directory into a fully set-up
# instance of your project.
invoke :'git:clone'
invoke :'deploy:link_shared_paths'
invoke :'bundle:install'
invoke :'rails:db_migrate'
invoke :'rails:assets_precompile'
invoke :'deploy:cleanup'
end
end
I removed to :launch section with puma:restart because it's does not work for me.
Configuration
environment "production"
bind "unix:////srv/shop/production/shared/tmp/sockets/puma.sock"
pidfile "/srv/shop/production/shared/tmp/pids/puma.pid"
state_path "/srv/shop/production/shared/tmp/sockets/puma.state"
workers 2
daemonize true
activate_control_app 'unix:////srv/shop/production/shared/tmp/sockets/pumactl.sock'
One more thing: could you please run bundle exec mina puma:restart --simulate --verbose
and paste full result?
#!/usr/bin/env bash
# Executing the following via 'ssh shop@ec2-52-25-33-49.us-west-2.compute.amazonaws.com -o StrictHostKeyChecking=no -t':
#
echo "-----> Using RVM environment 'ruby-2.2.2@default'"
if [[ ! -s "$HOME/.rvm/scripts/rvm" ]]; then
echo "! Ruby Version Manager not found"
echo "! If RVM is installed, check your :rvm_path setting."
exit 1
fi
source $HOME/.rvm/scripts/rvm
echo \$\ rvm\ use\ \"ruby-2.2.2@default\"\ --create &&
rvm use "ruby-2.2.2@default" --create || exit 1
echo \$\ '
'\ \ \ \ \ \ if\ \[\ -e\ \'/srv/shop/staging/shared/tmp/sockets/pumactl.sock\'\ \]\;\ then'
'\ \ \ \ \ \ \ \ cd\ /srv/shop/staging/current\ \&\&\ bundle\ exec\ pumactl\ -S\ /srv/shop/staging/shared/tmp/sockets/puma.state\ --pidfile\ /srv/shop/staging/shared/tmp/pids/puma.pid\ restart'
'\ \ \ \ \ \ else'
'\ \ \ \ \ \ \ \ echo\ \'Puma\ is\ not\ running\!\'\;'
'\ \ \ \ \ \ fi'
'\ \ \ \ &&
if [ -e '/srv/shop/staging/shared/tmp/sockets/pumactl.sock' ]; then
cd /srv/shop/staging/current && bundle exec pumactl -S /srv/shop/staging/shared/tmp/sockets/puma.state --pidfile /srv/shop/staging/shared/tmp/pids/puma.pid restart
else
echo 'Puma is not running!';
fi
Elapsed time: 0.00 seconds
Hey, please check now if it's OK :)
Still the same problem :)
Did you remember to update the gem with latest version from repository? Please run bundle update mina-puma
to be sure. You can also check if bundle exec mina puma:restart --simulate --verbose
returns the same code or the fixed one.
If it still doesn't help then I don't really know how to help you anymore. Try copying the command that's being run (cd /srv/shop/staging/current && bundle exec pumactl
etc) and see if it's not a problem with your server configuration.
Still the same. I will try to watch on my server confugration, but it is very weird that puma:stop and puma:start works for me but not the puma:restart
#!/usr/bin/env bash
# Executing the following via 'ssh shop@ec2-52-25-33-49.us-west-2.compute.amazonaws.com -o S trictHostKeyChecking=no -t':
#
echo "-----> Using RVM environment 'ruby-2.2.2@default'"
if [[ ! -s "$HOME/.rvm/scripts/rvm" ]]; then
echo "! Ruby Version Manager not found"
echo "! If RVM is installed, check your :rvm_path setting."
exit 1
fi
source $HOME/.rvm/scripts/rvm
echo \$\ rvm\ use\ \"ruby-2.2.2@default\"\ --create &&
rvm use "ruby-2.2.2@default" --create || exit 1
echo \$\ '
'\ \ \ \ \ \ if\ \[\ -e\ \'/srv/shop/staging/shared/tmp/sockets/pumactl.sock\'\ \]\;\ then'
'\ \ \ \ \ \ \ \ if\ \[\ -e\ \'/srv/shop/staging/shared/config/puma.rb\'\ \]\;\ then'
'\ \ \ \ \ \ \ \ \ \ cd\ /srv/shop/staging/current\ \&\&\ bundle\ exec\ pumactl\ -F\ /srv/sh op/staging/shared/config/puma.rb\ restart'
'\ \ \ \ \ \ \ \ else'
'\ \ \ \ \ \ \ \ \ \ cd\ /srv/shop/staging/current\ \&\&\ bundle\ exec\ pumactl\ -S\ /srv/sh op/staging/shared/tmp/sockets/puma.state\ -C\ \'unix:///srv/shop/staging/shared/tmp/sockets/ pumactl.sock\'\ --pidfile\ /srv/shop/staging/shared/tmp/pids/puma.pid\ restart'
'\ \ \ \ \ \ \ \ fi'
'\ \ \ \ \ \ else'
'\ \ \ \ \ \ \ \ echo\ \'Puma\ is\ not\ running\!\'\;'
'\ \ \ \ \ \ fi'
'\ \ \ \ &&
if [ -e '/srv/shop/staging/shared/tmp/sockets/pumactl.sock' ]; then
if [ -e '/srv/shop/staging/shared/config/puma.rb' ]; then
cd /srv/shop/staging/current && bundle exec pumactl -F /srv/shop/staging/shared/config/p uma.rb restart
else
cd /srv/shop/staging/current && bundle exec pumactl -S /srv/shop/staging/shared/tmp/sock ets/puma.state -C 'unix:///srv/shop/staging/shared/tmp/sockets/pumactl.sock' --pidfile /srv/ shop/staging/shared/tmp/pids/puma.pid restart
fi
else
echo 'Puma is not running!';
fi
Elapsed time: 0.00 seconds
@lnikell, I'm trying to investigate your problem and I see that the log of bundle exec mina puma:restart --simulate --verbose
command which you posted has /srv/shop/staging/ path everywhere, but your puma.rb has /srv/shop/production/. Isn't it related to it?
@lnikell Hey, did you check if @mklocek was right and it was an issue with paths?
@lnikell I just to show you my config of puma.rb. Staging config is the same. I will deploy another project soon to another server and will check this issue again? On my aws instanse I'm still receiving this error on restart.
Could you please send your current deploy.rb and last few lines of mina deploy
related to puma? I feel like we're missing something obvious here.
@d4rky-pl https://gist.github.com/lnikell/7380d235f3040b5260bc5f75dd14749f
I'm setting deploy_to, domain and etc from production.rb, staging.rb inside the deploy folder provided by mina-multistage gem.
@lnikell Right now you're not using mina-puma at all so when you deploy it doesn't start properly.
@d4rky-pl Yep, I've removed puma:restart from :launch part since I receive error. So currently I should to execute mina puma:stop mina puma:start from the terminal, because puma:restart don't work for me
@lnikell I've added puma:hard_restart
to master branch.
@d4rky-pl Thank you, I will check it soon.
Hi! I installed mina-puma today on my project and receive problem with puma:restart. For some reason restart no working and just execute stop without up.So after restart I should to execute puma:start again. It's very weird because on other projects where I using mina-puma I do not have this problem.