Deployment Guide

    Deploy Apps with Dokku

    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.

    Ubuntu 22.04/24.04
    Dokku PaaS
    ⏱️ 30-45 minutes

    What You'll Need

    Before starting, ensure you have:

    Server Requirements

    • • RamNode VPS (minimum 1GB RAM recommended)
    • • Ubuntu 22.04/24.04 LTS
    • • A domain name (optional but recommended)
    • • SSH access to your server

    Knowledge Requirements

    • • Basic command line knowledge
    • • An application ready for deployment
    • • Git basics
    • • Understanding of web applications

    Why Choose RamNode + Dokku?

    RamNode Benefits

    • • Reliable, affordable VPS hosting
    • • Excellent performance and customer support
    • • Perfect for small to medium-scale applications
    • • Multiple data center locations

    Dokku Benefits

    • • Git-based deployments
    • • Automatic SSL certificates
    • • Database management
    • • Plugin ecosystem
    • • Cost savings vs managed PaaS
    3

    Setting Up Your RamNode VPS

    Order your VPS and set up the initial configuration:

    Ordering Your VPS

    1. 1. Visit the Cloud Control Panel and choose a VPS plan (1GB RAM minimum for Dokku)
    2. 2. Choose your preferred data center location
    3. 3. Select Ubuntu 22.04 or 24.04 LTS as your operating system
    4. 4. Complete the order and wait for provisioning
    Connect via SSH
    ssh root@your-server-ip
    Update System Packages
    apt update && apt upgrade -y
    4

    Initial Server Configuration

    Set up basic security and create a user:

    Create a New User
    adduser dokku
    usermod -aG sudo dokku
    su - dokku
    Configure SSH Key (Optional but Recommended)
    mkdir -p ~/.ssh
    chmod 700 ~/.ssh
    nano ~/.ssh/authorized_keys

    Set up a basic firewall:

    Configure UFW Firewall
    sudo ufw allow OpenSSH
    sudo ufw allow 80/tcp
    sudo ufw allow 443/tcp
    sudo ufw enable

    ⚠️ Warning: Make sure SSH is allowed before enabling UFW to avoid losing access!

    5

    Install Dokku

    Install Dokku using the official installation script:

    Download and Install Dokku
    wget -NP . https://dokku.com/install/v0.34.8/bootstrap.sh
    sudo DOKKU_TAG=v0.34.8 bash bootstrap.sh

    ⏱️ Note: The installation process may take 10-15 minutes. Be patient while Docker and dependencies are installed.

    Verify Installation
    dokku version

    ✅ Dokku is now installed and ready for configuration!

    6

    Domain and SSH Setup

    Configure your domain and SSH keys for deployment:

    Set Global Domain (Optional)
    dokku domains:set-global yourdomain.com

    Add your SSH public key for Git deployments:

    Add SSH Key for Deployments
    # On your local machine, copy your public key
    cat ~/.ssh/id_rsa.pub
    
    # On the server, add the key
    echo "your-public-key-here" | dokku ssh-keys:add admin

    💡 Tip: If you don't have an SSH key, generate one with ssh-keygen -t rsa -b 4096

    7

    Create Your First App

    Create a new application in Dokku:

    Create App
    dokku apps:create my-app
    Set App Domain (Optional)
    dokku domains:set my-app my-app.yourdomain.com
    View App Info
    dokku apps:list

    App Configuration Options

    • dokku config:set my-app KEY=value - Set environment variables
    • dokku domains:add my-app domain.com - Add additional domains
    • dokku ps:scale my-app web=2 - Scale application
    8

    Deploy Your Application

    Deploy your application using Git:

    Add Git Remote (On Your Local Machine)
    cd /path/to/your/app
    git remote add dokku dokku@your-server:my-app
    Deploy Application
    git push dokku main

    Sample Application Structure

    For a Node.js app, ensure you have:

    • package.json with start script
    • Procfile (optional): web: node server.js
    • • Your application files

    🚀 Your application should now be deployed and accessible at your domain!

    9

    Configure Your Application

    Configure environment variables and application settings:

    Set Environment Variables
    dokku config:set my-app NODE_ENV=production
    dokku config:set my-app DATABASE_URL=your-database-url
    dokku config:set my-app SECRET_KEY=your-secret-key
    View Current Configuration
    dokku config:show my-app
    View Application Logs
    dokku logs my-app --tail

    10

    SSL Certificate Setup

    Enable automatic SSL certificates with Let's Encrypt:

    Install Let's Encrypt Plugin
    sudo dokku plugin:install https://github.com/dokku/dokku-letsencrypt.git
    Configure Let's Encrypt
    dokku config:set --no-restart my-app DOKKU_LETSENCRYPT_EMAIL=your-email@domain.com
    dokku letsencrypt:enable my-app
    Auto-renew SSL Certificates
    dokku letsencrypt:cron-job --add

    🔒 Your application now has automatic SSL certificates that will renew automatically!

    11

    Database Setup

    Install and configure databases for your applications:

    💡 Tip: Database connection URLs are automatically added to your app's environment variables when linked.

    12

    Monitoring and Maintenance

    Monitor your applications and perform maintenance tasks:

    Monitoring Commands

    • dokku logs my-app
    • dokku ps:report my-app
    • dokku apps:list
    • dokku config:show my-app

    Maintenance Tasks

    • dokku cleanup
    • dokku ps:restart my-app
    • dokku apps:destroy my-app
    • dokku system:report
    Backup and Restore
    # Backup database
    dokku postgres:export my-app-db > backup.sql
    
    # Import database
    dokku postgres:import my-app-db < backup.sql
    13

    Troubleshooting Common Issues

    14

    Best Practices and Security

    Security Best Practices

    • • Keep Dokku and plugins updated
    • • Use SSH keys instead of passwords
    • • Enable automatic SSL certificates
    • • Regularly backup your databases
    • • Monitor application logs
    • • Use environment variables for secrets

    Performance Tips

    • • Right-size your VPS for your apps
    • • Use appropriate scaling for web processes
    • • Implement proper caching strategies
    • • Monitor resource usage regularly
    • • Clean up unused containers and images
    • • Use CDN for static assets
    Regular Maintenance Commands
    # Update Dokku
    sudo dokku plugin:update
    
    # Clean up unused containers and images
    dokku cleanup
    
    # View system resource usage
    dokku system:report

    🎉 Congratulations! You now have a fully functional Dokku PaaS running on your RamNode VPS. You can deploy multiple applications, manage databases, and scale as needed—all with simple Git-based deployments!