showcase
- v0.2.4
- 37 commits
- 1 branch
- 6 tags
- updated
- CI 2/2
README.md
3.5 KB · 85 lines
1# Deploying showcase23Three stages. Each one works on its own.451. **code.danieldaum.net**: the container on the server, behind your6 reverse proxy. Gitea is still public at git.danieldaum.net.72. **Gitea on the tailnet**: only `gitea_url` changes.83. **danieldaum.net/projects**: saturn's Pages Function serves showcase's9 pages. Clone, `go get` and `docker pull` stay on code.danieldaum.net.1011## Release an image1213Tagging, building, pushing and pinning a version are in the main14[README](../README.md#release-a-version).1516## 1. code.danieldaum.net1718On the server, in a folder holding `compose.yaml` and `config.json` from19here:2021```sh22docker compose up -d23docker compose logs -f # the first build mirrors every repo24curl -s 127.0.0.1:8080/healthz # "ok" once the first build is live (503 until then)25```2627- Point your reverse proxy for `code.danieldaum.net` at `127.0.0.1:8080`28 (plain HTTP; the proxy does TLS).29- Optional: put the proxy's address in `trusted_proxies`, so logs show30 visitors' IPs. Behind Cloudflare, `CF-Connecting-IP` is used.31- Gitea must allow anonymous reads (`REQUIRE_SIGNIN_VIEW = false`, HTTP git32 on), or the site is empty and clones fail.33- `images: ["showcase"]` lists the image on the packages page and lets34 `docker pull code.danieldaum.net/daniel/showcase:0.1.0` through.3536Saturn: apply `saturn/saturn.patch` (`git apply` in the saturn repo). It:3738- shares the palette with code.danieldaum.net through a `theme` cookie39 (`theme.js`), so both sites show the same one;40- adds `social/functions/projects/`, which redirects `/projects/…` to41 code.danieldaum.net (so `/projects/saturn/` lands on the saturn repo);42- takes `/projects/` out of likes and comments (`isLikeable`). The email43 worker uses it too, so run `mise run social-email` after deploying.4445The old pages in saturn's `projects/` are never served after this. Delete46them when you like.4748## 2. Gitea on the tailnet4950Set `gitea_url` to the tailnet address (for example51`https://code.aardvark-halibut.ts.net`) and restart the container. Mirrors52follow the new address on the next build. Nothing else changes: Gitea's53address never reaches a page.5455The container has to reach that address, and `*.ts.net` names often don't56resolve inside Docker. In order of preference:5758- Gitea on the same host: put both on one Docker network and use59 `http://gitea:3000`. No tailnet hop.60- A Tailscale sidecar container, sharing its network61 (`network_mode: service:tailscale`).62- The Gitea machine's 100.x tailnet IP. Only plain HTTP works this way,63 since the HTTPS certificate is for the name.6465Check from the server:66`docker compose exec showcase wget -qO- <gitea_url>/api/v1/version`.6768Once Gitea is internal, the server pulls the image from the tailnet name69(`code.aardvark-halibut.ts.net/daniel/showcase`), or from showcase itself70(`code.danieldaum.net/daniel/showcase`).7172## 3. danieldaum.net/projects73741. In `config.json`, add `"base_path": "/projects"` and restart. Pages75 move to `code.danieldaum.net/projects/…`, and old addresses redirect76 there. Clone, `go get`, `docker pull` and `/healthz` stay at the root.772. In saturn's `social/functions/projects/[[path]].js`, set78 `MODE = "proxy"` and deploy. danieldaum.net/projects now serves79 showcase.8081Check: `curl -sI https://danieldaum.net/projects/` (200, showcase's82`Content-Security-Policy`), and `git clone https://code.danieldaum.net/<repo>.git`.8384Each page view is a Functions request (100k a day on the free plan).85Waiting on code.danieldaum.net doesn't count toward the CPU limit.