I am trying to deploy a multi environment/multi stage rails 4 project to different servers using Capistrano 3.4.
I have all files in config/environments/<environment>.rb
in my git repository, and then use the config/secrets.yml
for things which should not be in git.
However, when I deploy, the config/environments/
directory does not exists.
I can add the environment file as a linked file, and store it in the shared directory. But I want to use the version directly from git.
E.g.
set :linked_files, %w{config/database.yml config/secrets.yml config/environments/production.rb}
So, How can I tell Capistrano to include all the files from config/environments/
into the deployment?
UPDATE:
My deploy/production.rb
look like this
set :branch, 'master'
set :env, 'production'
set :rails_env, fetch(:env)
server 'prod-server.domain.tld',
user: 'deploy',
roles: %w{web app db}
set :deploy_to, "/u/apps/my_app_#{fetch(:env)}"
# Default value for :pty is false
set :pty, true
set :linked_files, %w{config/database.yml config/secrets.yml}
set :linked_dirs, %w{log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system cache}
namespace :deploy do
after :updated, :cleanup # clean up assets
before :compile_assets, :migrate # migrate db
before :published, :compile_assets # compile new assets
end
And when deploying, I actually get this error multiple times
config.eager_load is set to nil. Please update your config/environments/*.rb files accordingly:
But the config is set in the different environments files, they are just not copied.
Okay, I found the problem. A developer had added this line to the .gitattributes
.
config/environments/ export-ignore
So when capistrano did the archive to deploy, the files was not included.