I'm trying to use Capistrano (3.6) to deploy my app, but some tasks doesn't works and return just nothing.
When I execute cap production deploy
the release is correctly downloaded from my git server, the bundle install works, and files are linked. But some tasks seems to be skipped like "deploy:migrate".
I've tried to debug by creating these two tasks to see what happening during the deployment:
namespace :deploy do
before :migrate, :debug do
puts "BEFORE"
end
after :migrate, :debug do
puts "AFTER"
end
end
And i saw my tasks correctly hooked just after bundle install:
00:03 bundler:install
01 ~/.rvm/bin/rvm 2.3.0 do bundle install --path /home/myuser/app/shared/bundle --without development test --deployment --qui…
✔ 01 myuser@myhost 2.380s
BEFORE
AFTER
00:05 deploy:symlink:release
But as you can see, nothing happens between BEFORE and AFTER, However i've pending migrations.
And if i run the task alone cap production deploy:migrate
there is no output and nothing happens.
When I run the command directly on the remote host RAILS_ENV=production bundle exec rails db:migrate
it's ok !
This the same behavior for some other tasks like puma:x, deploy:compile_asset, etc...
My Environment
I use RVM (single user) with ruby 2.3.0 (both side) My app is a Rails 5 (api only)
In my Gemfile
gem 'capistrano', '~> 3.6.0'
gem 'capistrano-rails', '~> 1.1'
gem 'capistrano-rvm', '~> 0.1.1'
gem 'capistrano3-puma', github: "seuros/capistrano-puma"
In my Capfile
require 'capistrano/rvm'
require 'capistrano/rails'
require 'capistrano/bundler'
require 'capistrano/puma'
require 'capistrano/puma/nginx'
My deploy.rb
set :rvm_ruby_version, '2.3.0'
set :application, 'myapp'
set :repo_url, '[email protected]:me/myapp.git'
set :deploy_to, '/home/myuser/app'
append :linked_files, 'config/database.yml', 'config/secrets.yml'
append :linked_dirs, 'log', 'tmp/pids', 'tmp/cache', 'tmp/sockets'
set :nginx_config_name, 'myapp'
set :nginx_server_name, 'myapp.mydomain.com'
My production.rb
server 'myhost', user: 'myuser', roles: %(app web db)
set :rails_env, 'production'
Thank for your help!
you've made a typo in your production.rb
. If you run cap production doctor
it will alert you to the problem.
Basically you have written %(app web db)
when you meant %w(app web db)
.
See also this answer: Rails assets aren't compiling after Capistrano deployment