I'm using Capistrano multistage (capistrano-ext) to deploy to staging or 开发者_JAVA百科production.
The problem is I'm using Passenger in my shared hosting and need to specify the PassengerAppRoot
in the public/.htaccess
file. Obviously this is different between stages.
How can I keep different "stage-versions" of this file?
I haven't used capistrano-ext, but I'm assuming somewhere in your Capfile you'll have the stage as a variable. Let's assume it's the variable 'stage'. Let's also assume you have the two different versions checked in somewhere in your code (public/.htaccess-{production|staging})
You could set up a task to symlink (or copy) the right file after a deploy:
desc 'Set up a stage-appropriate .htaccess file'
task 'update_htaccess' do
run "ln -s #{release_path}/public/.htaccess-#{stage} #{release_path}/public/.htaccess"
end
after "deploy:update_code", "update_htaccess"
精彩评论