Production
Server and Network
ClayDiary runs on one VPS at Contabo with Ubuntu. The server started empty, so everything it needs was installed by hand.
Server setup
- Installed software:
- Docker: the engine and the Compose plugin, to run the containers.
- Git: to keep the repository on the server up to date.
- Caddy: the web server in front of the application.
- Tailscale: private access to the database.
- Repository: cloned onto the server with a read-only deploy key, so the server can pull code but never push.
- Login: by SSH key only, no password.
- Application secrets: kept in an env file on the server.
Connections
| Connection | How | What for |
|---|---|---|
| Laptop → server | SSH, personal key | Administration and tunnels to private services |
| Server → GitHub repository | SSH, read-only deploy key | Pulling the repository files |
| GitHub Actions → server | SSH, key stored in GitHub secrets | Running the deploys |
| Server → container registry | HTTPS | Pulling the images |
| Laptop → database | Tailscale | Database access from pgAdmin |
Caddy
Caddy is the web server in front of the application. It runs on the server itself, not in a container.
- Domain: a free DuckDNS domain points at the server.
- HTTPS: Caddy obtains and renews the certificates automatically, and redirects HTTP to HTTPS.
- Routing: Caddy sends each request to a container by hostname.
- Application host: requests to
/apigo to the backend, and everything else goes to the frontend. - Grafana host: Grafana.
- Documentation host: the documentation site, with the root address redirecting to its documentation pages.
- Application host: requests to
Network exposure
- The Contabo firewall lets only SSH, HTTP and HTTPS in.
- Every container port is bound to localhost, so Caddy is the only way in from the internet.
- Caddy exposes three services: the application, Grafana (behind its login) and the documentation site.
- PostgreSQL and Prometheus are not exposed. The database is reached from a laptop through Tailscale.