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:
- Dokkur account.
- SSH keys added to your account.
- Ruby 2.2.4 installed locally - see the installation guides for Ruby and Rails on OS X, Windows and Linux.
- Bundler installed locally - run gem install bundler.
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:
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.0'
# Use postgresql as the database for Active Record
gem 'rails_12factor', group: :production
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'
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:
- Open website, go to Personal apps (left menu bar)
- Click ⨁ button to open New App interface
- 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
- Go to Settings page, in Environmental variables section click on Edit button.
- Choose ADD NEW VARIABLE
- In the Name field write BUILDPACK_URL
- In the VALUE field put
- Save settings
Deploy your app
- Go to Settings page, copy the app git url from the Git URL section.
- Switch to Dokkur Toolbelt and execute this command:
git remote add dokkur git_urlInstead of git_url paste your app's git url.
- Push your app:
git push dokkur masterIf 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.