Mark Locklear
Mark Locklear

Reputation: 5355

How to set production environment for rails app being deployed with capistrano and passenger

Can't seem to find anything definitive here. When I 'cap deploy' my app, I am getting my files pushed over OK. However, the db is not being migrated. If I manually go to /myapp/current and run 'rake db:migrate' (should I have to do this?) the it creates db/development.sqlite which leads me to beleive my environment is set to dev. I have tried setting both set :deploy_env, "production" and set :rails_env, "production" in my delopy.rb file with no change. Any help appreciated.

PS Would be nice if I could add the migration as a part of the deploy, rather than have to manually do it.

Upvotes: 0

Views: 243

Answers (3)

fabro
fabro

Reputation: 771

Maybe you are missing require 'capistrano/rails/migrations' in your Capfile?

Upvotes: 0

cthulhu
cthulhu

Reputation: 3726

Assuming capistrano 2.x try cap deploy:migrations to deploy and migrate the database. You can also use cap deploy:migrate to run migrations in recently deployed application. Take a look at capistrano wiki for more details: https://github.com/capistrano/capistrano/wiki/Capistrano-Tasks

Upvotes: 2

bredikhin
bredikhin

Reputation: 9045

Use cap db:migrate in order to run your migrations with Capistrano. As far as the environment is concerned, Multistage Extension could be really helpful.

Upvotes: 1

Related Questions