# tops — `koopa-tops-ng1` … `ng3`

| Item | Value |
|------|--------|
| Live | `/home/hernani/koopa-tops/` |
| Containers | `koopa-tops-ng1`, `koopa-tops-ng2`, `koopa-tops-ng3` |
| Image | `docker.io/nginxinc/nginx-unprivileged:1.27-alpine` (non-root, container port **8080**) |
| Compose | `compose.yml` (this dir) |
| Secrets | none |

Site HTML is **not** in this repo (container wiring only).

## Containers

| Container | Host port | Caddy host |
|-----------|-----------|------------|
| `koopa-tops-ng1` | **9090** | `tops.ng1.hacktivism.ch` |
| `koopa-tops-ng2` | **9091** | `tops.ng2.hacktivism.ch` |
| `koopa-tops-ng3` | **9092** | `tops.ng3.hacktivism.ch` |

Caddy snippet: `Caddyfile.snippet`.


## nginx

Mirror: `nginx-default.conf` → mounted as `/etc/nginx/conf.d/default.conf` in each container.

### Cache (always fresh)

Preview sites must not be cached by browsers/proxies:

- `Cache-Control: no-store, no-cache, must-revalidate, max-age=0, private`
- `Pragma: no-cache` / `Expires: 0`
- `etag off` · `if_modified_since off` · `expires -1`

After editing the conf on the host (bind mount), reload nginx **inside** the container (do not stop the container):

```bash
for c in koopa-tops-ng1 koopa-tops-ng2 koopa-tops-ng3; do
  podman exec "$c" nginx -t && podman exec "$c" nginx -s reload
done
```

## Autostart

User unit `container-koopa-tops.service` (mirror in this dir) starts all three via compose.

```bash
# as hernani on koopa
mkdir -p ~/.config/systemd/user
cp ~/koopa-tops/deploy/container-koopa-tops.service ~/.config/systemd/user/
systemctl --user daemon-reload
systemctl --user enable --now container-koopa-tops.service
```

Needs linger so the unit runs without an interactive login:

```bash
# once as root, if needed
loginctl enable-linger hernani
loginctl show-user hernani -p Linger
```

Check:

```bash
systemctl --user status container-koopa-tops.service
podman ps --filter name=koopa-tops
```

## Related

`configs/ports.md` · `host/overview/LIVE.md`
