Skip to content

fix: correct APP_NAME and persistent data paths for deployed apps - #143

Merged
ineedjet merged 2 commits into
mainfrom
fix-app-name-env
Aug 24, 2026
Merged

fix: correct APP_NAME and persistent data paths for deployed apps#143
ineedjet merged 2 commits into
mainfrom
fix-app-name-env

Conversation

@ineedjet

@ineedjet ineedjet commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

Two related bugs found while getting the first real deploy to heimdall working.

1. APP_NAME was never written anywhere. Every compose file references ${APP_NAME}, but nothing in deploy/deploy.py ever set it - vault manifests only carry an app's actual secrets, never its own name. Fixed by prepending APP_NAME={app} to each app's resolved .env in resolve_app_envs.

2. apps-data/${APP_NAME} relative paths resolved to the wrong place on a deployed host. docker compose runs from {base_path}/current/apps/{app}/, where current is a symlink into releases/{timestamp}/. ../../apps-data/${APP_NAME} (traefik) or ../apps-data/${APP_NAME} (every db template - postgres, redis, mysql, mongodb, clickhouse, timescale, paradedb) only escapes back to current/, not the true base path - so persistent data silently landed inside a specific release's own directory, not the persistent apps-data/ sibling of releases/. Confirmed on heimdall: traefik's acme.json ended up at ~/flightdeck/current/apps-data/acme.json (i.e. releases/{ts}/apps-data/acme.json) instead of the persistent ~/flightdeck/apps-data/traefik/acme.json - it would have been silently deleted on the next keep_releases rotation.

Fixed by never using a relative path for this: deploy_to_host now computes DATA_DIR={base_path}/apps-data/{app} per host (can't be baked into the release tree like APP_NAME, since base_path depends on that host's $HOME, resolved only after SSH-connecting, and a target's hosts: can list more than one) and appends it to each app's already-pushed .env on the host itself, before docker compose ever runs. Every compose file/template using apps-data now references ${DATA_DIR} directly.

Test plan

  • deploy/tests/ (48 tests, updated) pass
  • pre-commit (yamllint, pymarkdown, ruff) passes
  • docker compose config verified for every app in the catalog with APP_NAME/DATA_DIR set
  • Next deploy actually succeeds end-to-end on heimdall

ineedjet and others added 2 commits August 24, 2026 15:57
Every compose file (apps/common.yml's shared services, plus traefik's
own volume mount) references \${APP_NAME}, but nothing in the deploy
pipeline ever wrote it - vault manifests only carry an app's actual
secrets, never its own name. Docker Compose auto-loads .env from its
own working directory, so on the target host \${APP_NAME} silently
resolved to an empty string for every app.

This was invisible until the first real deploy (to heimdall): rybbit's
env_file: ./\${APP_NAME}/.env resolved to apps/.env (no such file,
hard failure), and traefik's ../../apps-data/\${APP_NAME}:/letsencrypt
silently mounted apps-data/ itself instead of apps-data/traefik/ -
wrong acme.json location, no error since the directory exists either
way. Both are fixed by prepending APP_NAME={app} to each app's
resolved .env on the runner, before it's pushed.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
apps-data/${APP_NAME} (and postgres-*.yml, redis-*.yml, and every other
template/app using it) assumed apps/{app}/docker-compose.yml sits two
directories under the base path - true locally (repo_root/apps/{app}/),
false on a deployed host (base_path/current/apps/{app}/, with current
a symlink into releases/{timestamp}/). ../.. from apps/{app}/ only
escapes back to current/, not base_path/, so every one of these mounts
landed inside that release's own directory - exactly the acme.json bug
just fixed for traefik, but latent in every app with a data volume.

Fixed by never using a relative path for this at all: deploy_to_host
now appends DATA_DIR={base_path}/apps-data/{app} to each app's .env on
the host itself (computed per-host, since base_path depends on that
host's $HOME - unlike APP_NAME, this can't be baked into the release
tree, which is shared across every host a target deploys to). Every
compose file/template using apps-data now references ${DATA_DIR}
directly instead of ../../apps-data/${APP_NAME} or ../apps-data/${APP_NAME}.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@ineedjet ineedjet changed the title fix: write APP_NAME into each app's deployed .env fix: correct APP_NAME and persistent data paths for deployed apps Aug 24, 2026
@ineedjet
ineedjet merged commit 46b4050 into main Aug 24, 2026
5 checks passed
@ineedjet
ineedjet deleted the fix-app-name-env branch August 24, 2026 15:00
@ineedjet ineedjet mentioned this pull request Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant