🇯🇵 Tokyo is live! 🚀 Launch your VPS and enjoy 2 months off — use code KONNICHIWA50 🎉 Get Started Today →

VPS for Dokku: Deploy Your Side Projects in 5 Minutes (Vibe Coder Playbook)

For a smooth Dokku experience, choose a VPS with the right configuration. For most side projects, a VPS with 1 vCPU, 2 GB RAM, and 25–40 GB SSD is a good starting point. This setup provides enough resources for Dokku itself, one database or managed add-on later, and a small web app with room for logs and build cache. A basic Node or Python app often uses between 150–400 MB RAM per process, while small Ruby apps might require around 300–600 MB once warmed up. Remember that Dokku, Docker containers, and the OS also use memory, so treat app memory as only a part of the total requirement.

App typeTypical process RAMExpected app containersRecommended starting VPS
Small Node.js API or Next.js app150–350 MB11 vCPU / 2 GB RAM / 25 GB SSD
Python Flask or FastAPI app150–300 MB11 vCPU / 2 GB RAM / 25 GB SSD
Python Django app250–500 MB1–22 vCPU / 4 GB RAM / 50 GB SSD
Ruby on Rails app300–600 MB12 vCPU / 4 GB RAM / 50 GB SSD
Any app with 2 web containers300–900 MB total22 vCPU / 4 GB RAM / 50 GB SSD

The takeaway: 2 GB works for one small app, but 4 GB is the safer floor when running multiple containers, heavier frameworks, or background jobs.

⚡ Spin up a Premium VPS in 2 minutes
17 locations worldwide
NVMe  ·  Unmetered 1 Gbps  ·  Full root access  ·  From $10/mo
Pick Your Location →

Location is as important as size. Users notice improvements in responsiveness when latency drops. Choose the VPS region closest to your primary users. For instance, if your audience is on the US East Coast, opt for a nearby location instead of a distant one. A nearby region can keep network latency under 50 ms, whereas cross-ocean routes may reach 80–150 ms before your app starts processing. For more details on hosting options, read our article on VPS vs cloud hosting.

Provisioning a VPS is straightforward in most cloud panels:

  1. Create a new VPS instance.
  2. Choose a region nearest your users.
  3. Select Ubuntu 22.04 LTS.
  4. Pick the size from the table above.
  5. If supported, add your SSH key during setup.
  6. Name the server something descriptive, for example, `dokku-prod-1`.
  7. Create the instance and note the public IPv4 address.

For an optimal experience, consider using VPSus VPS hosting. VPSus offers plans that align with the recommended configurations above, ensuring excellent performance and reliability for your Dokku deployment.

Selecting Your OS Image

3D illustration of a database server with a shield and key, symbolizing data security and protection on a dark background.

Use Ubuntu 22.04 LTS unless you have a compelling reason otherwise. This release provides a stable package base, long-term security updates, and broad compatibility with Dokku’s setup path.

To confirm the OS after the VPS boots, connect via the provider console and run:

cat /etc/os-release

You should see output similar to:

PRETTY_NAME="Ubuntu 22.04.4 LTS"
NAME="Ubuntu"
VERSION_

This confirms that you’re on a supported Ubuntu release and ready to proceed with SSH hardening.

Step 2: Secure SSH Access and Basic Hardening

Before installing Dokku, secure your VPS by enabling key-only SSH access, setting a non-default SSH port, and configuring a firewall to expose only necessary ports. This process takes about 3–5 minutes and prevents common security oversights.

If your VPS panel supports SSH key uploads, use it rather than adding keys manually later. Look for options like SSH Keys, Security, or Access, and paste the contents of your public key (usually obtained with the command below):

cat ~/.ssh/id_ed25519.pub

The output should be a single line beginning with `ssh-ed25519`, followed by a long key string and your email or hostname comment. Attach this key to your server, then test the login:

ssh root@your_server_ip

You should log in without being prompted for a password.

