How to set up and deploy a Ruby on Rails application on


This guide shows how to deploy a toy Ruby on Rails 5 application on running on Sqlite (please do not use Sqlite in production, ever).

In a later post I’ll show how to deploy a robust, production-ready Rails with Postgres and Redis.



1. Create a new Rails application using the CLI

$ rails new rails-platformsh
$ cd rails-platformsh

2. Configure the application for

Set the platform Git remote.

$ platform project:set-remote <project id>

Update the Ruby version directive in the Gemfile not to care about patch level, because locking patch-level is evil.

# rails-platformsh/Gemfile

ruby '~> 2.6.0'

Then update the Gemfile.lock

$ bundle update

3. Add the configuration files

Create the application configuration file.

$ touch

Add a basic Rails application configuration to the file.

# rails-platformsh/
name: "ruby_example"
type: "ruby:2.6"
disk: 1024

  build: |
    bundle install
    rake assets:precompile
  deploy: |
    rails db:migrate

  "/log": "shared:files/log"
  "/tmp": "shared:files/tmp"
  "/db": "shared:files/db"

    start: 'rails server -p $PORT'

Create the .platform/services.yaml services configuration and .platform/routes.yaml router configuration files.

$ touch .platform/routes.yaml
$ touch .platform/services.yaml

Add basic routes configuration:

# rails-platformsh/.platform/routes.yaml

  type: upstream
  upstream: "ruby_example:http"

you can leave .platform/services.yaml empty for the moment. Later if you would like a Postgres or a MySQL… this is where you will put it.

4. Deploy the application to

Commit everything to the repository:

git add --all
git commit -m "Initial commit"

Push the working branch to the platform remote:

git push platform master


The Rails gem can be used in conjunction with the Platform CLI to easily create and configure a Ruby on Rails application for deployment on

Following these instructions, I get the following error from the bundle install command in the build hook.

      Executing build hook...
        W: /opt/ruby/2.6/lib/ruby/2.6.0/rubygems.rb:283:in `find_spec_for_exe': Could not find 'bundler' (2.0.2) required by your /app/Gemfile.lock. (Gem::GemNotFoundException)
        W: To update to the latest version installed on your system, run `bundle update --bundler`.
        W: To install the missing version, run `gem install bundler:2.0.2`
        W:      from /opt/ruby/2.6/lib/ruby/2.6.0/rubygems.rb:302:in `activate_bin_path'
        W:      from /opt/ruby/2.6/bin/bundle:23:in `<main>'
        W: /opt/ruby/2.6/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- rake (LoadError)
        W:      from /opt/ruby/2.6/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
        W:      from /usr/bin/rake:25:in `<main>'
      E: Error building project: Step failed with status code 1.

    E: Error: Unable to build application, aborting.