Deploying web applications doesn’t have to be complicated or expensive. With Dokku—a Docker-powered Platform-as-a-Service (PaaS) that mimics Heroku—and Ramnode’s affordable VPS hosting, you can create your own deployment platform for a fraction of the cost of traditional hosting solutions.
In this comprehensive guide, we’ll walk through setting up Dokku on a Ramnode VPS and deploying your first application.
What You’ll Need
- A Ramnode VPS (minimum 1GB RAM recommended)
- A domain name (optional but recommended)
- Basic command line knowledge
- An application ready for deployment
Why Choose Ramnode + Dokku?
Ramnode offers reliable, affordable VPS hosting with excellent performance and customer support. Our servers are perfect for small to medium-scale applications.
Dokku provides a Heroku-like deployment experience on your own server, giving you:
- Git-based deployments
- Automatic SSL certificates
- Database management
- Plugin ecosystem
- Cost savings compared to managed PaaS solutions
Setting Up Your Ramnode VPS
Ordering Your VPS
- Visit the Cloud Control Panel and choose a VPS plan (1GB RAM minimum for Dokku)
- Choose your preferred data center location
- Select Ubuntu 22.04 or 24.04 LTS as your operating system
Initial Server Setup
Once your VPS is ready, connect via SSH:
ssh root@your-server-ip
Update the system:
apt update && apt upgrade -y
Create a non-root user (optional but recommended):
adduser dokku
usermod -aG sudo dokku
Installing Dokku
Download and Install Dokku
Run the official Dokku installation script:
wget https://raw.githubusercontent.com/dokku/dokku/v0.32.4/bootstrap.sh
sudo DOKKU_TAG=v0.32.4 bash bootstrap.sh
The installation process will take several minutes as it downloads and configures Docker and other dependencies.
Initial Configuration
After installation, visit your server’s IP address in a web browser to complete the setup:
- Add your SSH public key
- Set your hostname (use your domain if you have one)
- Enable virtual host naming for easier app management
Alternatively, configure via command line:
# Set up SSH key
echo "your-public-key-here" | sudo dokku ssh-keys:add admin
# Configure hostname
sudo dokku domains:set-global your-domain.com
Configuring DNS (Optional)
If you’re using a custom domain, configure your DNS settings:
A Records
- Point your main domain to your server IP
- Create a wildcard subdomain:
*.yourdomain.com
→ server IP
This allows you to access apps at app-name.yourdomain.com
.
Deploying Your First Application
Let’s deploy a simple Node.js application as an example.
Prepare Your Application
Ensure your application has the necessary files:
package.json (for Node.js):
{
"name": "my-app",
"version": "1.0.0",
"scripts": {
"start": "node server.js"
},
"dependencies": {
"express": "^4.18.0"
}
}
Procfile (optional but recommended):
web: node server.js
Create the Application on Dokku
On your server, create a new app:
dokku apps:create my-app
Deploy from Git
From your local machine, add Dokku as a remote:
git remote add dokku dokku@your-server-ip:my-app
Deploy your application:
git push dokku main
Dokku will automatically detect your application type, build it, and deploy it.
Essential Dokku Commands
Managing Applications
# List all apps
dokku apps:list
# View app info
dokku apps:info my-app
# Delete an app
dokku apps:destroy my-app
Managing Domains
# Add a custom domain
dokku domains:add my-app example.com
# List domains for an app
dokku domains:report my-app
# Remove a domain
dokku domains:remove my-app example.com
Environment Variables
# Set environment variables
dokku config:set my-app NODE_ENV=production API_KEY=your-key
# View environment variables
dokku config my-app
# Unset a variable
dokku config:unset my-app API_KEY
Adding a Database
Dokku supports various databases through plugins. Let’s add PostgreSQL:
Install PostgreSQL Plugin
sudo dokku plugin:install https://github.com/dokku/dokku-postgres.git
Create and Link Database
# Create a PostgreSQL database
dokku postgres:create my-app-db
# Link it to your app
dokku postgres:link my-app-db my-app
The database URL will be automatically added to your app’s environment variables as DATABASE_URL
.
Setting Up SSL with Let’s Encrypt
Install the Let’s Encrypt plugin:
sudo dokku plugin:install https://github.com/dokku/dokku-letsencrypt.git
Enable SSL for your app:
# Set email for Let's Encrypt
dokku letsencrypt:set my-app email your-email@example.com
# Enable SSL
dokku letsencrypt:enable my-app
# Set up auto-renewal
dokku letsencrypt:cron-job --add
Monitoring and Maintenance
View Application Logs
# View recent logs
dokku logs my-app
# Follow logs in real-time
dokku logs my-app -t
Application Management
# Restart an app
dokku ps:restart my-app
# Scale an app (if using multiple processes)
dokku ps:scale my-app web=2
# Check app status
dokku ps:report my-app
Server Maintenance
Keep your server updated:
# Update system packages
sudo apt update && sudo apt upgrade -y
# Update Dokku
sudo apt update && sudo apt install dokku
Best Practices
Security
- Set up a firewall: Use UFW to restrict access
- Regular updates: Keep your system and Dokku updated
- SSH key authentication: Disable password authentication
Performance
- Monitor resources: Use
htop
anddf -h
to monitor CPU, memory, and disk usage - Set up swap: Add swap space if your VPS has limited RAM
- Optimize applications: Use environment-specific configurations
- Database optimization: Tune database settings for your workload
Backups
- Database backups: Use
dokku postgres:backup
for PostgreSQL - File backups: Regularly backup your application files
- Configuration backups: Save your Dokku configurations
Troubleshooting Common Issues
Build Failures
- Check your application’s dependencies
- Verify Procfile syntax
- Review build logs:
dokku logs my-app
Memory Issues
- Monitor memory usage with
free -h
- Add swap space if needed
- Consider upgrading your VPS plan
SSL Certificate Issues
- Ensure your domain points to your server
- Check that ports 80 and 443 are open
- Verify Let’s Encrypt plugin installation
Conclusion
Deploying applications with Dokku on a Ramnode VPS provides an excellent balance of cost, control, and simplicity. You get the ease of Heroku-style deployments while maintaining full control over your infrastructure at a fraction of the cost.
This setup is perfect for:
- Personal projects and portfolios
- Small to medium business applications
- Development and staging environments
- Learning DevOps concepts
With Dokku handling the deployment complexity and Ramnode providing reliable hosting, you can focus on building great applications rather than managing infrastructure.