3 min read
Building qspace.site on my own machine
A bilingual Next.js site, a docs library and a sign-in page — all in Docker Compose behind a Cloudflare Tunnel.
#qspace#docker#cloudflare
This site doesn't run on Vercel or on a VPS. It runs on my own machine, packaged with Docker Compose, and reaches the Internet through a Cloudflare Tunnel.
Three containers
- web — the Next.js site you're reading, in Vietnamese and English.
- docs — a library of HTML docs written in plain Python, which also hosts the sign-in page.
- tunnel — cloudflared, routing by host name and path.
Routing inside the tunnel
qspace.site/login and /admin go to the docs server, every other path on qspace.site goes to the website, and docs.qspace.site goes straight to the library. No extra reverse proxy: cloudflared matches paths with a regex on its own.
ingress:
- hostname: qspace.site
path: ^/(login|logout|admin)(/.*)?$
service: http://127.0.0.1:8787
- hostname: qspace.site
service: http://127.0.0.1:3000
Why self-host
The machine is on anyway, and I wanted to understand every layer: DNS, the tunnel, the containers, the sign-in cookie. One docker compose up -d brings it all back, after every reboot too.