8000 fix(docker): stacks stop on TERM, dev and prod images kept apart, shared ARCHIVE_SECRET_KEY, Mailpit for arm64 by adeelahmad · Pull Request #15 · adeelahmad/lense · GitHub
[go: up one dir, main page]

Skip to content

fix(docker): stacks stop on TERM, dev and prod images kept apart, shared ARCHIVE_SECRET_KEY, Mailpit for arm64 - #15

Merged
adeelahmad merged 2 commits into
mainfrom
claude/project-thread-706h8k
Oct 2, 2026
Merged

adeelahmad merged 2 commits into
mainfrom
claude/project-thread-706h8k

Conversation

@adeelahmad
@adeelahmad adeelahmad commented Oct 2, 2026 •
Copy link
Copy Markdown
Owner

Requested by Adeel · project thread

Description

This is the single Docker PR. It now also carries the Docker fixes from the OAuth branch (8728b24), and that branch will drop them.

  • Prod images get their own names: docker-compose.prod.yml builds lens-backend and lens-frontend, tagged ${LENS_VERSION:-prod}. Before, they used the project's default image names, which the dev stack also uses.
  • start.sh (API and web app): the script traps TERM and INT and stops both of its children. In Docker it also exits when either child dies (wait -n). Outside Docker it still waits for both, because macOS ships bash 3.2, which has no wait -n.
  • lens worker and lens watch stop on TERM the same way they stop on Ctrl-C.
  • The dev stack reads the root .env as an optional env_file, ahead of fastapi_backend/.env, so it gets ARCHIVE_SECRET_KEY.
  • Mailpit replaces MailHog. MailHog has no arm64 image.
  • The dev venv and node_modules are anonymous volumes that make dev renews.
  • make finds either docker compose or the standalone docker-compose.
  • Next: agentRules: false, and caniuse-lite is updated.
  • DEVLOG.md and CHANGELOG.md describe all of the above.

Motivation and Context

Before:

  • After make run, a plain docker compose up ran the production web app image, which crashed with "Could not find a production build".
  • A dev server that crashed left its container showing "Up".
  • docker stop waited 10 s and then killed the containers (exit 137).
  • The dev stack never got ARCHIVE_SECRET_KEY, so Docker and native runs couldn't read each other's stored credentials.
  • The stack didn't start on Apple Silicon.

After:

  • Dev and prod keep separate images.
  • A crashed server stops its container.
  • The dev containers stop in under a second with exit 0.
  • Docker and native runs share one credentials key.
  • Mailpit runs on arm64.

Upgrading: credentials that a dev stack stored earlier were encrypted with the volume's data_dir/secret.key. Either enter them again, or set ARCHIVE_SECRET_KEY in .env to that file's contents (see CHANGELOG).

Steps to reproduce (if appropriate):

Each of these was checked on the running dev stack:

  • docker compose stop backend frontend worker took 0.9 s, and all three exited with 0.
  • Killing fastapi dev or next dev made its container exit.
  • lens worker stops on TERM: tests/domain/test_cli.py passes, and ruff is clean.
  • Next resolves to 16.3.6 after --renew-anon-volumes.

Setup, login and 21 pages were walked in Chromium on both stacks with no API errors.

Not tested: this sandbox's network policy blocked the Debian mirrors, so the backend was built without its apt packages (ffmpeg, tesseract, LibreOffice), on the lean target. Processing jobs were not run.

docker-compose.prod.yml is also changed by #19. Whichever of the two merges second needs to keep both changes.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires documentation updates.
  • I have updated the documentation accordingly.
  • My change requires dependencies updates.
  • I have updated the dependencies accordingly.

🤖 Generated with Claude Code

https://claude.ai/code/session_01SHm6xEw9BLv1pzGRAQduWD

…r dies, pass ARCHIVE_SECRET_KEY to the dev stack

- docker-compose.prod.yml builds lens-backend:prod and lens-frontend:prod, so make run no longer
  overwrites the dev images that a plain docker compose up then runs
- start.sh (API and web app) exits in Docker when the dev server or its watcher stops
- the dev stack reads the root .env, so it uses the same ARCHIVE_SECRET_KEY as native runs
- DEVLOG.md: what the stack check found

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SHm6xEw9BLv1pzGRAQduWD
@adeelahmad adeelahmad self-assigned this Oct 2, 2026
…prod images

Folds the Docker fixes first made on the OAuth branch (8728b24) into this change, so there is one
Docker PR: make finds docker compose or docker-compose; Mailpit replaces MailHog (arm64); the dev
venv and node_modules are anonymous volumes make dev renews; start.sh traps TERM/INT and stops its
children, and in Docker still exits when either child dies; lens worker and lens watch stop on TERM;
Next's agentRules off; caniuse-lite current.

Also: production images are tagged ${LENS_VERSION:-prod}; CHANGELOG says how to keep credentials a
dev stack sealed with data_dir/secret.key now that ARCHIVE_SECRET_KEY comes from the root .env.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SHm6xEw9BLv1pzGRAQduWD
@adeelahmad adeelahmad changed the title Docker: keep dev and prod images apart, stop crashed dev containers, share ARCHIVE_SECRET_KEY Docker: stacks that stop when told, keep dev and prod images apart, share ARCHIVE_SECRET_KEY, run on arm64 Oct 2, 2026
@adeelahmad adeelahmad changed the title Docker: stacks that stop when told, keep dev and prod images apart, share ARCHIVE_SECRET_KEY, run on arm64 fix(docker): stacks stop on TERM, dev and prod images kept apart, shared ARCHIVE_SECRET_KEY, Mailpit for arm64 Oct 2, 2026
@adeelahmad
adeelahmad marked this pull request as ready for review October 2, 2026 13:12
@adeelahmad
adeelahmad merged commit 7119c8f into main Oct 2, 2026
0 of 8 checks passed
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.

2 participants

0