Dokku is powered by Docker PaaS implementation
Install Dokku on Ubuntu VPS
wget https://raw.githubusercontent.com/dokku/dokku/v0.26.8/bootstrap.sh
DOKKU_TAG=v0.26.8 bash bootstrap.sh
Add SSH key/s
echo 'copy mykey1 pub ssh key here' | dokku ssh-keys:add mykey1
echo 'copy mykey2 pub ssh key here' | dokku ssh-keys:add mykey2
Set Domain for Dokku
dokku domains:set-global example.com
Install Postgre
dokku plugin:install https://github.com/dokku/dokku-postgres.git
Install Redis
dokku plugin:install https://github.com/dokku/dokku-redis.git redis
Deploy Ruby on Rails Application
Run-on your local machine (The example is based on an existing Rails application with Git source version control. You will gonna need a dokku client)
cd myapp/
dokku apps:create myapp
Create and link Postgre database for your application
dokku postgres:create myapp_database
dokku postgres:link myapp_database myapp
Create and link Redis instance for your application
dokku redis:create myapp_redis
dokku redis:link myapp_redis myapp
Deploy on Dokku
git remote add dokku [email protected]:myapp
git push dokku master:master
Run-on the dokku server
dokku run myapp rake db:migrate
dokku run myapp rake db:seed
dokku config:set myapp ENV1=VALUE1 ENV2=VALUE2 # set env variables for your app
Useful commands
Tail logs
dokku logs myapp -t
dokku nginx:access-logs myapp
dokku nginx:error-logs myapp
Run Rails console
dokku run myapp rails c
PostgreSQL console
dokku postgres:connect myapp_database
Print application configs
dokku config myapp
Restart/Re-deploy application
dokku ps:restart myapp
dokku ps:rebuild myapp
Tips
Skip the deployment on container rebuild
dokku config:set myapp DOKKU_SKIP_DEPLOY=true
Change Proxy port for application
dokku proxy:ports-set myapp http:80:3000
Import SQL dump
dokku postgres:connect myapp_database < myapp_database.sql
Add persistent storage for file uploads
mkdir -p /var/lib/dokku/data/storage/myapp
dokku storage:mount myapp /var/lib/dokku/data/storage/myapp:/app/storage
chown -R dokku:dokku /var/lib/dokku/data/storage/myapp
dokku ps:restart myapp
dokku storage:report myapp