Reputation: 18819
I have set up my rails app for use with rpush. It works fine locally in development using rpush start
. But now I want to deploy it to my EC2 server using capistrano-2.15.5.
Part of my deploy.rb
:
after "deploy:stop", "delayed_job:stop"
after "deploy:stop", "rpush:stop"
after "deploy:start", "delayed_job:start"
after "deploy:start", "rpush:start"
after "deploy:restart", "delayed_job:restart"
after "deploy:restart", "rpush:restart"
namespace :rpush do
%w[start stop restart].each do |command|
desc "#{command} rpush deamon"
task command, roles: :app, except: {no_release: true} do
run "cd #{deploy_to}/current && bundle exec rpush #{command}"
end
end
end
Now, the problems
/current
dir or /shared
dir. It should be in the shared so that the file persists between deploysIf anyone has done this (even in a different way) please tell me how to.
Or, how can I fix my cap recipe and /initializers/rpush
Upvotes: 3
Views: 2079
Reputation: 9981
For Capistrano 3:
after :finished, :restart_rpush do
on roles(:web) do
within release_path do
with rails_env: fetch(:rails_env) do
execute :bundle, :exec, "rpush stop -e #{fetch(:rails_env)}"
execute :bundle, :exec, "rpush start -e #{fetch(:rails_env)}"
end
end
end
end
Then check that tmp
and other directories is linked correctly:
set :linked_dirs, %w{log tmp/pids tmp/cache tmp/sockets vendor/bundle public/uploads}
Upvotes: 7