55 lines
1.9 KiB
Markdown
55 lines
1.9 KiB
Markdown
# Deploying Deadhead
|
|
|
|
The game runs and saves on each player's device (CR-014), so deploying it means
|
|
serving static files. One Caddy container serves the web build over plain HTTP;
|
|
Nginx Proxy Manager (NPM) in front of it handles the domain and HTTPS. There is
|
|
no server, database or backup to run; players keep their own saves (Settings →
|
|
Export save).
|
|
|
|
## Before the first start
|
|
|
|
1. **Docker:** Docker Engine with the Compose plugin (`docker compose version`).
|
|
2. **Settings:** in this folder, `cp .env.example .env` and set `HTTP_PORT` (the
|
|
port on this machine that serves the game; default 8080).
|
|
3. **NPM:** add a Proxy Host:
|
|
- Domain: `deadhead.belowland.com`
|
|
- Scheme `http`, forward hostname = this machine's IP, forward port = `HTTP_PORT`
|
|
- SSL: request a Let's Encrypt certificate and turn on Force SSL
|
|
|
|
DNS and port forwarding (80 and 443 to the NPM machine) are NPM's, as for
|
|
any other site it serves.
|
|
|
|
## Start and update
|
|
|
|
From this folder, on the machine:
|
|
|
|
```sh
|
|
git pull
|
|
APP_BUILD=$(git rev-parse --short HEAD) docker compose --env-file .env 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).
|
|
|
|
## Without NPM
|
|
|
|
The site also works on its own over plain HTTP at `http://<this machine>:<HTTP_PORT>`.
|
|
Installing the app to a phone home screen needs HTTPS, so that 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, caching and compression, then removes
|
|
it. It never touches the real site.
|