feat(train): search for places in the route planner, through Photon (ADR 0030, D50)

A `search` endpoint asks the instance's Photon (compose.search.yaml, Europe's
database from GraphHopper, renewed monthly) for people signed in, limited and
unlogged. The planner gets a field over its map: the places found nearest the
map's centre first, in the app's language; one chosen is the next waypoint.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
Tizian 「ティツィアーン」 2026-10-29 16:20:36 +01:00
commit edd2df79bd
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64

View file

@ -21,6 +21,7 @@ site changes.
| LanguageTool, which checks spelling and grammar | `compose.languagetool.yaml` | none |
| Halkyon Train's server, with BRouter for its routes | `compose.train.yaml` | `train.caddy` |
| Train's own map tiles, beside Train | `compose.maps.yaml` | `train-maps.caddy` (in Train's site) |
| Photon, which finds places for Train's route planner, beside Train | `compose.search.yaml` | none |
Both together: `COMPOSE_FILE=compose.yaml:compose.jellyfin.yaml:compose.languagetool.yaml`.
@ -272,3 +273,43 @@ Steps, in order; ✱ marks a step as root.
new cut moved over the old one without a restart (else `docker compose restart
map-tiles` after each cut), and Caddy's `import` of an empty folder where the map is
off.
## Train's search
Photon beside Train (Halkyon Train's ADR 0030, D50; `compose.train.yaml` first), which
finds the places Train's route planner searches for, on GraphHopper's weekly database
of Europe (a 32.6 GB download on 29 Oct 2026, more unpacked, to be measured; Germany's
alone 7.5 GB, `PHOTON_REGION=europe/germany`). Only Train's server reaches it, for
people signed in; nothing searched is kept or logged. The database is renewed monthly:
downloaded and unpacked beside the one in use, checked against its MD5, then put in
its place, Photon away for a minute or two.
Steps, in order; ✱ marks a step as root.
1. **Room and memory** (the operator, on the instance's server): `df -h ~deploy` and
`free -h`. The database takes tens of GB, twice that while a new one comes; Photon
wants `PHOTON_HEAP` (6g by default) and room beside it (`PHOTON_MEMORY`, 8g).
2. ✱ **Photon's user and folder** (the operator, as a user with sudo): the user and
group ID 61179 are Photon's alone, as the compose file runs it.
```sh
sudo groupadd --system --gid 61179 photon
sudo useradd --system --uid 61179 --gid 61179 --no-create-home --shell /usr/sbin/nologin photon
sudo mkdir -p ~deploy/halkyon-learn/deploy/photon/data
sudo chown -R photon:photon ~deploy/halkyon-learn/deploy/photon/data
```
3. **Switch it on** (the operator, as `deploy`): in `deploy/.env`, `compose.search.yaml`
added to `COMPOSE_FILE` after Train's:
```sh
COMPOSE_FILE=compose.yaml:compose.languagetool.yaml:compose.train.yaml:compose.maps.yaml:compose.search.yaml
```
4. **Start it** (the operator, as `deploy`): `docker compose up -d --build`. Train's
server is recreated with it. The first database takes an hour or more
(`docker compose logs -f photon-data` says when it is ready); Photon starts on it
within the next hour, and until then Train's planner offers no search.
5. **Check it**: in Train, signed in, the planner's search finds a town of the region.
Not yet tried on the server (29 Oct 2026): the database's size unpacked, Photon's
memory on Europe's, and that 1.3.0 reads GraphHopper's `1.0` build.