58 lines
2.7 KiB
Markdown
58 lines
2.7 KiB
Markdown
# LuPhoto
|
|
|
|
LuPhoto serves photos.luciochen.com. It is one Go program that reads album folders, cuts every photo into 512 px tiles at several resolutions with libvips, and publishes a static site that the browser stitches back together on a canvas. See [docs/DESIGN.md](docs/DESIGN.md).
|
|
|
|
Status: milestone M1, the processor CLI. `luphoto build` scans the albums, builds tile pyramids, writes manifests and switches the `current` build. `serve` and `export` run one build and exit until M6.
|
|
|
|
## Develop
|
|
|
|
All builds and runs happen in Docker (Ubuntu 24.04 with Go and libvips-tools); the Windows host has no libvips. From Git Bash or any POSIX shell:
|
|
|
|
```sh
|
|
scripts/dev.sh go build -o bin/luphoto ./cmd/luphoto
|
|
scripts/dev.sh go vet ./...
|
|
scripts/dev.sh
|
|
```
|
|
|
|
The image has no make; the `Makefile` is for hosts that have Go and make. The first call builds the `luphoto-dev` image. The repository is mounted at `/src`; Go module and build caches live in the `luphoto-gomod` and `luphoto-gocache` volumes. Extra `docker run` arguments, such as a mount for sample albums, go in `LUPHOTO_DEV_ARGS`:
|
|
|
|
```sh
|
|
LUPHOTO_DEV_ARGS="-v /path/to/work:/work" scripts/dev.sh bin/luphoto -config /work/config.toml build
|
|
```
|
|
|
|
`LUPHOTO_DEV_REBUILD=1` rebuilds the image.
|
|
|
|
## Run
|
|
|
|
```sh
|
|
luphoto [-config /etc/luphoto/config.toml] build
|
|
```
|
|
|
|
A missing config file means all defaults. Paths default to `/srv/luphoto/albums`, `/var/lib/luphoto/site` and `/var/cache/luphoto` when running as root or under systemd, otherwise to the XDG data and cache folders. The site key and per-photo records live in `state/` next to the output folder.
|
|
|
|
Output layout:
|
|
|
|
```
|
|
site/
|
|
current -> builds/<id>
|
|
builds/<id>/index.html, index.<id>.json, a/<slug>/index.html, a/<slug>/manifest.<id>.json, t -> ../../t
|
|
t/<photo-hash>/<tile-id>.webp
|
|
og/<hash>.jpg
|
|
state/
|
|
site.key
|
|
pyramids/<photo-hash>.json
|
|
```
|
|
|
|
## Front-end
|
|
|
|
TypeScript and CSS live in `web/src`; the minified bundles in `internal/site/static` are committed, so `go build` never needs Node. After changing the front-end, rebuild on the host with Node 22:
|
|
|
|
```sh
|
|
npm --prefix web ci
|
|
npm --prefix web run build
|
|
```
|
|
|
|
`build` type-checks with `tsc --noEmit` (strict) and bundles `app.js`, `app.css`, `worker.js`, the favicon, the chop and the self-hosted woff2 fonts (latin and latin-ext of Bricolage Grotesque, IBM Plex Sans and IBM Plex Mono, from the `@fontsource` packages) with esbuild. Each site build copies them to `/assets/` under content-hashed names.
|
|
|
|
Brand files come from the Lucio brand repository. `scripts/sync-brand.sh` copies the tokens, `lucio-morph.js`, the favicon and the chop from `../LUCIO_ip` (or `$LUCIO_IP_DIR`) into `web/brand/`, stripping comments; the copies are committed.
|