Capistrano 部署不会将 config/environments/*.rb 文件复制到服务器
Capistrano deployment does not copy config/environments/*.rb files to server
我正在尝试使用 Capistrano 3.4 将多 environment/multi 阶段 rails 4 项目部署到不同的服务器。
我的 git 存储库中有 config/environments/<environment>.rb
中的所有文件,然后将 config/secrets.yml
用于不应在 git 中的内容。
但是,当我部署时,config/environments/
目录不存在。
我可以将环境文件添加为链接文件,并将其存储在共享目录中。但是我想直接使用git.
的版本
例如
set :linked_files, %w{config/database.yml config/secrets.yml config/environments/production.rb}
那么,我如何告诉 Capistrano 将 config/environments/
中的所有文件包含到部署中?
更新:
我的deploy/production.rb
看起来像这样
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
而在部署时,我实际上多次收到此错误
config.eager_load is set to nil. Please update your config/environments/*.rb files accordingly:
但是配置是在不同的环境文件中设置的,只是没有复制而已。
Capistrano 默认情况下不会跳过 config/environments 目录,所以如果你没有将它添加到 .gitignore(并且它在 repo 中),并且你没有将它添加到 "linked_dirs" , 那么它应该像任何其他 file/directory.
一样从 repo 中提取
好的,我找到问题了。开发人员已将此行添加到 .gitattributes
.
config/environments/ export-ignore
所以当 capistrano 做存档部署时,文件没有被包含。
我正在尝试使用 Capistrano 3.4 将多 environment/multi 阶段 rails 4 项目部署到不同的服务器。
我的 git 存储库中有 config/environments/<environment>.rb
中的所有文件,然后将 config/secrets.yml
用于不应在 git 中的内容。
但是,当我部署时,config/environments/
目录不存在。
我可以将环境文件添加为链接文件,并将其存储在共享目录中。但是我想直接使用git.
的版本例如
set :linked_files, %w{config/database.yml config/secrets.yml config/environments/production.rb}
那么,我如何告诉 Capistrano 将 config/environments/
中的所有文件包含到部署中?
更新:
我的deploy/production.rb
看起来像这样
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
而在部署时,我实际上多次收到此错误
config.eager_load is set to nil. Please update your config/environments/*.rb files accordingly:
但是配置是在不同的环境文件中设置的,只是没有复制而已。
Capistrano 默认情况下不会跳过 config/environments 目录,所以如果你没有将它添加到 .gitignore(并且它在 repo 中),并且你没有将它添加到 "linked_dirs" , 那么它应该像任何其他 file/directory.
一样从 repo 中提取好的,我找到问题了。开发人员已将此行添加到 .gitattributes
.
config/environments/ export-ignore
所以当 capistrano 做存档部署时,文件没有被包含。