44 lines
1.8 KiB
Markdown
44 lines
1.8 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
|
|
state/
|
|
site.key
|
|
pyramids/<photo-hash>.json
|
|
```
|