I'm deploying a Rails app with Capistrano, to an Ubuntu server (EC2).
When I deploy, with --trace, everything appears to go fine.
When I look at the revisions log on the server, it shows the latest commit hash was used on the most recent deploy, however, when I go into that latest release directory (yes I confirmed that a new release directory was created and that I'm in that one) it doesn't have the most recent commits.
If I do a 'git pull origin master' from with the new release directory on the server, of course it pulls the latest commits.
Any idea why the git pull wouldn't be happening on the Capistrano deploy?
EDIT: Here's the deploy.rb file:
lock "~> 3.14.0"
set :pty, true
set :application, "123abc"
set :repo_url, "git@github.com:123/abc.git "
# ask :branch, `git rev-parse --abbrev-ref HEAD`.chomp
set :branch, "master"
set :rbenv_ruby, File.read('.ruby-version').strip
append :linked_files, "config/secrets.yml"
append :linked_dirs, "log", "tmp/pids", "tmp/cache", "tmp/sockets"
namespace :deploy do
before :compile_assets, :force_cleanup_assets do
on release_roles(fetch(:assets_roles)) do
within release_path do
with rails_env: fetch(:rails_env) do
execute :rake, 'assets:clobber'
end
end
end
end
app_service_name = "#{fetch(:application)}-#{fetch(:stage)}"
services = ["#{app_service_name}-workers"]
desc "Restart application"
task :restart do
on roles(:app), in: :sequence, wait: 5 do
execute :sudo, :systemctl, :stop, app_service_name
sleep 1
execute :sudo, :systemctl, :start, app_service_name
# execute :sudo, :systemctl, :restart, app_service_name
end
end
desc "Restart Workers"
task :restart_services do
on roles(:app), in: :sequence, wait: 5 do
services.each { |service| execute "sudo systemctl restart #{service}" }
end
end
desc "Start Workers"
task :start_services do
on roles(:app), in: :sequence, wait: 5 do
services.each { |service| execute "sudo systemctl start #{service}" }
end
end
desc "Stop Workers"
task :stop_services do
on roles(:app), in: :sequence, wait: 5 do
services.each { |service| execute "sudo systemctl stop #{service}" }
end
end
end
after "deploy:publishing", "deploy:restart"
after "deploy:publishing", "deploy:restart_services"