Reputation: 25697
I've been using Capistrano to deploy my latest project. I have a fairly simple setup, with only a production stage (it created a staging one, but I don't use it).
I'm tired of typing cap production deploy
to deploy my app. I really like how Rails handles this, with rails c p
being the same as rails console production
. I'd like to be able to type this:
cap p deploy
instead of the longer production
version.
I've tried making a simple alias:
ln production.rb p.rb
Running cap p deploy
gets through almost all of the deploy steps, then dies when running Rake migrations:
INFO [03d68697] Running ~/.rvm/bin/rvm 2.2.2 do bundle exec rake db:migrate as [email protected]
DEBUG [03d68697] Command: cd /var/railsapps/metasmoke/releases/20150904155532 && ( RAILS_ENV=p ~/.rvm/bin/rvm 2.2.2 do bundle exec rake db:migrate )
DEBUG [03d68697] Please require the stackprof gem falling back to fast_stack
DEBUG [03d68697]
DEBUG [03d68697] config.eager_load is set to nil. Please update your config/environments/*.rb files accordingly:
DEBUG [03d68697]
DEBUG [03d68697] * development - set it to false
DEBUG [03d68697] * test - set it to false (unless you use a tool that preloads your test environment)
DEBUG [03d68697] * production - set it to true
DEBUG [03d68697]
DEBUG [03d68697] rake aborted!
DEBUG [03d68697] ActiveRecord::AdapterNotSpecified: 'p' database is not configured. Available: ["default", "development", "test", "production"]
DEBUG [03d68697] /var/railsapps/metasmoke/shared/bundle/ruby/2.2.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/connection_specification.rb:248:in `resolve_symbol_connection'
How can I do this?
Upvotes: 0
Views: 844
Reputation: 2653
You probably need to add
set :rails_env, 'production'
to production.rb. Capistrano is inferring the Rails environment name from the stage name.
Upvotes: 3