Dokku is installed on a linode (small) and is set to use the wagnermatos.co.uk domain, which means that every app could be deployed to a subdomain in the app, such as app-name.wagnermatos.co.uk. The domain configuration is done on Dokku so no changes required on Hover unless we need to use a dedicated domain, which will require further instructions.

How to create an app on Dokku

Login on to the dokku server

ssh root@dokku # if host file is set otherwise
ssh [email protected]

Then create the app

# on the Dokku host
dokku apps:create ruby-getting-started
# ruby-getting-started is the name of the app

Create the backend services.

Dokku by default does not provide datastores (e.g. MySQL, PostgreSQL) on a newly created app. You can add datastore support by installing plugins, and the Dokku project provides official plugins for common datastores.

The Getting Started app requires a PostgreSQL service, so install the plugin and create the related service as follows:

# on the Dokku host
# install the postgres plugin
# plugin installation requires root, hence the user change
sudo dokku plugin:install <https://github.com/dokku/dokku-postgres.git>

# create a postgres service with the name railsdatabase
dokku postgres:create railsdatabase

Linking backing services to applications

# on the Dokku host
# each official datastore offers a `link` method to link a service to any application
dokku postgres:link railsdatabase ruby-getting-started

Deploying the app

# from your local machine
# the remote username *must* be dokku or pushes will fail
cd ruby-getting-started
git remote add dokku [email protected]:ruby-getting-started
git push dokku main:master
# note the following: the IP address above is the actual IP of the 
# linode and ruby-getting-started is the app name as used above

After running git push dokku main:master you should have output similar to this in your terminal:

Counting objects: 231, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (162/162), done.
Writing objects: 100% (231/231), 36.96 KiB | 0 bytes/s, done.
Total 231 (delta 93), reused 147 (delta 53)
-----> Cleaning up...
-----> Building ruby-getting-started from herokuish...
-----> Adding BUILD_ENV to build environment...
-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.2.1
-----> Installing dependencies using 1.9.7
       Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
       Fetching gem metadata from <https://rubygems.org/>...........
       Fetching version metadata from <https://rubygems.org/>...
       Fetching dependency metadata from <https://rubygems.org/>..
       Using rake 10.4.2

...

=====> Application deployed:
       <http://ruby-getting-started.wagnermatos.co.uk>
# where ruby-getting-started is the app name

Redeploying or restarting

# on the Dokku host
dokku ps:rebuild ruby-getting-started

For more info: http://dokku.viewdocs.io/dokku~v0.23.4/deployment/application-deployment/