The Three Gaps in a Self-Hosted Deploy
I recently moved my blog onto a small VPS I already run other things on. The plan was simple: a Ghost container, a database next to it, a domain pointing at it. The self-hosted PaaS on the box reported "deployment done" within a couple of minutes.
The site was not up. And even once it was, "the container is running" turned out to be the least interesting part of the deploy. The parts that mattered were the gaps around it — three of them, and none show up on a green status badge.
Gap 1: the network you didn't know you lost
The stack was two services in one Compose file: the app and its MySQL database. In plain Docker Compose, that just works — both services join a default network, and the app reaches the database by its service name, db.
On the platform, the app crash-looped with an error shaped like this:
DatabaseError: Invalid database host.
getaddrinfo EAI_AGAIN dbA DNS lookup failure for a sibling service in the same file. The cause: to route public traffic to the app, the platform attaches it to its own shared proxy network. And when a service doesn't declare any networks, attaching one replaces the implicit default instead of adding to it. The app was now on the proxy network and nothing else. The database was still on the default network. They could no longer see each other.
The fix is to stop relying on the implicit default and say what you mean:
services:
app:
image: ghost:6-alpine
networks:
- default
- proxy-network
db:
image: mysql:8.0
networks:
proxy-network:
external: trueThe lesson generalises beyond this one platform: anything that rewrites your Compose file before running it can change the meaning of what you left implicit. If a service needs to talk to a sibling and also be reachable from a proxy, list both networks explicitly. And "deployment done" from a platform means the containers were scheduled — not that the app inside them is healthy. Check the app's own logs before you believe it.
A side note on the database: I already had a shared PostgreSQL instance and hoped to reuse it. Ghost doesn't support PostgreSQL — only MySQL 8 in production (SQLite is for development). So the stack carries its own MySQL. Check what your app actually supports before you plan around shared infrastructure.
Gap 2: the setup window
Many self-hosted apps — blogs, wikis, dashboards, admin panels — create their first administrator through a web setup page. Until someone completes it, the install is unclaimed. And once the domain resolves, that page is on the public internet.
That's a race, and you don't control the other side of it. Scanners look for exactly these fresh-install pages. Whoever finishes setup first owns the site.
The fix is to treat claiming ownership as part of the deploy, not a step you get to later:
- Deploy.
- Poll the app's setup-status endpoint until it answers.
- Immediately create the owner account through the setup API, with a generated password.
- Only then consider the deploy finished.
I scripted all four steps, so the gap between "reachable" and "claimed" was a few seconds instead of "whenever I next open the browser". If your app supports seeding an admin through configuration instead of a web form, that's even better — the window never opens at all. The script also checks whether setup is already done, so re-running it is safe.
Gap 3: two domains, one site
I wanted the blog reachable on two domains. Ghost — like most CMSs — supports exactly one canonical URL. Every generated link, the RSS feed, the sitemap and the admin login are built from it.
Serving the same site on two hostnames causes quiet damage: duplicate content in search results, login cookies set for one host but not the other, and links that bounce readers between domains. So the decision isn't "which domains does the site answer on", it's "which domain is real, and what happens to the others".
I picked one canonical domain and made every other hostname — the second domain, and the www variants of both — return a 301 redirect to it, keeping the path and query string. I did the redirects at the CDN edge rather than in the app or the reverse proxy:
- Redirected traffic never reaches the server.
- The app config stays simple — it only knows its one URL.
- It keeps working even if the origin is down or being redeployed.
One more thing was hiding behind the second domain: an old, idle app on the same platform still claimed it. Reverse proxies route on hostnames, and two apps can't both own one. Before pointing a domain at something new, find out what currently answers for it. I detached the domain from the old app but kept the app itself, so rolling back is a single change.
Trade-offs
- Edge redirects tie you to your CDN. Move DNS providers and you have to rebuild them. Redirects in the reverse proxy are more portable, but every redirected request still hits your server.
- Explicit networks are more config to maintain, and depend on the platform's network name staying the same. It's still better than behaviour that depends on an implicit default you can't see.
- A scripted setup step means a generated password exists somewhere. Decide in advance where it lives, and make sure it isn't only in a terminal's scrollback.
- I deliberately left email unconfigured for now, and turned off the app's new-device email check so I could still log in. It's a conscious trade: password resets and member signups won't work until mail is set up.
Takeaway
A self-hosted app isn't deployed when the container is green. It's deployed when you've closed the gaps around it: which network it actually landed on, who can claim it first, and which domain is the real one. Script the first two, decide the third up front, and verify each from the outside rather than trusting a status page.