Using Dokku and Digital Ocean to create your own Heroku
Dokku is a PaaS built with Docker and designed to act like Heroku. You can easily deploy your apps to a remote production server from the command line at a fraction of the cost. You can even use subdomains to deploy multiple apps on the same Dokku install.
Setup Rails Project
Create a new project
Add these lines to your Gemfile
You can install and run Dokku anywhere you’d like, but Digital Ocean’s 1-Click Dokku install is too good to pass up.
- Create and name your droplet. I am currently running two apps on the smallest droplet, so any of them should work.
- Scroll down and work through the options until you get to Select Image. Click Applications and select Dokku.
- Note according to the Dokku Docs, you must disable IPv6 on your droplet.
- After the install finishes, visit your droplets IP address to finish the setup.
- Add your computer’s ssh key.
- Select either to use the droplet’s IP address or your custom domain.
- If you use a hostname, make sure to point your DNS to the droplet IP address for each Dokku app
Deploying Your App
Setup git for your project
Add the Dokku Remote
This will deploy your app to your droplet with the domain name projectname.example.com
Setup PostgreSQL Database
SSH into your droplet and install the Postgres Plugin
Create a Postgres container and link it to our project
Migrate your database
Your site should be up and running! Repeat these steps for each project you put on your Dokku instance.
Check logs with