Deploying a Sinatra App to Dokku with Custom Domain
Friday May 09 2025 • 03:46 AM
First I create the dokku app with $ dokku apps:create app-name
.
As long as there’s a git repository for the given project, all I gotta do is add the dokku remote according to my SSH config and push to the main branch.
$ git remote add dokku dokku@dokku-server:app-name
$ git push dokku main
Setting a subdomain
For now I’m deploying to a subdomain, so in Porkbun I’m adding an A Record with the Host as the app name and the Answer/Value equal to Mojave’s public IP Address.
SSL Certificate
To make the app accessible via HTTPS, first I set the e-mail associated with the registration:
dokku letsencrypt:set app-name email email@address.com
Next I enable LetsEncrypt on the app:
$ dokku letsencrypt:enable app-name
That’s it!
Setting a Regular Domain
I’m transferring an app from Heroku to my VPS but the process is the same. In Porkbun, I set the A Record to the Mojave IP Address. Then I set the CNAME Record to the desired domain.
Dokku Domain
On the Dokku side, I add a new domain with this command: $ dokku domains:add app-name domain.com
HTTPS
Lastly, I run $ dokku letsencrypt:enable app-name
and that’s it!
That’s one production app migrated from Heroku to my VPS :-)