Low cost Heroku with Dokku
Heroku is great and while I always recommend my clients to use it and bear the cost, I sometimes need to have an alternative that is cheaper and - more importantly - has the same ease of use as Heroku (read: git push to deploy)
Here comes Dokku (based on Docker)
There are many tutorials/blogs that show how to install Dokku, DigitalOcean even has a dedicated droplet for it. In this post, I just write down some important notes after install Dokku, to make it as similar to Heroku as possible
Important plugins
- user-env-compile (inject user environments during git push, otherwise sometime e.g. asset_precompile might fail)
- dokku-postgres
- dokku-memcached
- dokku-redis (there is a bug in the current version of this plugin that will messes up its entry in /home/dokku/app_name/ENV, need to fix it manually)
- dokku-shoreman (allow Dokku to support different application in Procfile, otherwise your workers won't be deployed)
- link (link the containers created by the plugin with the deployed application)
Important settings
- /home/dokku/app_name/ENV (your environment variables)
- /home/dokku/app_name/CONTAINER (delete this to deploy application from scratch again)
Important Docker commands
- docker ps -all | grep app_name
- docker start/stop/rm/logs container_ID