Once key login is confirmed, harden SSH by modifying the configuration. This not only reduces automated attacks on port 22 but also minimizes brute-force vulnerabilities. Open the SSH configuration file for editing:

sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak
sudo nano /etc/ssh/sshd_config

In the file, set or change the following lines:

Port 2222
PasswordAuthentication no
PermitRootLogin prohibit-password
PubkeyAuthentication yes

After saving the changes, restart SSH:

sudo systemctl restart ssh

Before ending your current session, verify the changes by opening a new terminal and connecting with the new port:

ssh -p 2222 root@your_server_ip

You should log in using your key without a password prompt.

Configuring UFW Firewall

Configure UFW (Uncomplicated Firewall) to limit inbound traffic to essential services only (SSH, HTTP, and HTTPS). Run the following commands:

sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow 2222/tcp
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw enable
sudo ufw status numbered

The output should list rules for ports 2222, 80, and 443, with all other incoming traffic blocked.

Hardening TaskPurposeDone
Upload SSH public key in panelPrevents password-based initial login
Confirm key-based SSH loginAvoids lockout during hardening
Change SSH port from 22 to 2222Reduces exposure to automated scans
Disable password authenticationBlocks brute-force password attacks
Configure UFW to allow only 2222/80/443Limits incoming connections to essentials

With these steps complete, your VPS is secure and ready for Dokku installation.

Step 3: Install Dokku with the Bootstrap Script

Stack of servers connected to a key and rocket icon, symbolizing security and innovation, on a dark blue background.

Dokku’s bootstrap script transforms a plain Ubuntu server into a functional, mini Heroku-like platform in a single command. On Ubuntu 22.04, download and run the official script with your hostname and SSH key settings provided via environment variables. This pre-seeds Dokku’s setup prompts and speeds up installation.

wget -NP . https://dokku.com/install/v0.35.19/bootstrap.sh
sudo DOKKU_TAG=v0.35.19 \
  bash bootstrap.sh

For more on container management, check out our Docker VPS hosting guide.

Verify Dokku installation with:

dokku version

Expected output:

dokku version 0.35.19

The bootstrap script installs Docker, nginx, and Dokku, and it might launch a web-based setup step if configuration variables are not preseeded. For a quicker installation, use environment variables:

export DOKKU_HOSTNAME=apps.example.com
export DOKKU_KEY_FILE=/root/.ssh/authorized_keys
export DOKKU_SKIP_KEY_FILE=0
wget -NP . https://dokku.com/install/v0.35.19/bootstrap.sh
sudo -E DOKKU_TAG=v0.35.19 bash bootstrap.sh

Then, verify the setup:

echo "$DOKKU_HOSTNAME" && test -f "$DOKKU_KEY_FILE" && echo "key file found"

Expected output:

apps.example.com
key file found

Step 4: Configure Your Domain and Enable SSL

Proper DNS configuration is vital for Dokku. The goal is to point your domain at your VPS, reserve a wildcard for future apps, and secure all connections with TLS certificates.

For example, if your Dokku hostname is `apps.example.com`, configure these DNS records:

TypeNameValuePurpose
A`apps``your_vps_ipv4`Routes the main Dokku host to your server
A`` or `.apps``your_vps_ipv4`Allows new apps to resolve automatically
A`@``your_vps_ipv4`(Optional) Points the root domain to your server

The wildcard record ensures you don’t have to update DNS for every new Dokku app.

Before initiating SSL, confirm that DNS resolves correctly:

dig +short apps.example.com
dig +short test.apps.example.com

Both commands should return your VPS public IP. Once confirmed, install Dokku’s Let’s Encrypt plugin:

sudo dokku plugin:install https://github.com/dokku/dokku-letsencrypt.git
dokku letsencrypt:set --global email you@example.com
dokku letsencrypt:enable myapp

Verify SSL setup with:

dokku letsencrypt:list

Expected output should show the app (e.g., `myapp`) with Let’s Encrypt enabled.

