Question

Four questions about Rails (console, seed file, environment variables, precompiling assets)

I used to deploy to Heroku but recently joined DO. I got up and running here with the help of Ryan Bates Railscast on deploying to a VPS, but there are some things he doesn’t cover.

  1. Can I run the rails console on my ubuntu server?

I ran “rails console” in the directory of my app and it gave me a menu of options, such as ‘rails new’ but there was no option to run the rails console

  1. I want to seed my app with some starter data. I can’t run ‘rake db:seed’ (as I would on Heroku) from my app directory. It says no rake file.

3.Environment variables. I need to set Environment Variables for various services that require them (such as email services like Mandrill). How do I set them on DO

  1. On Heroku, I used to have to do rake assets:precompile for a Rails app to deploy. This wasn’t a requirement on DO. Why (out of curiosity)?

(See full trace by running task with --trace)


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Assuming you’re on Rails 4, have you tried:

# Feel free to add this line to e.g. ~/.bashrc so you don't have to type it all the time.
export RAILS_ENV=production

bin/rails console
bin/rake db:version

and so on?

The rails in your path may be different from the one used by your app; bin/rails should get you the right one.

Had the same problems. <br>It seems like unicorn is by default starting in development environment. <br>Just add -E production in the line UNICORN_OPTS=… in file : /etc/default/unicorn <br>So that it looks like : UNICORN_OPTS=“-D -c $CONFIG_RB -E production” <br>then : RAILS_ENV=production bundle exec rake assets:precompile <br>restart unicorn and it should work.

@m73mitchell did you ding any solution to this? <br> <br>I am facing the “database configuration does not specify adapter” error. <br> <br>