{ }
Published on

CapRover: Painless Self-Hosted Deployments for Any Stack (2025 Guide)

Authors
  • avatar
    Name
    Ahmed Farid
    Twitter
    @

TIP

If you’re tired of YAML rabbit holes and vendor lock-in invoices, CapRover might be your new favourite DevOps sidekick.

CapRover is an open-source PaaS that converts any Docker-enabled server (AWS, Hetzner, DigitalOcean, even Raspberry Pi) into a Platform-as-a-Service with a slick web dashboard, CLI and one-command app deployments. In this article you’ll:

  1. Install CapRover on a fresh Ubuntu VPS.
  2. Deploy a sample Node.js app with zero downtime.
  3. Set up free HTTPS via Let’s Encrypt.
  4. Add a Postgres database in one click.
  5. Automate deployments using caprover deploy + GitHub Actions.
  6. Scale horizontally & roll back with a single button.

Table of Contents

1. Prerequisites & Terminology

  • Ubuntu 22.04 server (1 vCPU / 1 GB RAM works).
  • DNS A-record pointing captain.example.com to the server IP.
  • Docker 25+ installed (CapRover installs if missing).
TermMeaning
Captain RootMain domain (e.g. captain.example.com) hosting CapRover dashboard
AppA containerised service managed by CapRover
One-Click AppPre-configured template (e.g. Postgres, Ghost)

2. Install CapRover in 60 Seconds

SSH into your server:

curl -fsSL https://get.caprover.com | bash

The script:

  1. Installs Docker & Docker Compose.
  2. Pulls caprover/caprover image.
  3. Creates a Docker swarm (single-node).
  4. Exposes ports 80 & 443.

Once complete, run:

caprover serversetup

Answer prompts for root domain (captain.example.com) and email for SSL.

Browse to https://captain.example.com → create admin password.

3. Deploy Your First App (Node.js Example)

In project root, add captain-definition:

{
  "schemaVersion": 2,
  "dockerfilePath": "Dockerfile",
}

Install CLI locally:

npm i -g caprover
caprover login
# URL: https://captain.example.com  Token: found in dashboard Settings → API Tokens
caprover deploy

CapRover builds the image, pushes to its private registry, schedules container behind an Nginx proxy, and gives a default sub-domain like myapp.captain.example.com.

4. Attach a Custom Domain & Free SSL

Dashboard → Apps / myapp / Networking:

  1. Add api.example.com.
  2. Click Enable HTTPS → Let’s Encrypt certificate issued.
  3. Zero-downtime reload completes in ~10 s.

5. One-Click Databases & Add-ons

Dashboard → One-Click Apps / DatabasesPostgreSQL 16.

Set root password, volume size, click Deploy. Connection string appears—use in your app via secrets.

Secrets: Apps / myapp / Env Vars → add DATABASE_URL.

6. Zero-Downtime Rolling Updates & Rollbacks

Every caprover deploy spins up a new container, waits for health check, then switches traffic. Previous version retained for instant rollback (Apps / Deploys tab).

7. Horizontal Scaling & Auto-Scaling

  • Manual: Apps / myapp / Instance Count → 3.
  • Autoscale: Enable captain-autoscale label with CPU/RAM thresholds (experimental in 2025 release).

8. GitHub Actions CI/CD

.github/workflows/deploy.yml:

name: CapRover Deploy
on:
  push:
    branches: [main]
jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: crazy-max/ghaction-docker-meta@v6
      - uses: caprover/github-action@v2
        with:
          server: ${{ secrets.CAPROVER_SERVER }} # https://captain.example.com
          app: myapp
          token: ${{ secrets.CAPROVER_TOKEN }}

Push to main → workflow builds and triggers caprover deploy API.

9. Backups & Disaster Recovery

  • Use Volumes tab to mount /var/lib/postgresql/data.
  • Schedule docker exec based backups or integrate with Restic.
  • CapRover allows cluster mode (multiple manager nodes) if you join extra servers to the Docker swarm.

10. Monitoring & Alerts

  • Built-in Netdata integration (enable in Settings) for system metrics.
  • Configure Slack Webhook for failed deploys under Notifications.

11. CapRover vs Alternatives

FeatureCapRoverDokkuFly.ioRender
Self-host
Web UIN/A
Built-in registry
One-click DBCommunity
Auto SSLLetsEncrypt plugin
ScalingManual + exp. autoscaleManualGlobalAutomatic

12. Production Checklist

✅ Change default captain admin password.
✅ Enable geo-redundant backups for DB volumes.
✅ Use Cloudflare Proxy in front of CapRover for DDoS & caching.
✅ Keep VPS updated (unattended-upgrades).
✅ Set up UFW: only ports 80/443 open.

13. Further Reading & Resources

  • Official docs: caprover.com/docs
  • Community one-click app repo.
  • DigitalOcean marketplace image.
  • YouTube: CapRover in 15 minutes by SwizzTech.

14. Conclusion

CapRover bridges the gap between DIY Docker and expensive PaaS bills. In under half an hour you get push-to-deploy workflows, managed SSL, horizontal scaling and a growing catalog of one-click services—all running on your affordable VPS. Give it a spin and reclaim control of your deployments! 🚀