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
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
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
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://my-app.scalingo.io -->
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!