Testing Your HTTPS Endpoint

After SSL is issued, verify both TLS and app routing:

curl -I https://myapp.apps.example.com

Expected output should include a status code of 200 and indicate nginx is handling requests, for example:

HTTP/2 200
server: nginx

You can inspect the certificate with:

echo | openssl s_client -connect myapp.apps.example.com:443 -servername myapp.apps.example.com 2>/dev/null | openssl x509 -noout -issuer -subject -dates

This should display certificate details with a valid issuer, your domain as the subject, and an expiry date in the future.

Step 5: Deploy Your First App via Git Push

Isometric illustration of a data server stack with arrows indicating data flow, set against a dark blue background.

The deployment phase is where everything comes together. Create a Dokku app, set up your Git repository remote, and deploy with a single push.

First, create the app on the server to initialize configuration and routing:

dokku apps:create myapp
dokku apps:list
dokku domains:report myapp

The output from `dokku apps:list` should include `myapp`, and the domains report should detail its assigned domain (e.g., `myapp.apps.example.com`).

Next, add Dokku as a remote in your local Git repository:

git remote add dokku dokku@your-server-hostname:myapp
git remote -v

You should see output similar to:

dokku  dokku@your-server-hostname:myapp (fetch)
dokku  dokku@your-server-hostname:myapp (push)

Deploy your app by pushing the desired branch:

git push dokku main

A successful deployment log typically includes messages such as receiving source, detecting buildpack, building image, and deploying web process. An example log:

-----> Cleaning up...
-----> Building myapp from herokuish
-----> Adding BUILD_ENV to build environment...
-----> Node.js app detected
-----> Installing dependencies
-----> Building runtime image
-----> Releasing myapp...
-----> Checking for predeploy task
-----> Checking for release task
=====> Application deployed:
       http://myapp.apps.example.com

Confirm functionality with:

curl -I https://myapp.apps.example.com

A status code of 200 or the appropriate redirect indicates success.

Common Buildpack Issues

Missing Startup Command

If you encounter errors about a startup command, your app may need a `Procfile` to define the process to run. For example:

procfile

web: npm start

Add and commit the `Procfile` then deploy again:

git add Procfile
git commit -m "Add Procfile"
git push dokku main

The deployment log should show a successful release without process-type errors.

No Supported Buildpack Detected

If Dokku reports that no supported buildpack was detected, verify that your repository contains the required files:

• For Node.js: a `package.json`

• For Python: a `requirements.txt` or `pyproject.toml`

• For PHP: a `composer.json`

Ensuring these files are present will help Dokku detect and use the correct buildpack, leading to a successful build.

Step 6: Manage and Scale Your Application

Post-deployment, monitor your app to ensure it operates smoothly. Check logs to spot any runtime issues:

dokku logs myapp --tail

This command should display a live feed of log messages, including startup notifications and any errors. If you encounter repeated restarts or memory issues, address these before further scaling.

Set environment variables to avoid hardcoding sensitive data:

dokku config:set myapp NODE_ENV=production API_BASE_URL=https://api.example.com

Verify the configuration with:

dokku config myapp

You should see the variables, such as `NODE_ENV: production` and `API_BASE_URL: https://api.example.com`.

If your app requires a specific startup command, define it in your `Procfile`. For example:

procfile

web: gunicorn app:app –bind 0.0.0.0:$PORT –workers 2

After modifying the `Procfile`, commit and push the changes, then check the process report:

git add Procfile && git commit -m "Set web process" && git push dokku main
dokku ps:report myapp

Scale your web process when necessary:

dokku ps:scale myapp web=2

Verify scaling with:

dokku ps:report myapp

The report should show two running web containers. Keep in mind that a small Node or Python container may use 150–400 MB RAM, so ensure your VPS has sufficient resources. On a 1 vCore system, running two busy containers might lead to latency spikes. Scale only after confirming that both CPU and RAM can accommodate the additional load.

