diff options
| author | salmonik <salmonik@tuta.io> | 2026-10-30 00:40:10 +0100 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-10-30 00:40:10 +0100 |
| commit | 79588a8bba1648ea4d396a1d1e9884af54e497e2 (patch) | |
| tree | bcc795839e1b848bb8e4c5ba017aaef6e9399ecb /web/README.md | |
| parent | add publish script that names release artifacts from Cargo.toml and the targe... (diff) | |
| download | zagan-bet-79588a8bba1648ea4d396a1d1e9884af54e497e2.tar.gz zagan-bet-79588a8bba1648ea4d396a1d1e9884af54e497e2.zip | |
add deploy script with live verification; cache file hashes by size and mtime
Diffstat (limited to '')
| -rw-r--r-- | web/README.md | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/web/README.md b/web/README.md index 5de180d..a82c492 100644 --- a/web/README.md +++ b/web/README.md | |||
| @@ -58,10 +58,34 @@ php -S 127.0.0.1:8899 -t web | |||
| 58 | 58 | ||
| 59 | Then open <http://127.0.0.1:8899/>. | 59 | Then open <http://127.0.0.1:8899/>. |
| 60 | 60 | ||
| 61 | ## Deploying | ||
| 62 | |||
| 63 | ```sh | ||
| 64 | ./scripts/publish.sh | ||
| 65 | ./scripts/deploy.sh user@host:/srv/zagan.bet https://zagan.bet/ | ||
| 66 | ``` | ||
| 67 | |||
| 68 | `deploy.sh` rsyncs `web/` with `--delay-updates`, so a visitor never sees a | ||
| 69 | half-written binary, then fetches the live page and every artifact it lists and | ||
| 70 | compares the downloaded bytes with the local SHA-256. `--verify-only` skips the | ||
| 71 | upload and only checks the live site. Old versions are left on the server; | ||
| 72 | prune them by hand. | ||
| 73 | |||
| 74 | A local directory works as a target, which is how the verification itself is | ||
| 75 | tested: | ||
| 76 | |||
| 77 | ```sh | ||
| 78 | php -S 127.0.0.1:8899 -t /srv/staging | ||
| 79 | ./scripts/deploy.sh /srv/staging http://127.0.0.1:8899/ | ||
| 80 | ``` | ||
| 81 | |||
| 61 | ## Notes | 82 | ## Notes |
| 62 | 83 | ||
| 63 | - Hashes are computed per request with `hash_file()`. That is fine for a | 84 | - Hashes are cached in a JSON file keyed on size and mtime, so a file is only |
| 64 | handful of builds; add an mtime-keyed cache if the directory grows. | 85 | read once until it changes. The cache lives in the system temp directory by |
| 86 | default because the web root is often not writable by the PHP user; set | ||
| 87 | `ZAGAN_HASH_CACHE` to put it elsewhere. If the cache cannot be written, the | ||
| 88 | page simply hashes every request. | ||
| 65 | - The page lists every build it finds, newest version first, so old releases | 89 | - The page lists every build it finds, newest version first, so old releases |
| 66 | stay downloadable until you remove them from `bin/`. | 90 | stay downloadable until you remove them from `bin/`. |
| 67 | - The checksum block is in `sha256sum` format, so visitors can save it as | 91 | - The checksum block is in `sha256sum` format, so visitors can save it as |
