vohzd.com

Cheaper Automated Deployments with Caprover

1 min read

Heroku killed its free tier in 2022, so this is more relevant than ever.

Caprover is an open-source Docker management system with one-click apps, Netdata monitoring, a lovely GUI, and (most importantly) a way to automate your deployments by pushing straight to GitHub.

Step 1: Install Caprover

Follow the official tutorial. Takes about 15 minutes.

Step 2: Add a captain-definition file

Create a captain-definition file (no extension) in your project root:

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

Step 3: Create a new app in Caprover

Go to your Caprover dashboard and create a new app. The name you choose becomes the subdomain.

Step 4: Connect to GitHub

Click the Deployment tab, scroll to "Deploy from GitHub", and enter your repo details. Save it and you'll get a webhook URL.

Step 5: Add the webhook to GitHub

Go to your repo in GitHub > Settings > Webhooks > Paste in the webhook URL.

Step 6: Deploy

If it doesn't auto-build, click "Force build" in Caprover. Wait a tick, and your app should be live on its subdomain.

Step 7: Push and watch

Push a change to your GitHub repo and watch it auto-build. Every git push triggers a fresh deployment. Magic.

The whole setup costs whatever your VPS costs, typically around £4/month. Compare that to Heroku's paid tiers and you'll never look back.