Hi Jeff,
Within your config/deploy/staging.rb file something like the following
could help:
require 'erb'
before "deploy:setup", :db
after "deploy:update_code", "db:symlink"
namespace :db do
desc "Create database yaml in shared path"
task :default do
db_config = ERB.new <<-EOF
staging:
adapter: mysql
encoding: utf8
username: #{user}
password: #{password}
database: #{application}_staging
EOF
run "mkdir -p #{shared_path}/config"
put db_config.result, "#{shared_path}/config/database.yml"
end
desc "Make symlink for database yaml"
task :symlink do
run "ln -nfs #{shared_path}/config/database.yml #{release_path}/
config/database.yml"
end
end
Regards,
Keith
On 20/10/2008, at 12:35 PM, Jeff Pritchard wrote:
>
> Hi,
> I thought it would be easy to get a staging server working. I'm
> using
> capistrano 2 and the ext gem. I already had everything working with
> capistrano for a production deployment...
>
> I added this to my deploy.rb
> require 'capistrano/ext/monitor'
> require 'capistrano/ext/multistage'
>
> I created a /deploy/staging.rb
> set :deploy_to, "/where-the-staging-stuff-goes"
> set :rails_env, 'staging'
>
> I added a ":staging" section in my database.yml file which is the same
> as production section but points to a different database
>
> Most of this is working. The deployment works and I can run the app
> at
> the new location, but for some reason it continues to use the
> production
> database rather than the staging one that I have pointed it to with
> the
> staging section of my database.yml file.
>
> thanks for any words of wisdom on this.
>
> jp
> --
> Posted via http://www.ruby-forum.com/.
>
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Deploying Rails" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-deployment?hl=en
-~----------~----~----~----~------~----~------~--~---