Release of Scalingo Ruby Library v2

December 16, 2019 - 5 min read
Release of Scalingo Ruby Library v2

The whole Scalingo platform is API-driven, all the tools you are manipulating as a user, are communicating with our public APIs: the dashboard and the command line tool scalingo. Our APIs are accessible and documented, you can build and use your own tools against them to improve your workflows. To help you doing so, we just released the v2 version of our official Ruby library.

Changes Since the 1st Version

The first version of this library was not an official release, it had been designed by a platform's user in the need of a deeper integration. Later the project was transferred to us, but lacked some love for a few years.

Since then, we revamped our authentication system and we expanded on multiple regions this year, the gem is now compatible with both these major changes of the platform.

Plus, different resources were not yet implemented and couldn't be modified easily with this library, their support has been added:

Find about the different resources you can manipulate in our developers documentation.

Integration of the library

To use our Ruby library, you need to add it in your Gemfile:

gem 'scalingo-ruby-api', '~> 2'


Then it has to be configured in your project. The following snippet would configure the library to use the API token from the environment in the SCALINGO_API_TOKEN variable, and to use the region osc-fr.

Scalingo.configure do |config|
  config.token = ENV['SCALINGO_API_TOKEN']
  config.region = 'osc-fr1'
For a Ruby on Rails application, create an initializer `config/initializers/scalingo.rb` to add this configuration

Note that if you need to use different tokens or different regions in your project, you can configure these per client instance in your code:

client_osc_fr1 = 'osc-fr1')
client_user_1 = ENV['SCALINGO_USER1_TOKEN'])

Usage examples

  • List all apps:
client =
apps = client.apps.all
apps.each do |app|
  • Associate a domain to an app:
client =
app = client.apps.find('my-app')'')
  • Get current metrics of your app containers:
client =
app = client.apps.find('my-app')
stats = app.stats.all
stats.each do |stat|
 puts "Container #{}: Memory: #{s.memory_usage/1024/1024}MB/#{s.memory_limit/1024/1024}MB"

Which would output:

Container clock-1: Memory: 147MB/512MB
Container web-1: Memory: 357MB/512MB
Container web-2: Memory: 329MB/512MB
Container web-3: Memory: 275MB/5128MB
Container worker-1: Memory: 167MB/512MB

Contributions and questions

The project is under MIT license and available on GitHub: You'll find more information in the README of the project. If you have any question don't hesitate to open an issue, we'll help you as soon as possible.

You're not working with Ruby? We're officially developing and supporting libraries in other languages:

Photo by Jonny Lew from Pexels

Share the article
Étienne Michon
Étienne Michon
Étienne Michon is one of the first employee at Scalingo. With a PhD in computer science Étienne takes care of Research and Development at Scalingo. He also regularly contributes to this blog with technical articles.
#Ruby - #library - #changelog

Try Scalingo for free

30 days free trial / No credit card required / Hosted in Europe