Rolling Back a Bad Deploy

If a new release introduces issues, try rebuilding the app first to resolve environment or dependency problems:

dokku ps:rebuild myapp

After rebuilding, inspect the logs:

dokku logs myapp --tail

If the issue persists, rollback by deploying a previous commit. For example:

git log --oneline -n 5
git checkout <good-commit>
git push dokku HEAD:main

Finally, verify the rollback:

curl -I https://myapp.apps.example.com

A `200` status or proper redirect confirms a successful rollback.

Post-Deploy Checklist

TaskCommandDone
Check live logs during initial load`dokku logs myapp –tail`
Set required environment variables`dokku config:set myapp KEY=value`
Confirm process status`dokku ps:report myapp`
Scale with sufficient resources`dokku ps:scale myapp web=2`

Logs reveal issues, and environment variables ensure your app is portable. Scale only when your server resources permit.

Step 7: Clean Up, Backups, and Next Steps

After a successful deploy, remove any unnecessary components and set up backups. For example, if you created a test app during setup, remove it to free up resources:

dokku apps:destroy test-app --force
dokku apps:list

Ensure that `test-app` no longer appears. If disk usage becomes a concern, inspect Docker’s footprint:

docker system df

This command displays space used by images, containers, and the build cache. If deploys consume several gigabytes, consider periodic cleanups.

Set Up Database Backups

Backup is crucial when dealing with user data. Dokku offers database plugins to facilitate backups. For example, to set up PostgreSQL:

sudo dokku plugin:install https://github.com/dokku/dokku-postgres.git postgres
dokku postgres:create myapp-db
dokku postgres:link myapp-db myapp

Check the database information with:

dokku postgres:info myapp-db
dokku config myapp | grep DATABASE_URL

You should see relevant database details and an active `DATABASE_URL` configuration. Configure the backup process using the plugin’s commands, ensuring that backups are stored off-VPS.

Plugin Catalog and Next Steps

Dokku’s rich plugin ecosystem enables your VPS to offer more than just web hosting. Explore additional plugins for PostgreSQL, MySQL, or Redis. To compare web servers or explore other deployment options, read our article on Apache vs NGINX.

Cleanup and Next-Steps Checklist

TaskCommand or LinkDone
Delete throwaway app`dokku apps:destroy test-app –force`
Verify active apps remain`dokku apps:list`
Check Docker disk usage`docker system df`
Install required database plugin`dokku plugin:install …`
Confirm app database credentials`dokku config `
Explore additional pluginsDokku plugin catalog

Clean up unused components, back up critical data, and add new components only as necessary. Your next step is to choose a VPS location that best meets your network latency requirements—VPSus, for instance, offers competitive VPS plans in regions that optimize performance for your target audience.

Your journey to a reliable and secure Dokku deployment begins here.

Frequently Asked Questions

What is Dokku and why use it?

Dokku is a lightweight platform-as-a-service that lets you deploy and manage apps on your VPS with minimal configuration, effectively turning your server into a mini Heroku.

How do I choose the right VPS size for Dokku?

For small projects, a VPS with 1 vCPU, 2 GB RAM, and 25–40 GB SSD is sufficient. Upgrade to 4 GB RAM if you plan to run multiple containers or use heavier frameworks.

How can I secure my Dokku VPS installation?

Secure your VPS by enforcing key-only SSH authentication, changing the default SSH port, and using firewall rules to allow only necessary connections.

What common issues should I watch for during deployment?

Common issues include buildpack detection errors and missing startup commands. Ensure that your app includes necessary files such as a Procfile and monitor logs for troubleshooting.

Why is DNS configuration important for Dokku?

Proper DNS, including wildcard records, is essential to ensure your domain points to your VPS and that SSL certificates are issued correctly for secure connections.
Facebook
Twitter
LinkedIn

Table of Contents

Get started today

With VPS.US VPS Hosting you get all the features, tools

Image