🇫🇷 New VPS location: Marseille, where Europe meets Africa and Asia. 50% off 2 months on any Linux VPS plan with BONJOUR50 Deploy in Marseille →

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

Step 1: Size and Provision Your VPS

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.

🧱 Second app or background job pushing Dokku out of RAM?
Start at the 4 GB floor this guide recommends for multiple containers: KVM4 with 4 vCores and 4 GB ECC RAM
40 GB NVMe  ·  Full root access  ·  Unmetered 1 Gbps  ·  17 locations  ·  $40/mo

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.

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_ID="22.04"

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
Aappsyour_vps_ipv4Routes the main Dokku host to your server
A* or *.appsyour_vps_ipv4Allows 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:

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:

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 loaddokku logs myapp --tail☐
Set required environment variablesdokku config:set myapp KEY=value☐
Confirm process statusdokku ps:report myapp☐
Scale with sufficient resourcesdokku 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 appdokku apps:destroy test-app --force☐
Verify active apps remaindokku apps:list☐
Check Docker disk usagedocker system df☐
Install required database plugindokku plugin:install ...☐
Confirm app database credentialsdokku config <app>☐
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.

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

Facebook
Twitter
LinkedIn

Table of Contents

Get started today

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

Image