Give vaultwarden and searxng random host ports

Both pinned an arbitrary host port — vaultwarden 8201:80, searxng 8083:8080 —
which was the only thing blocking them from being instanced. Neither number is
meaningful the way pihole's 53 or stalwart's 25 are, so both become
random:<internal> and portAllocate assigns each install (and each future
instance) its own. The ports appeared nowhere else: no hook, no compose, no
docs. Neither app is installed on the maintainer's box, so nothing to migrate.

Both now clear every instance guard. Of the eight apps the port guard caught,
that leaves six, all genuinely one-per-host.

Also made compose rewrite rules 2 and 3 skip commented lines, for the same
reason rule 1 already does. Spotted while verifying the above: vaultwarden
parks an optional exporter behind #, and rule 2 rewrote the container_name
inside that dead block while the service key above it kept the old name,
leaving it internally inconsistent. Harmless — rule 2 is anchored on
container_name: so it could never reach the image line — but there is no reason
to touch a commented block at all. Bookstack's rewritten identities remain
byte-identical to the running instance.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
librelad 2026-08-19 18:25:50 +01:00
parent ef02b48966
commit 39dad00455
3 changed files with 8 additions and 5 deletions

View File

@ -67,4 +67,4 @@ CFG_SEARXNG_NETWORK=default
# - webui: if true, this port serves the main web interface
# - description: human-readable description of the service
#
CFG_SEARXNG_PORT_1="searxng-service|webui|8083:8080|public|tcp|false|true|true|Search Interface||search"
CFG_SEARXNG_PORT_1="searxng-service|webui|random:8080|public|tcp|false|true|true|Search Interface||search"

View File

@ -71,5 +71,5 @@ CFG_VAULTWARDEN_NETWORK=default
# - webui: if true, this port serves the main web interface
# - description: human-readable description of the service
#
CFG_VAULTWARDEN_PORT_1="vaultwarden-service|webui|8201:80|public|tcp|false|true|true|Password Manager Interface||vault"
CFG_VAULTWARDEN_PORT_1="vaultwarden-service|webui|random:80|public|tcp|false|true|true|Password Manager Interface||vault"
CFG_VAULTWARDEN_PORT_2="vaultwarden-exporter|metrics|3001:3001|disabled|tcp|false|false|false|Metrics Exporter (sidecar, docker-network only)|"

View File

@ -279,10 +279,13 @@ _instanceRewriteCompose() {
sed -i "s|${ph}|${news[$i]}|g" "$f"
done
# 2. The standalone app container (container_name: <type>) — anchored so the
# image: line ending in <type> is never touched.
sed -i -E "s/(container_name:[[:space:]]*)${type}\b/\1${slug}/g" "$f"
# image: line ending in <type> is never touched. Commented lines are skipped
# for the same reason rule 1 skips them: a parked sidecar
# (# container_name: vaultwarden-exporter) is dead code, and half-renaming
# it just leaves the block internally inconsistent.
sed -i -E "/^[[:space:]]*#/! s/(container_name:[[:space:]]*)${type}\b/\1${slug}/g" "$f"
# 3. The files-backup label's container ref (libreportal.backup.files: "<type>:/...").
sed -i -E "s/(libreportal\.backup\.files:[[:space:]]*\")${type}\b/\1${slug}/g" "$f"
sed -i -E "/^[[:space:]]*#/! s/(libreportal\.backup\.files:[[:space:]]*\")${type}\b/\1${slug}/g" "$f"
# 4. The per-app tag namespace. tagsProcessorAppConfigValues derives tag names
# mechanically from the config keys (CFG_<APP>_APP_KEY_1 -> the tag
# <APP>_APP_KEY_1_TAG), so a clone still carrying the TYPE's tag names has