How to Deploy Dokku on a VPS: Your Own Heroku with Git Push Deploys and Buildpacks
Dokku is a self-hosted Platform as a Service that replicates the Heroku deployment experience on your own VPS — git push dokku main deploys your application, Buildpacks auto-detect the language and build the app, environment variables work like Heroku config vars, and plugins add databases with one command. Dokku is CLI-first and lightweight: ~50 MB RAM overhead versus Coolify’s 750 MB+, and no web UI to maintain.
Dokku vs Coolify vs Kamal
| Factor | Dokku | Coolify | Kamal |
|---|---|---|---|
| Interface | CLI | Web dashboard | CLI |
| RAM overhead | ~50 MB | ~750 MB–1.2 GB | Minimal |
| Build system | Buildpacks (Heroku-compatible) | Nixpacks | Docker |
| Database plugins | Yes (PostgreSQL, Redis, MariaDB) | Yes | No (manage separately) |
| Maturity | 2013 (very mature) | 2022 | 2023 |
| Best for | Heroku migrants, CLI lovers | Dashboard users | Docker-heavy teams |
Step 1: Install Dokku
# Supports Ubuntu 20.04, 22.04, 24.04
wget -NP . https://dokku.com/install/v0.35.8/bootstrap.sh
sudo DOKKU_TAG=v0.35.8 bash bootstrap.sh
dokku version # Verify installation
Step 2: Initial Server Configuration
# Add your SSH public key (enables git push authentication)
cat ~/.ssh/id_ed25519.pub | sudo dokku ssh-keys:add admin
# Set your server's global domain (apps become app.yourdomain.com)
dokku domains:set-global yourdomain.com
Step 3: Create and Deploy Your First App
# On the VPS: create the app
dokku apps:create myapp
# On your LOCAL machine: add Dokku as a git remote and push
git remote add dokku dokku@YOUR_VPS_IP:myapp
git push dokku main
Dokku auto-detects the language via Heroku Buildpacks:
- Node.js: detects
package.json→npm install && npm start - Python: detects
requirements.txt→ runs gunicorn - Ruby/Rails: detects
Gemfile - PHP: detects
composer.json - Go: detects
go.mod - Docker: uses
Dockerfileif present (overrides Buildpacks) - Static:
index.htmlat root
Step 4: Add Databases via Plugins
# Install database plugins
sudo dokku plugin:install https://github.com/dokku/dokku-postgres.git postgres
sudo dokku plugin:install https://github.com/dokku/dokku-redis.git redis
# Create PostgreSQL database
dokku postgres:create myapp-db
# Link database to app (sets DATABASE_URL environment variable automatically)
dokku postgres:link myapp-db myapp
# Create and link Redis
dokku redis:create myapp-cache
dokku redis:link myapp-cache myapp
# Verify environment variables
dokku config myapp
Step 5: Set Environment Variables
# Set multiple variables at once
dokku config:set myapp \
NODE_ENV=production \
SECRET_KEY=your_secret_here \
SENDGRID_API_KEY=your_key \
REDIS_URL=redis://...
# View current config
dokku config myapp
# Unset a variable
dokku config:unset myapp OLD_VAR
Step 6: Custom Domain and Let’s Encrypt SSL
# Install Let's Encrypt plugin
sudo dokku plugin:install https://github.com/dokku/dokku-letsencrypt.git
# Configure email for certificate notifications
dokku letsencrypt:set --global email admin@yourdomain.com
# Add custom domain
dokku domains:add myapp myapp.yourdomain.com
# Issue SSL certificate
dokku letsencrypt:enable myapp
# Set up automatic renewal for all apps
dokku letsencrypt:auto-renew
Essential Dokku Operations
# View app logs (tail mode)
dokku logs myapp -t
# Run one-off command (like Heroku run)
dokku run myapp node -e "console.log(process.env.DATABASE_URL)"
dokku run myapp python manage.py migrate
dokku run myapp rails db:migrate
# Scale processes
dokku ps:scale myapp web=2 worker=1
# View running processes
dokku ps:report myapp
# Restart app
dokku ps:restart myapp
# Enter running container
dokku enter myapp web
# List all apps and their status
dokku apps:list
Procfile Support
Dokku reads a Procfile in your repository — identical to Heroku syntax:
# Procfile
web: node server.js
worker: node worker.js
release: node scripts/migrate.js # Runs before web starts on each deploy
Zero-Downtime Deployments
# Enable zero-downtime deploys (health check before switching traffic)
dokku checks:enable myapp
# Create CHECKS file in repo root to define health check:
# (CHECKS file content)
WAIT=5
ATTEMPTS=5
/api/health 200
Getting Started
Dokku’s 50 MB overhead means it fits on any VPS plan. The 2 vCPU / 2 GB RAM Ubuntu VPS at VPS.DO runs Dokku with multiple applications and their databases comfortably. For teams migrating from Heroku, Dokku is the most natural migration path — Buildpacks work unchanged, Procfiles work unchanged, and config vars work identically.
Conclusion
Dokku brings the Heroku developer experience to your own VPS: git push to deploy, Buildpacks for multi-language support, plugins for databases, Let’s Encrypt SSL, and process scaling — all via familiar CLI commands. At 50 MB RAM overhead and a mature 10+ year codebase, it is the lightest-weight self-hosted PaaS and the most direct Heroku alternative for developers who prefer CLI workflows over web dashboards.