Introduction

This tutorial will show you how to deploy your Ruby app in several minutes. These instructions will also give you enough information to make the most out of Dokkur.

Be sure that you already have:

  1. Dokkur account.
  2. SSH keys added to your account.
  3. Ruby 2.2.4 installed locally - see the installation guides for Ruby and Rails on OS X, Windows and Linux.
  4. Bundler installed locally - run gem install bundler.

Set up

In this step you will install the Dokkur Toolbelt that gives you you access to the Dokkur Command Line Interface (CLI).

After installation you can use dokkur login command to log in with your email and password you set when creating Dokkur account.

Prepare the app

To deploy an app you need to have the app prepared for deployment.

If you don’t have your own Ruby project, you can use a template that we have already prepared for you:

$ git clone https://github.com/dokkur/ruby-getting-started.git
$ cd ruby-getting-started

If you have a Ruby app that you want to deploy, you need to do some preparations.

Declare app dependencies

How does Dokkur recognize an app as a Ruby app? The answer is by the existence of a Gemfile file in the root directory.

It may look something like this:

source 'https://rubygems.org'
ruby '2.2.4'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.0'
# Use postgresql as the database for Active Record
gem 'pg'
gem 'rails_12factor', group: :production
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
...

The Gemfile file is a specification of which dependencies should be installed with your application. You can also use it to determine the version of Ruby that will be used to run your application on Dokkur.

When an app is deployed, Dokkur reads this file and installs the appropriate Ruby version together with the dependencies using the bundle install command.

Caution! A prerequisite to running any app locally is to install the dependencies locally as well. Your Gemfile may have a certain dependency regarding databases which will only resolve if you have your DBMS (Database Management System), that is mentioned in the dependency file. Please install it before you proceed.

Now run bundle install in your local directory to install the dependencies, preparing your system for running the app locally:

$ bundle install
Using rake 10.4.2
Using i18n 0.7.0
Using json 1.8.2
....
Using puma 2.9.1
Your bundle is complete!

Once dependencies are installed, you will be ready to run your app locally.

Create a new app

Follow these steps:

  1. Open website, go to Personal apps (left menu bar)
  2. Click ⨁ button to open New App interface
  3. Enter the app’s name (Caution! Use latin lowercase and numbers, e.g. myapp007), choose available and convenient instances for hosting, pick Custom App template and press Create App button.

Congrats! Your app has easily been created. Now you need to deploy it. Just do it!

Add BUILDPACK_URL config var

  1. Go to Settings page, in Environmental variables section click on Edit button.
  2. Choose ADD NEW VARIABLE
  3. In the Name field write BUILDPACK_URL
  4. In the VALUE field put
    https://github.com/dokkur/buildpack-ruby
  5. Save settings

Deploy your app

  1. Go to Settings page, copy the app git url from the Git URL section.
  2. Switch to Dokkur Toolbelt and execute this command:

    git remote add dokkur git_url
    Instead of git_url paste your app's git url.

  3. Push your app:
    git push dokkur master
    If you want to deploy another branch, run:
    git push dokkur yourbranch:master

Hell yeah! Your app is deployed! Open yourappname.dokkurapp.com in your browser.