deadhead-space-freight-tycoon/deploy/README.md

52 lines
1.8 KiB
Markdown

# Deploying Deadhead
The game runs and saves on each player's device (CR-014), so deploying it means
serving static files. One machine runs Caddy with Docker Compose: it serves the
web build and gets HTTPS certificates for the domain automatically. There is no
server, database or backup to run; players keep their own saves (Settings →
Export save).
## Before the first start
1. **DNS:** point an `A` record for `deadhead.belowland.com` at the public IP of
the network the machine is on.
2. **Router:** forward TCP ports 80 and 443 (and UDP 443 for HTTP/3) to the
machine. Let's Encrypt checks port 80 before it issues a certificate.
3. **Docker:** Docker Engine with the Compose plugin (`docker compose version`).
4. **Settings:** in this folder, `cp .env.example .env` and check
`SITE_ADDRESS`.
## Start and update
From this folder, on the machine:
```sh
git pull
APP_BUILD=$(git rev-parse --short HEAD) docker compose up -d --build
```
The About screen in Settings shows the build you deployed. Installed copies pick
up the new version the next time they open (the service worker checks the shell
on every load).
## On a LAN only (no domain)
Set `SITE_ADDRESS=:80` in `.env`. Caddy then serves plain HTTP. Installing the
app to a phone home screen needs HTTPS, so this is for testing.
## Any other static host
`pnpm --filter @deadhead/web build` writes the app to `apps/web/dist`. Any
static host works if it serves `index.html` for unknown paths (client-side
routes) and doesn't cache `index.html`, `sw.js` or `manifest.webmanifest`.
## Check a build before deploying
```sh
deploy/check.sh
```
This builds and starts the site under a separate project name on port 8088,
checks the app shell, client-side routes and caching, then removes it. It never
touches the real site.