我有两个配置文件
/app/config/database.yml
和
/app/config/userconfig.yml
我不想将数据库凭据和 userconfig 放在 svn-repository 中,所以我签入了 database.yml.dist 和 userconfig.yml.dist。
首次部署应用程序时,在共享目录中获取 dist 文件副本的最佳方法是什么?
对于以后的部署,我将从 /app/current/config 链接到它们
我有两个配置文件
/app/config/database.yml
和
/app/config/userconfig.yml
我不想将数据库凭据和 userconfig 放在 svn-repository 中,所以我签入了 database.yml.dist 和 userconfig.yml.dist。
首次部署应用程序时,在共享目录中获取 dist 文件副本的最佳方法是什么?
对于以后的部署,我将从 /app/current/config 链接到它们
你应该把你的配置文件放在
/path/to/deployed_app/shared
然后在 capistrano 任务中,链接到这些文件:
namespace :deploy do
task :symlink_shared do
run "ln -s #{shared_path}/database.yml #{release_path}/config/"
end
end
before "deploy:restart", "deploy:symlink_shared"
在 Capistrano v3 中,您可以使用名为deploy:symlink:shared
.
提供您放置在共享目录中的文件列表,以便 Capistrano 在任务运行时知道要对哪些文件进行符号链接。这通常在deploy.rb
:
set :linked_files, %w{
app/config/database.yml
app/config/userconfig.yml
}