Report this

What is the reason for this report?

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

Posted on June 14, 2013

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)



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!

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.

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.

when you say you’re in your “app” directory what does it look like, what subfolders, to make sure it’s the right directory… <br>if you want to set environment variables I’d probably set them globally, like in /etc/profile file. HTH.

in home/username I created a new directory ‘app’ where the rails app is stored (and where I might store others), so now I have home/username/app. How do I set them in that /etc/profile file? <br> <br>Would I for example just do this at the bottom of the file? <br> <br>GMAIL_USERNAME=‘me@gmail.com’ <br> <br> <br>Do you have any idea about the other questions, how to seed data or run the rails console? running the console on a remote server is very handy, as it lets you alter and view production data etc

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.