FlashDrive automatically builds your Ruby app.
In order to do that FlashDrive uses buildpacks to detect and build automatically your app.

FlashDrive requires several files to be placed inside the root directory of your app to be able to build it :

  • Gemfile
  • Procfile

You can fork or build this repository to get started with Ruby on FlashDrive

Specifying the Ruby version

The Ruby Buildpack allows you to specify a version of Ruby to use during deployment. This version can be specified via the BP_MRI_VERSION environment variable or a Gemfile. When specifying a version of Ruby, you must choose a version that is available within the buildpack. The supported versions can be found here.

The buildpack prioritizes the versions specified in each possible configuration location with the following precedence, from highest to lowest: BP_MRI_VERSIONGemfile.

Specifying a version of Ruby is not required. In the case that is not specified, the buildpack will provide the default version.


A Gemfile is mandatory for your app to be able to build. Gemfile are main configuration of your Ruby app.


The Procfile informs the engine on the type of app your are running (web or worker) and prepare the infrastructure accordingly. Make sure to use the same server type as during the app creation (web or worker) or you will need to manually alter the networks settings of the app.

The Procfile basically contains the type of app and the initial script to run when the app starts :

web: bundle exec ruby server.rb

Declare app dependencies

FlashDrive uses the Gemfile to build dependencies and it must contains all the dependencies your app needs to run.

A gemfile.lock file must also be commited to your repository, check the section “prepare your app”.

For instance in our example the Gemfile looks like that :

# frozen_string_literal: true

source ""

git_source(:github) {|repo_name| "{repo_name}" }

# gem "rails"

gem "puma", "~> 4.3"

gem "sinatra", "~> 2.0"

gem "cowsay", "~> 0.3.0"

Default Behavior

By default, your Ruby app is routed to the 8080 port of the container. If you need to change the instance port of your app you can do it from the app settings page by changing the network setting and the environment variable.

Note: you can set up any container port but FlashDrive will only route 80/443 traffic to your app. FlashDrive’s are not reachable from the outside of FlashDrive on any other port.

Create persistent storage

One of the major improvements of FlashDrive in comparison to others app hosting solutions is the ability to create Virtual Disks available for any copy of your app inside the same stack.

Virtual disks allow you to store data safely and securely, without the need to use an additional S3 bucket, and every app size gets free disk space depending on its size (see our pricing for more information).

In addition to that, Virtual disks are backup every day with 10 days history and ransomware protection at no additional cost.

Read this article for more informations about virtual disks and how to add one to your app.

Add a domain name

Please check this article for a detailled method on how to use your domain name with FlashDrive apps.

Define environment variables

Note: Environment variables set in your app settings are injected during the build process. If the build of your app needs to use an env variable make sure to set it before requesting the build.

FlashDrive lets you externalize the configuration of your app : the FlashDrive cluster will automatically injects the data when the app start or restart.

Environement variables can includes any external data your app needs to run like external ressources, databases addresses, encryption keys etc…

To add an environment variable, access your app settings and click “Add ENV Variable” :

Enter the key (like DATABASE_USER) and the value and click “Add”. FlashDrive will automatically add your environment variable and restart your app after a one minute delay (to let you add more env variables if necessary without restarting the app each time a new variable is added).

Provision a database

FlashDrive Marketplace includes all popular datastore engines including Mysql, Postgres, MongoDB and Redis.
To add a database to your app, click on Marketplace and select the database you want to run, then create the new app database inside the same stack as your Ruby app.

Once the app is running, visit the database app’s settings and retreive the “internal name” :

Use this internal name as your would use a server address, for instance for mysql this name replace the usual “localhost”. Some scripts requires you to add the database port at the end of the server address. FlashDrive uses common port for each database software, for MySQL it will be 3306 and you can write is like that inside your scripts : internal-name:3306
Postgres usually uses credentials sent inside the login URL, like that : postgres://<user>:<password>@<internalname>:5432/<database>

The login and password information is available inside the Environment Variables of the database app.

Reach your app from another app

Inside your app stack, you can reach any other FlashDrive app member of this stack on any port. FlashDrive automatically routes the traffic internally and open the appropriate port. By opposition, your app is only reachable on ports 80/443 from outside of FlashDrive.

To reach your app internally, retrieve the internal name from your app settings page :

This name can be used to reach your app from another app inside the same stack. Use it in any form that works with your script :


Note : https:// is not available, all the traffic inside apps is already encrypted by the cluster.


FlashDrive uses at rest encryption for the app virtual disks, build images, and encrypted transport from inside the cluster. To make sure the traffic is encrypted between your app and the browser of your users you can set up SSL certificates for any domain name connected to the app (including the FlashDrive’s default domain name).

Scale your App

From your app settings you can scale your app vertically and horizontally : by upgrading the app size (refer to our pricing for app sizes details) or by adding more nodes.

Additional nodes will run another copy of your app inside another FlashDrive server located inside the same cluster (same geographical location). Traffic is automatically sent to the least occupied node by FlashDrive’s load balancer.

Note : Apps that uses Virtual Disks will share the same file structure and read/write on the same disk. It’s fine in most cases for intensive read activity but can create bottlenecks and corrupted data if several nodes of the same app write on the same file at the same time. If your apps uses intensive reads on virtual disks consider upgrading the app size instead of adding more nodes.

Was this helpful?

0 / 0