moving app from dev to production

Hi,
I am working on my first rails app and have a working app on my local
machine. I notice that in the database config file you set up
development test and production variables. Does rails have some sort
of script/system by which i can move my code from my local dev
environment to a production server. Or do i have to manually run the
commands on my production server to replicate my dev server.

Thanks :slight_smile:

Google for capistrano.

I guess the main thing I am confused about is that in database.yml 3
environments are set up. What distinguishes which database is used?
How can I get my application to use the database that is listed as
production? Is there a defined process that I am to follow when moving
to test to development to production

thanks

http://wiki.rubyonrails.org/rails/pages/HowtosDeployment

The above link will help you understand a little better how the
process of deploying rails to production works.

Capistrando is a very helpful tool, but its not hard to do it
manually.

Basically, what you have to do is:

1. Prepare the production server
--Install: gems, ruby, rails
--Select a web server application: apache, mongrel, etc
--Configure the web server application: this is the hardest part IMO
2. Copy the files
--Copy the whole rails structure you have locally to the production
server
--If you are going to use FCGI, you will need to fix the dispatch.fcgi
in your new server. The deployment guides should help you on this
3. Create database/user
--Don't forget to migrate the database: rake db:migrate
RAILS_ENV=production
4. Run the web server app and see if it works
--Go back to Configuring the web server app and fix it
--Usually in the web server app you will be able to configure which
RAILS_ENV to run. If it does not work and rails keeps running on
development, edit environments.rb and uncomment the line where it sais
RAILS_ENV ||= production.

This is just a basic guide. I probably forgot something. Use the
guides to help you, use Google search and also this list's search to
get more information about problems you encounter.

This is a step that is going to take a few hours for you to get going,
but you only need to go trough it once for each production server you
build.

If all you want is to run WEBrick in production environment, use ruby
script/server -e production.

GL

The linewrapping might make it hard to get the commands right:

To build the production database (after you have created the user/pass/
db as in database.yml):

"rake db:migrate RAILS_ENV=production"

To run WEBrick in production environment:

"ruby script/server -e production"