Dokku Cheat Sheet

Installation

wget https://raw.githubusercontent.com/dokku/dokku/v0.24.3/bootstrap.sh
sudo DOKKU_TAG=v0.24.3 bash bootstrap.sh
# go to your server's IP and follow the web installer

Pushing new app

git remote add dokku dokku@[SERVER]:[Sub Domain]   

example sub-domain app

git remote add dokku dokku@kruyvanna.com:blog

The resulting app will be hosted at blog.kruyvanna.com

example root domain app

git remote add dokku dokku@kruyvanna.com:kruyvanna.com

The resulting app will be hosted at kruyvanna.com

Dokku and MongoDB

Installation

sudo dokku plugin:install https://github.com/dokku/dokku-mongo.git mongo

Create a database

dokku mongo:create DB_NAME
dokku mongo:link [DB_NAME] [APP_NAME]

Dokku and SSL Using Let’s Encrypt

Installation

sudo dokku plugin:install https://github.com/dokku/dokku-letsencrypt.git

Enable SSH on an app

dokku config:set --no-restart [APP_NAME] DOKKU_LETSENCRYPT_EMAIL=[YOUR_EMAIL]

dokku letsencrypt [APP_NAME] 

dokku letsencrypt:cron-job --add [APP_NAME] 

Dokku Customize nginx

Increasing file upload size

mkdir /home/dokku/APP_NAME/nginx.conf.d/
echo 'client_max_body_size 50m;' > /home/dokku/APP_NAME/nginx.conf.d/upload.conf
chown dokku:dokku /home/dokku/APP_NAME/nginx.conf.d/upload.conf
service nginx reload