Getting Started with Rails

Initialize your application

$ rails new my-app

# It creates files and run 'bundle install'

$ git init
$ git add .
$ git commit -m "Base rails application"

Create your application on Scalingo

You can also use our web dashboard to achieve this operation
$ scalingo create my-app
Git repository detected: remote scalingo added
→ 'git push scalingo master' to deploy your app

Provision and configure your database

  • Go on the dashboard of your application.
  • Select the Addons category
  • Choose the database you want to use


Add the gem pg to your Gemfile


Add the gem mysql to your Gemfile:

gem 'mysql2', '~> v0.3.18'

Then set the following environment variable:

  • DATABASE_URL → Copy the value of SCALINGO_MYSQL_URL and replace ‘mysql://’ by ‘mysql2://’
To set an environment variable, there are two ways to do it:
  • In the "Environment" category in your dashboard
  • Using our CLI and the commands scalingo env|env-set|env-unset


To use a MongoDB database your need to add the gem mongoid to your Gemfile. Please refer to this guide.

Setup your application logging

By default, Rails applications don’t write their logs to STDOUT but in a custom file. We expect your application to write all its logging entries to STDOUT and STDERR according to their nature, in accordance to the 12-factor.

  • Add the following gem in your Gemfile: gem "rails_12factor"

Finalize and deploy

$ bundle install
$ git add .
$ git commit -m "Configure application for Scalingo"
$ git push scalingo master

Access your application

Waiting for your application to boot...
<-- -->

A new application will render a 404 error The page you were looking for doesn't exist., but it’s expected. There is nothing in the project, it’s time to build your product!

schedule 30 Nov 2015