Deploying Rails apps with Dokku

Update your local apt cache

$ sudo apt-get update

Update dokku and its dependencies

$ sudo apt-get install -qq -y dokku herokuish sshcommand plugn

Confirm SSH Details – In your browser head to your IP address or domain and hit Finish Setup

Rebuild all of your applications

$ dokku ps:rebuildall

Create the App on the Dokku host

$ dokku apps:create your-app-name

Install Postgres – on the Dokku host install the postgres plugin (requires root)

$ sudo dokku plugin:install

Create a postgres service with the name rails-database

$ dokku postgres:create your-app-database

$ dokku postgres:link your-app-database your-app-name

Deploy the app to dokku – execute below from your local machine 

— the remote username must be dokku or pushes will fail
— ( – replace with ip address of instance)

$ cd your-app-name

$ git remote add dokku

Deploy to Dokku

$ git push dokku master

Setting up the app – execute below from dokku container

Migrate Database

$ dokku run your-app-name rails db:migrate

Installing SSL encryption

$ sudo dokku plugin:install

$ dokku config:set –no-restart your-app-name

$ dokku letsencrypt your-app-name dokku letsencrypt:auto-renew your-app-name

If your domain is and SSL is set on run:

$ dokku domains:add your-app-name
$ dokku domains:remove your-app-name

If you want Auto Renewing SSL

$ dokku letsencrypt your-app-name
$  dokku letsencrypt:auto-renew your-app-name

Setting environment variables

$ dokku config:set –no-restart your-app-name KEY1=VALUE1

View web logs in real time

$ dokku logs your-app-name -t -p web