Skip to content

AFFiNE, Immich, Kaneo, Karakeep, KitchenOwl and 4 more: keep TS_AUTHKEY out of the containers that load .env - #435

Merged
crypt0rr merged 3 commits into
mainfrom
env-file-keep-authkey-in-sidecar
Nov 23, 2026
Merged

crypt0rr merged 3 commits into
mainfrom
env-file-keep-authkey-in-sidecar

Conversation

@jackspiering

@jackspiering jackspiering commented Nov 22, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Nine stacks load the whole .env file into their containers with env_file. As a result, 17 containers besides the sidecar receive TS_AUTHKEY, which only the tailscale container needs. The READMEs already list this as a deviation.

This PR sets TS_AUTHKEY to an empty value in the environment of each of those containers. environment takes precedence over env_file, so every other variable still reaches the containers. Several READMEs tell users to add settings to .env, for example DISABLE_SIGNUPS for Karakeep and the OIDC values for KitchenOwl. Replacing env_file with an explicit list would have dropped such settings without warning.

Stack Containers
AFFiNE application, affine_migration
Immich application, immich-machine-learning
Kaneo application, postgres
Karakeep web, meilisearch
KitchenOwl kitchenowl
LubeLogger application
NetBox netbox (and netbox-worker through the YAML anchor), postgres, redis, redis-cache
Pocket ID application
Tandoor Recipes application

Also:

  • Each README's "reads the whole .env file" deviation now says that TS_AUTHKEY is the exception.
  • CONTRIBUTING.md gets a rule for new stacks: pass variables under environment and avoid env_file: .env. A stack that keeps env_file sets TS_AUTHKEY= and lists the deviation.
  • Cozy's extra tailscale-* sidecars are left alone. They are Tailscale containers and need the key.

Related Issues

  • None. Found in a review of the Compose settings of all services.

Verification

  • docker compose config --quiet from each of the 9 changed service directories, with dummy values for required variables.
  • Rendered each stack before and after this change, with a dummy TS_AUTHKEY in a scratch copy of .env, and compared the full Compose models. They are identical except that TS_AUTHKEY is now empty in the 17 containers above. The tailscale container keeps the key.
  • The stack started, Tailscale is healthy, and the service is reachable through the Tailnet: tested with Pocket ID from a scratch copy. The application became healthy. Inside it, TS_AUTHKEY is empty, and other .env values such as TRUST_PROXY are still set. The sidecar still has the key and joined the Tailnet. /.well-known/openid-configuration returned HTTP 200 through Tailscale Serve. The other 8 stacks were not started. Their change is the same environment override, which the rendered models confirm.
  • The main function of the service works, and its data survives a restart: not applicable. The change does not touch data or application settings.
  • rumdl check --config .markdownlint.yml . (0.3.0) and git diff --check origin/main pass.

Impact on existing users

  • None. Only the sidecar uses TS_AUTHKEY. The other containers lose a variable that they never read.

Checklist

  • I have performed a self-review of my code and followed the templates structure.
  • I did not commit a working auth key, password, token, or other credential.
  • The service README uses the headings of the template, in the same order, and is up to date.
  • I added, removed, or renamed the service in the root README.md, in alphabetical order, or this PR does not change the list of services.

Additional Context

…EY out of the containers that load .env

Nine stacks load the whole .env file into their containers with env_file,
so 17 containers besides the sidecar receive the Tailscale auth key.
Set TS_AUTHKEY to an empty value in the environment of each of them.
environment takes precedence over env_file, so every other variable that
users put in .env still reaches the containers.

Also covers LubeLogger, NetBox, Pocket ID, and Tandoor Recipes. Update the
"reads the whole .env file" deviation in each README, and add a rule for
new stacks to CONTRIBUTING.md.
@crypt0rr
crypt0rr merged commit 21ef94f into main Nov 23, 2026
2 checks passed
@crypt0rr
crypt0rr deleted the env-file-keep-authkey-in-sidecar branch November 23, 2026 14:59
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