Topic: My First Deployment

I am confused I have deployed my application and I even have the recipe moving the production username and password from a file on the production server to the current config file. So for me I feel like I am even doing fancy stuff.   But there is nothing in my production database.  No tables or anything.  I realize this is because the migrate hasn't been run for the production app but where is it suppose to run.  I don't have the production username and password on the development server because I don't want it checked into subversion so I can't run the migrate there. I am not sure how to run the migrate on the production server.  Is it suppose to be done as part of the recipe?  If so it couldn't be done the first time because I wouldn't have created the production database.yml file with my production password yet.  So is it suppose to do it the next time the recipe is run.  Thanks for any help.

Re: My First Deployment

Are you using capistrano? Try this:

cap deploy_with_migrations

I usually put the production's database.yml file in the "shared" folder and have the the rake recipe copy it over.

# in deploy.rb
desc "link the database.yml file"
task :after_update_code, :roles => :app do
  run "ln -s #{shared_path}/config/database.yml #{release_path}/config/database.yml"
end

Railscasts - Free Ruby on Rails Screencasts

Re: My First Deployment

First off ryanb thank you.  I know it is probably your job as moderator but you are guaranteed to help.

If I use:

 cap deploy_with_migrations

Do you run twice on first deployment?

Step 1: Run deployment so that you can create the production database.yml file in the shared folder.

Step 2: Run the deployment again so that it can do the cap deploy_with_migrations now that the production database.yml file is there.

Or am I missing something else.

Re: My First Deployment

You know... I forgot how I set mine up. I think you can either create the shared folder manually or run an initial deploy like you said, then set up the database.yml file so you can run the deploy_with_migrations command.

There's also the cold_deploy command which I think you're supposed to run initially, but I forgot what that does exactly...

Railscasts - Free Ruby on Rails Screencasts

Re: My First Deployment

I got it figured out.

1. cap setup
2. Go to production server and add the production.database.yml file to the shared/config folder to be copied by the deploy.rb recipe.
3. cap cold_deploy
4. Then on cap deploy.

I did have to add:

task :after_symlink, :roles => :app do
  migrate
end

to get migrates to work.  Don't know if this is best but it worked.