You would like to get access to your rails application console on an Amazon ec2 instance, and you are also using rvm.
- Login with ssh to your server as normal:
ssh email@example.com -i amazon_key
- Go to your application’s current folder:
- Run the following replacing the environment with your specific environment (ie production,beta,staging etc):
bundle exec rails c environment
You would like to start your rails console in an environment that is not the development, like staging or production.
Using the latest 3 shortcut you can use:
rails c staging
You have installed Spree in a production server but haven’t populated the database with the default seed data, and you want to add the countries (or any other seed data) that come as default in spree in the vendor/spree/db/default_countries.yml file.
On your production server, after logging in with ssh and going to the application directory run the following rake task:
rake db:load_file[vendor/spree/db/default/countries.yml] RAILS_ENV=production
Following from a previous post about email scheduling with runner and cron, it turns out that the runner default behaviour is to run in the development environment.
Although by reading the help for the script/runner, there is a suggestion to run it with the
-e production added to the end, it doesn’t seem to be working.
The solution to make it running in the production environment was to delete the first line (shebang) from step 3 on this post
and then use the following in the cron setup:
RAILS_ENV=production /path/to/your_ror_project/script/runner /path/to/your_ror_project/lib/email_scheduler.rb
Have a look on paragraph Alternative Usage here
When using cap deploy_with_migrations, the default behaviour is to deploy with the migrations in the production environment.
To change this behavior add:
set :rails_env, "development"
in your config/deploy.rb