Skip to content

Instantly share code, notes, and snippets.

@stevepm
Last active August 29, 2015 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stevepm/b71f6a2f42ce4a2ad080 to your computer and use it in GitHub Desktop.
Save stevepm/b71f6a2f42ce4a2ad080 to your computer and use it in GitHub Desktop.
Bluemix Rails instructions

#Bluemix Instructions

  • Install cloudfoundry cli
  • rails new MY_APP_NAME -T
  • Add rails_12factor gem to gemfile for logging purposes
  • touch manifest.yml to create the manifest file in your root directory, this will store your Bluemix App config
  • Log in to Bluemix
  • Click Create an app
  • Choose Ruby on Rails runtime towards the bottom
  • Choose your app name and route and then click create
  • Click add a service
  • Choose ElephantSQL
  • Rename the service name to elephant and click create
  • Update your manifest.yml to look similar to this:
applications:
- name: APP_NAME
  memory: 512M
  instances: 1
  host: HOST_NAME (usually same as APP_NAME)
  domain: mybluemix.net
  path: .
  services:
  - elephant
  • In your console run rake db:create db:migrate to create your dbs and the schema
  • Open config/database.yml and change your Production settings to look similar to this:
production:
<% if ENV['VCAP_SERVICES'] %>
<% services = JSON.parse(ENV['VCAP_SERVICES'])
   postgres = services["elephantsql"]
   credentials = postgres.first["credentials"] %>
  url: <%= credentials["uri"] %>
<% else %>
  <<: *default
  database: db/production.sqlite3
<% end %>
  • You should now be ready to push to Bluemix
  • Run cf push -c "rake db:migrate" (you may be asked to log in and choose a target org and space)
@hapiben
Copy link

hapiben commented Aug 10, 2015

Is there a way you can access rails console?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment