Getting Started with Rails
Initialize your application
$ rails new rails-app # # It creates file 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 ruby-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
Add the gem
mysql to your
gem 'mysql2', '~> v0.3.18'
Then set the following environment variable:
DATABASE_URL→ Copy the value of
SCALINGO_MYSQL_URLand 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
To use a MongoDB database your need to add the gem
mongoid to your
Setup your application logging
By default, rails application don’t write their logs to STDOUT but in a custom file. We expect your applications to write all their logging entries to STDOUT and STDERR according to their nature, in accordance to the 12 factors
- Add the following gem in your
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... <-- https://ruby-app.scalingo.io -->
Yes a new application will render a 404 error
The page you were looking for doesn't exist.,
but it’s normal, there is nothing in the project, it’s time to build your product!