I wanted a place to host demo apps and APIs the way Vercel does it: push to GitHub, get a live HTTPS URL. Instead of paying for a platform, I turned a 2020 M1 MacBook Pro (8 GB RAM) into one. The site you are reading right now is served from that laptop. Here is the architecture, the build, and the problems I hit on the way.

#1. What the Mac Can (and Can't) Do

My first idea was to run LLMs on it. With 8 GB of unified memory, that was never going to work: the models I use are 18 to 21 GB. What an M1 is great at is the lightweight part of a platform: a build server, a reverse proxy, a handful of Next.js and .NET containers, and a couple of databases. Heavy AI inference stays on a separate GPU box.

#2. The Architecture

Diagram
git push ──▶ GitHub webhook ──▶ Coolify (Linux VM on the Mac)
                                   │  builds image, rolls out container
                                   ▼
Browser ─▶ app.mydomain ─▶ Cloudflare edge (HTTPS) ─▶ Tunnel ─▶ Traefik ─▶ container

Terraform ──▶ Cloudflare API  (tunnel, DNS, routing rules)
          └─▶ Coolify API     (projects, apps, databases, services)
  • Colima runs a lightweight Ubuntu VM (4 CPU / 4 GB) because Coolify needs Linux.
  • Coolify is the open-source Heroku/Vercel alternative: GitHub integration, Nixpacks/Dockerfile builds, one-click databases, rolling deploys with health checks.
  • Cloudflare Tunnel makes an outbound-only connection to Cloudflare. No port forwarding, no static IP, free HTTPS, and my home IP is never exposed.
  • Terraform describes the whole thing as code: the tunnel, a wildcard DNS record, and every app.

#3. Wildcard Routing: One Rule for Every App

The trick that makes it feel like a PaaS is a single wildcard DNS record pointing at the tunnel, with the tunnel sending everything to Coolify's Traefik proxy. Traefik routes by hostname, so a new app just needs a domain in Coolify. No DNS or Cloudflare changes, ever.

Terraform
resource "cloudflare_dns_record" "wildcard" {
  zone_id = var.cloudflare_zone_id
  name    = "*.mydomain.com"
  type    = "CNAME"
  content = "TUNNEL_ID.cfargotunnel.com"
  proxied = true
}

# Tunnel ingress: every subdomain goes to Traefik
{ hostname = "*.mydomain.com", service = "http://coolify-proxy:80" }

Apps themselves are Terraform resources too. The community Coolify provider can't create applications, so I drive Coolify's REST API with the generic restapi provider. Adding a site is now one map entry and a terraform apply.

#4. Six Things That Broke (and the Fixes)

  • Coolify couldn't SSH into its own server. It connects to host.docker.internal, but under Colima that name points at the Mac, not the Linux VM. Pointing the server at the VM's Docker gateway IP fixed it.
  • Every https:// domain became a redirect loop or a 404. The tunnel talks plain HTTP to Traefik while Cloudflare terminates TLS. An https:// domain in Coolify makes Traefik redirect HTTP to HTTPS forever. Rule of thumb: always http://app.domain:PORT in Coolify; the visitor still gets HTTPS from Cloudflare.
  • The apex domain wouldn't route. *.domain does not match domain itself. The bare domain needs its own DNS record and tunnel rule.
  • An n8n worker crash-looped with NOAUTH. Enabling "Connect to Predefined Network" attached it to Coolify's internal network, where the hostname redis also belongs to Coolify's own password-protected Redis. Turning that setting off restored isolation and fixed the crash.
  • Terraform updates broke deployments. Coolify's create endpoint stores a GitHub repo as owner/repo, but its PATCH endpoint stores whatever you send and later prefixes github.com again. Sending the short form on update fixed it. I only found this because I redeployed right after a Terraform change.
  • "The site is down" (it wasn't). My router cached the domain's empty answer from the minutes when DNS was mid-migration. The whole internet could see the site except my own Wi-Fi. Negative DNS caching is real.

#5. Security on a Home Server

  • No inbound ports: the tunnel only makes outbound connections.
  • Webhook-only exposure: GitHub reaches a hostname that forwards only the /webhooks/ path to Coolify; everything else returns 404. Each webhook is signed with a secret.
  • The admin dashboard requires a password plus TOTP 2FA, and its REST API is blocked at the tunnel (API tokens bypass 2FA). Terraform uses the API over localhost only.
  • Tools with root-level Docker access (Portainer) stay bound to localhost, not the internet.
  • Secrets live in the macOS Keychain and are passed to Terraform as environment variables, never in files.
  • Nightly backups of Coolify's database, encryption key and SSH keys go to the Mac's disk, outside the VM, with 14-day retention.

#6. The Result

This blog post is the test

I committed it to the portfolio repo, pushed to main, and GitHub's webhook told Coolify to rebuild. With a health check on /, the old container keeps serving until the new one is healthy, so the deploy has no downtime. Grafana and n8n run alongside it as one-click services on their own subdomains.

#7. Honest Limitations

  • It's a laptop: if it sleeps or loses power, the sites go down. Fine for demos, not for production.
  • 8 GB is tight. Builds are the peak, so I keep concurrent builds to one.
  • The same Terraform code can later point at a small cloud VM with almost no changes. That is the real win of doing it as code from day one.