diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4601b730..5267d5df 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -54,6 +54,11 @@ do not have to fix the rest of a stack that you touch. `app-${SERVICE}-` for extra containers, such as `app-${SERVICE}-db`. - Pass `PUID` and `PGID` only when the image reads them, such as LinuxServer.io images. Keep `TZ`, as the template does. + - Pass variables to a container under `environment`. Avoid `env_file: .env`: + it gives the container every variable in `.env`, including `TS_AUTHKEY`. + When a container must load `.env`, for example to follow the upstream + Compose file, add `TS_AUTHKEY=` to its `environment`, as for Immich, and + list the `env_file` under "Deviations from the standard setup". - Write the image tag explicitly and use the tag upstream recommends. Pin databases, caches, and search engines to a major or major.minor tag. When you pin an exact version, say why in a comment. diff --git a/services/affine/README.md b/services/affine/README.md index 1d2ba31b..9f206f64 100644 --- a/services/affine/README.md +++ b/services/affine/README.md @@ -29,7 +29,7 @@ Set these values in `.env`: - **Extra containers.** The stack runs `postgres`, `redis`, and `affine_migration`. The migration container prepares the database and then exits. All three use the default Compose network, and AFFiNE reaches them by their service name through Docker's DNS. Keep `TS_ACCEPT_DNS` disabled, because MagicDNS cannot resolve these names. - **Image version.** `AFFINE_REVISION` in `.env` selects the version of the AFFiNE image. - **Data folders.** The data is in `./affine-storage`, `./affine-config`, and `./postgres`, not in a `./affine-data` folder. -- **The containers read the whole `.env` file.** The `application` and `affine_migration` containers load `.env` through `env_file`. Every variable in that file, including `TS_AUTHKEY`, is therefore present in their environment. +- **The containers read the whole `.env` file.** The `application` and `affine_migration` containers load `.env` through `env_file`. Every variable in that file is therefore present in their environment, except `TS_AUTHKEY`. `compose.yaml` sets it to an empty value for them, because only the `tailscale` container uses the auth key. ## First run diff --git a/services/affine/compose.yaml b/services/affine/compose.yaml index 2c296b60..a2476e4b 100644 --- a/services/affine/compose.yaml +++ b/services/affine/compose.yaml @@ -70,6 +70,7 @@ services: - .env environment: # Variables are declared in .env file. + - TS_AUTHKEY= # Empty: env_file loads all of .env, but only the tailscale container needs the auth key - REDIS_SERVER_HOST=redis - DATABASE_URL=postgresql://${DB_USERNAME}:${DB_PASSWORD:?Set DB_PASSWORD in .env}@postgres:5432/${DB_DATABASE:-affine} - AFFINE_INDEXER_ENABLED=false @@ -95,6 +96,7 @@ services: - .env environment: # Variables are declared in .env file. + - TS_AUTHKEY= # Empty: env_file loads all of .env, but only the tailscale container needs the auth key - REDIS_SERVER_HOST=redis - DATABASE_URL=postgresql://${DB_USERNAME}:${DB_PASSWORD:?Set DB_PASSWORD in .env}@postgres:5432/${DB_DATABASE:-affine} - AFFINE_INDEXER_ENABLED=false diff --git a/services/immich/README.md b/services/immich/README.md index cff1343f..fe1fbda6 100644 --- a/services/immich/README.md +++ b/services/immich/README.md @@ -29,7 +29,7 @@ This stack runs Immich with a Tailscale sidecar, as described in [the standard s * **Extra containers.** Besides `application`, the stack runs `immich-machine-learning`, `redis` (Valkey), and `database` (Postgres). These three use the default Compose network and not the network of the `tailscale` container. Immich reaches them by their service name through Docker's DNS. * **Images are set in `compose.yaml`.** The stack does not use `IMAGE_URL`. `IMMICH_VERSION` in `.env` selects the version of the server and machine learning images. * **Keep `TS_ACCEPT_DNS` disabled.** The `application` service shares the DNS configuration of the `tailscale` service. With `TS_ACCEPT_DNS=true`, Tailscale replaces Docker's DNS with MagicDNS, which cannot resolve the `database`, `redis`, and `immich-machine-learning` services. Immich then fails to start with `getaddrinfo ENOTFOUND database`. You can reach Immich over your Tailnet without this setting. -* **The containers read the whole `.env` file.** As in the upstream Compose file, the Immich containers load `.env` through `env_file`. Every variable in that file, including `TS_AUTHKEY`, is therefore present in the environment of the `application` and `immich-machine-learning` containers. +* **The containers read the whole `.env` file.** As in the upstream Compose file, the Immich containers load `.env` through `env_file`. Every variable in that file is therefore present in the environment of the `application` and `immich-machine-learning` containers, except `TS_AUTHKEY`. `compose.yaml` sets it to an empty value for them, because only the `tailscale` container uses the auth key. ## First run diff --git a/services/immich/compose.yaml b/services/immich/compose.yaml index 443382ef..f0a8e063 100644 --- a/services/immich/compose.yaml +++ b/services/immich/compose.yaml @@ -62,6 +62,8 @@ services: - /etc/localtime:/etc/localtime:ro env_file: - .env + environment: + - TS_AUTHKEY= # Empty: env_file loads all of .env, but only the tailscale container needs the auth key depends_on: redis: condition: service_healthy @@ -85,6 +87,8 @@ services: - ./${SERVICE}-data/model-cache:/cache env_file: - .env + environment: + - TS_AUTHKEY= # Empty: env_file loads all of .env, but only the tailscale container needs the auth key # Healthcheck: defined by the image (python3 healthcheck.py), so this file does not override it. restart: always diff --git a/services/kaneo/README.md b/services/kaneo/README.md index d4850db7..51ee4df3 100644 --- a/services/kaneo/README.md +++ b/services/kaneo/README.md @@ -26,7 +26,7 @@ Set these values in `.env`: - **Extra container.** The stack runs a `postgres` container. It uses the network of the `tailscale` container as well, so Kaneo reaches it at `localhost`. PostgreSQL listens only on the loopback address of the device, so other devices on your Tailnet cannot reach it. - **Serve port from `.env`.** The Tailscale Serve configuration in `compose.yaml` takes its port from `SERVICEPORT`. - **Database image.** `IMAGE_URL_DATABASE` in `.env` selects the PostgreSQL image. -- **The containers read the whole `.env` file.** Both containers load `.env` through `env_file`. Every variable in that file, including `TS_AUTHKEY`, is therefore present in their environment. +- **The containers read the whole `.env` file.** Both containers load `.env` through `env_file`. Every variable in that file is therefore present in their environment, except `TS_AUTHKEY`. `compose.yaml` sets it to an empty value for them, because only the `tailscale` container uses the auth key. ## First run diff --git a/services/kaneo/compose.yaml b/services/kaneo/compose.yaml index d76df85c..143c6cfb 100644 --- a/services/kaneo/compose.yaml +++ b/services/kaneo/compose.yaml @@ -57,6 +57,7 @@ services: env_file: - .env environment: + TS_AUTHKEY: "" # Empty: env_file loads all of .env, but only the tailscale container needs the auth key POSTGRES_PASSWORD: ${DB_PASSWORD:?Set DB_PASSWORD in .env} POSTGRES_USER: ${DB_USERNAME} POSTGRES_DB: ${DB_DATABASE_NAME} @@ -78,6 +79,7 @@ services: env_file: - .env environment: + TS_AUTHKEY: "" # Empty: env_file loads all of .env, but only the tailscale container needs the auth key AUTH_SECRET: ${AUTH_SECRET:?Set AUTH_SECRET in .env} DATABASE_URL: "postgresql://${DB_USERNAME}:${DB_PASSWORD:?Set DB_PASSWORD in .env}@localhost:${SERVICEPORT_DATABASE}/${DB_DATABASE_NAME}" depends_on: diff --git a/services/karakeep/README.md b/services/karakeep/README.md index fd449b99..c399a737 100644 --- a/services/karakeep/README.md +++ b/services/karakeep/README.md @@ -28,7 +28,7 @@ Set these values in `.env`: - **Service name.** The application service is called `web`, not `application`, and its container is `app-karakeep-web`. - **Extra containers.** The stack runs `chrome`, a headless browser that fetches the pages, and `meilisearch` for the search. They use the default Compose network, and Karakeep reaches them by their service name through Docker's DNS. Keep `TS_ACCEPT_DNS` disabled, because MagicDNS cannot resolve these names. - **Images are set in `compose.yaml`.** The stack does not use `IMAGE_URL`. `KARAKEEP_VERSION` in `.env` selects the version of the Karakeep image. -- **The containers read the whole `.env` file.** The `web` and `meilisearch` containers load `.env` through `env_file`. Every variable in that file, including `TS_AUTHKEY`, is therefore present in their environment. +- **The containers read the whole `.env` file.** The `web` and `meilisearch` containers load `.env` through `env_file`. Every variable in that file is therefore present in their environment, except `TS_AUTHKEY`. `compose.yaml` sets it to an empty value for them, because only the `tailscale` container uses the auth key. ## First run diff --git a/services/karakeep/compose.yaml b/services/karakeep/compose.yaml index 149665e7..485fc673 100644 --- a/services/karakeep/compose.yaml +++ b/services/karakeep/compose.yaml @@ -55,6 +55,7 @@ services: env_file: - .env environment: + TS_AUTHKEY: "" # Empty: env_file loads all of .env, but only the tailscale container needs the auth key MEILI_ADDR: http://meilisearch:7700 NEXTAUTH_SECRET: ${NEXTAUTH_SECRET:?Set NEXTAUTH_SECRET in .env} MEILI_MASTER_KEY: ${MEILI_MASTER_KEY:?Set MEILI_MASTER_KEY in .env} @@ -107,6 +108,7 @@ services: env_file: - .env environment: + TS_AUTHKEY: "" # Empty: env_file loads all of .env, but only the tailscale container needs the auth key MEILI_NO_ANALYTICS: "true" MEILI_MASTER_KEY: ${MEILI_MASTER_KEY:?Set MEILI_MASTER_KEY in .env} volumes: diff --git a/services/kitchenowl/README.md b/services/kitchenowl/README.md index 7a310376..8813535a 100644 --- a/services/kitchenowl/README.md +++ b/services/kitchenowl/README.md @@ -20,7 +20,7 @@ Set `JWT_SECRET_KEY` in `.env` to a long random value, for example from `openssl ## Deviations from the standard setup - **Service name.** The application service is called `kitchenowl`, not `application`. -- **The container reads the whole `.env` file.** The `kitchenowl` container loads `.env` through `env_file`. Every variable in that file, including `TS_AUTHKEY`, is therefore present in its environment. +- **The container reads the whole `.env` file.** The `kitchenowl` container loads `.env` through `env_file`. Every variable in that file is therefore present in its environment, except `TS_AUTHKEY`. `compose.yaml` sets it to an empty value for it, because only the `tailscale` container uses the auth key. ## First run diff --git a/services/kitchenowl/compose.yaml b/services/kitchenowl/compose.yaml index da2a90b1..c21ea295 100644 --- a/services/kitchenowl/compose.yaml +++ b/services/kitchenowl/compose.yaml @@ -56,6 +56,7 @@ services: volumes: - ./${SERVICE}-data/:/data environment: + - TS_AUTHKEY= # Empty: env_file loads all of .env, but only the tailscale container needs the auth key - JWT_SECRET_KEY=${JWT_SECRET_KEY:?Set JWT_SECRET_KEY in .env} # JWT secret key for authentication - make sure to set this in the .env file ## Optional for OIDC support - make sure to set these in the .env file if required! #- FRONT_URL=${FRONT_URL} diff --git a/services/lube-logger/README.md b/services/lube-logger/README.md index 6bdf0e90..e5483d83 100644 --- a/services/lube-logger/README.md +++ b/services/lube-logger/README.md @@ -21,7 +21,7 @@ Set `LUBELOGGER_DOMAIN` in `.env` to the name of the device on your Tailnet, `lu ## Deviations from the standard setup - **Device name.** `SERVICE` in `.env` is `lubelogger`, which differs from the name of this directory. -- **The container reads the whole `.env` file.** The `application` container loads `.env` through `env_file`. Every variable in that file, including `TS_AUTHKEY`, is therefore present in its environment. +- **The container reads the whole `.env` file.** The `application` container loads `.env` through `env_file`. Every variable in that file is therefore present in its environment, except `TS_AUTHKEY`. `compose.yaml` sets it to an empty value for it, because only the `tailscale` container uses the auth key. - **Language settings.** `LC_ALL` and `LANG` in `.env` set the locale, which LubeLogger uses for dates and numbers. ## First run diff --git a/services/lube-logger/compose.yaml b/services/lube-logger/compose.yaml index 32e96c49..eb61a3ad 100644 --- a/services/lube-logger/compose.yaml +++ b/services/lube-logger/compose.yaml @@ -54,6 +54,8 @@ services: container_name: app-${SERVICE} # Name for local container management env_file: - .env + environment: + - TS_AUTHKEY= # Empty: env_file loads all of .env, but only the tailscale container needs the auth key volumes: - ./${SERVICE}-data/data:/App/data - ./${SERVICE}-data/keys:/root/.aspnet/DataProtection-Keys diff --git a/services/netbox/README.md b/services/netbox/README.md index 808a1174..3546a1ce 100644 --- a/services/netbox/README.md +++ b/services/netbox/README.md @@ -31,7 +31,7 @@ Set these values in `.env`. Compose stops with an error if one of them is empty. - **Service and container names.** The application service is called `netbox`, not `application`, and the containers are named `netbox`, `worker-netbox`, `netbox-postgres`, `netbox-redis`, and `netbox-rediscache`. - **Configuration files.** This directory contains the NetBox configuration files in `./config`, which the stack mounts read-only. The `tailscale` container stores its files in the same folder. - **Data folder.** The data is in `./netbox`, not in a `./netbox-data` folder. -- **The containers read the whole `.env` file.** All containers load `.env` through `env_file`. Every variable in that file, including `TS_AUTHKEY`, is therefore present in their environment. +- **The containers read the whole `.env` file.** All containers load `.env` through `env_file`. Every variable in that file is therefore present in their environment, except `TS_AUTHKEY`. `compose.yaml` sets it to an empty value for them, because only the `tailscale` container uses the auth key. - **No administrator at the first start.** `SKIP_SUPERUSER=true` in `.env` stops NetBox from creating a default administrator. ## First run diff --git a/services/netbox/compose.yaml b/services/netbox/compose.yaml index 5d81a2a7..7196fa43 100644 --- a/services/netbox/compose.yaml +++ b/services/netbox/compose.yaml @@ -50,6 +50,7 @@ services: network_mode: service:tailscale # Sidecar configuration to route the service through Tailscale container_name: ${SERVICE} # Name for local container management environment: + - TS_AUTHKEY= # Empty: env_file loads all of .env, but only the tailscale container needs the auth key - SECRET_KEY=${SECRET_KEY:?Set SECRET_KEY in .env} - TZ=${TZ} volumes: @@ -94,6 +95,8 @@ services: image: docker.io/postgres:17-alpine container_name: ${SERVICE}-postgres env_file: ./.env + environment: + - TS_AUTHKEY= # Empty: env_file loads all of .env, but only the tailscale container needs the auth key healthcheck: test: pg_isready -h 127.0.0.1 -q -t 2 -d $$POSTGRES_DB -U $$POSTGRES_USER # Check if PostgreSQL accepts connections start_period: 20s @@ -109,6 +112,8 @@ services: container_name: ${SERVICE}-redis image: docker.io/valkey/valkey:8.1-alpine env_file: ./.env + environment: + - TS_AUTHKEY= # Empty: env_file loads all of .env, but only the tailscale container needs the auth key command: - sh - -c # this is to evaluate the $REDIS_PASSWORD from the env @@ -126,6 +131,8 @@ services: container_name: ${SERVICE}-rediscache image: docker.io/valkey/valkey:8.1-alpine env_file: ./.env + environment: + - TS_AUTHKEY= # Empty: env_file loads all of .env, but only the tailscale container needs the auth key command: - sh - -c # this is to evaluate the $REDIS_PASSWORD from the env diff --git a/services/pocket-id/README.md b/services/pocket-id/README.md index ce7bf2a6..b0164a03 100644 --- a/services/pocket-id/README.md +++ b/services/pocket-id/README.md @@ -21,7 +21,7 @@ This stack runs Pocket ID with a Tailscale sidecar, as described in [the standar ## Deviations from the standard setup -- **The container reads the whole `.env` file.** The `application` container loads `.env` through `env_file`. Every variable in that file, including `TS_AUTHKEY`, is therefore present in its environment. +- **The container reads the whole `.env` file.** The `application` container loads `.env` through `env_file`. Every variable in that file is therefore present in its environment, except `TS_AUTHKEY`. `compose.yaml` sets it to an empty value for it, because only the `tailscale` container uses the auth key. - **Trusted proxy.** `TRUST_PROXY=true` in `.env` makes Pocket ID accept the client address that Tailscale Serve forwards. - **User and group.** `PUID` and `PGID` come from `.env`. diff --git a/services/pocket-id/compose.yaml b/services/pocket-id/compose.yaml index 1b3d4315..4a8bc9d7 100644 --- a/services/pocket-id/compose.yaml +++ b/services/pocket-id/compose.yaml @@ -54,6 +54,7 @@ services: container_name: app-${SERVICE} # Name for local container management env_file: .env environment: + - TS_AUTHKEY= # Empty: env_file loads all of .env, but only the tailscale container needs the auth key - ENCRYPTION_KEY=${ENCRYPTION_KEY:?Set ENCRYPTION_KEY in .env} volumes: - ./${SERVICE}-data:/app/data diff --git a/services/tandoor/README.md b/services/tandoor/README.md index c622b211..8af3914a 100644 --- a/services/tandoor/README.md +++ b/services/tandoor/README.md @@ -28,7 +28,7 @@ Set these values in `.env`: - **Extra container.** The stack runs a `database` container with PostgreSQL. It uses the network of the `tailscale` container as well, so Tandoor reaches it at `127.0.0.1`. PostgreSQL listens only on the loopback address of the device, so other devices on your Tailnet cannot reach it. - **Service port.** `TANDOOR_PORT` makes Tandoor listen on the port from `SERVICEPORT`, which is `9001`. -- **The container reads the whole `.env` file.** The `application` container loads `.env` through `env_file`. Every variable in that file, including `TS_AUTHKEY`, is therefore present in its environment. +- **The container reads the whole `.env` file.** The `application` container loads `.env` through `env_file`. Every variable in that file is therefore present in its environment, except `TS_AUTHKEY`. `compose.yaml` sets it to an empty value for it, because only the `tailscale` container uses the auth key. ## First run diff --git a/services/tandoor/compose.yaml b/services/tandoor/compose.yaml index c594ce43..d6587bac 100644 --- a/services/tandoor/compose.yaml +++ b/services/tandoor/compose.yaml @@ -53,6 +53,7 @@ services: network_mode: service:tailscale # Sidecar configuration to route the service through Tailscale container_name: app-${SERVICE} # Name for local container management environment: + - TS_AUTHKEY= # Empty: env_file loads all of .env, but only the tailscale container needs the auth key - TZ=${TZ} - TANDOOR_PORT=${SERVICEPORT} - SECRET_KEY=${SECRET_KEY:?Set SECRET_KEY in .env}