← All posts

The Solo VPS Stack (and How Not to Break Your Email)

Running your own VPS is one of the highest-leverage skills you can have as an independent developer. For the price of a couple of lunches a month, a single Linux box can host multiple web apps, a PostgreSQL instance, background workers, and reverse proxies.

It is also the fastest way to accidentally take down your own email if you aren't careful when retiring old hosting or migrating DNS.

The Stack That Actually Stays Up

Over the past year, my self-hosted setup settled into a boring, predictable stack:

  • Docker Compose for isolating each web app and its dependencies.
  • Nginx on the host (or in a dedicated proxy container) handling TLS termination via Let's Encrypt and routing subdomains to internal ports.
  • Gunicorn + Flask (or static bundles) for lightweight web apps.
  • PostgreSQL in a persistent volume with automated nightly pg_dump backups shipped off-box.

At one point I also ran Mailcow for self-hosted email. While Mailcow is an impressive piece of engineering, maintaining IP reputation, PTR records, and deliverability for a solo domain is a part-time job. Moving critical domain email to Google Workspace while keeping web apps on a VPS (or eventually retiring a VPS altogether) is a much saner split.

The Trap: Deleting Website Hosting When Email Lives on the Same Domain

Here is a scenario that catches people constantly: you decide to cancel an old web hosting plan or shut down a VPS, and you wonder, "If I delete this hosting, will my email still work?"

The answer depends entirely on where your authoritative DNS lives, not where your website files live.

Email routing relies on MX records (plus TXT records for SPF, DKIM, and DMARC). Your website relies on A, AAAA, and CNAME records. They are completely independent—unless your hosting provider is also your DNS host and canceling the hosting plan deletes the entire DNS zone.

The Pre-Deletion DNS Checklist

Before you cancel hosting, shut down a VPS, or move DNS back to your registrar (like GoDaddy), run through this five-step checklist:

1. Check Your Authoritative Nameservers

Run a quick dig or whois lookup from your terminal:

dig NS yourdomain.com +short
  • If the nameservers point to your registrar (e.g., domaincontrol.com for GoDaddy) or Cloudflare, canceling your VPS will not touch your DNS zone.
  • If the nameservers point to your web host (e.g., ns1.hostinger.com), deleting the hosting package can wipe your DNS records and immediately bounce incoming mail.

2. Snapshot Every Existing Record

Before changing anything, export or screenshot your entire DNS zone. Pay special attention to:

  • MX records: For Google Workspace, typically smtp.google.com (or the legacy aspmx.l.google.com set).
  • SPF (TXT): Usually v=spf1 include:_spf.google.com ~all.
  • DKIM (TXT): Located at a subdomain like google._domainkey.
  • DMARC (TXT): Located at _dmarc.
  • Domain Verification (TXT): google-site-verification=....

3. Migrate DNS Before Canceling Hosting

If you need to move nameservers back to your registrar:

  1. Recreate all MX and TXT records at the new DNS provider first.
  2. Double-check them for typos (watch out for trailing dots or doubled domain names like google._domainkey.yourdomain.com.yourdomain.com).
  3. Switch the nameservers at the registrar.
  4. Wait 24–48 hours and verify with dig MX yourdomain.com and a test email from an external account.

4. Only Delete the A / CNAME Records You Don't Need

Once DNS is safely hosted where you want it, shutting down the website is as simple as removing the A record pointing to the old VPS IP (or pointing it to a new static host). Your MX and TXT records remain untouched, and email never misses a beat.

Boring Infrastructure Wins

Self-hosting teaches you how the web actually works—from reverse proxies to TLS renewals to DNS propagation. Just remember the golden rule of solo ops: separate your DNS authority from your compute, back up your zone file before touching anything, and never let a canceled server take your inbox down with it.