Create SOPS-encrypted secrets backup for Tandoor (.env.enc) #40

Closed
opened 2026-04-26 01:21:46 +00:00 by matt · 0 comments
Owner

Problem

Tandoor uses env_file: ./.env for database credentials (POSTGRES_PASSWORD, SECRET_KEY, etc). That file is gitignored and exists only on Nexus at /home/matt/repos/homelab-docker/tandoor/.env.

If Nexus is rebuilt from scratch, the Tandoor secrets are permanently lost — the database would be unrecoverable without the original POSTGRES_PASSWORD.

This is the same gap that was fixed for Bookstack in PR #35 (bookstack/.env.enc).

Fix

Create tandoor/.env.enc — a SOPS-encrypted backup tracked in git. The .sops.yaml rule already matches .env.enc files, so no config changes needed.

Steps (run on Nexus)

ssh matt@192.168.1.226

# Verify the .env exists and looks correct
cat /home/matt/repos/homelab-docker/tandoor/.env

# Encrypt it
cd /home/matt/repos/homelab-docker
sops --encrypt --input-type dotenv --output-type dotenv tandoor/.env > tandoor/.env.enc

# Verify decryption works
sops --decrypt --input-type dotenv --output-type dotenv tandoor/.env.enc | grep POSTGRES

Then SCP to Atlas and commit

scp matt@192.168.1.226:/home/matt/repos/homelab-docker/tandoor/.env.enc C:/repos/homelab-docker/tandoor/.env.enc

Verify it decrypts on Atlas, then create a PR with only tandoor/.env.enc added.

Branch: feature/tandoor-secrets-backup

Recovery (if Nexus is rebuilt)

cd /home/matt/repos/homelab-docker
sops -d --input-type dotenv --output-type dotenv tandoor/.env.enc > tandoor/.env
docker compose up -d

Notes

  • The runtime tandoor/.env must remain gitignored — never commit the plaintext file
  • Bookstack used this exact same pattern and it worked cleanly (see PR #35)
  • Komodo SOPS issue also needs a .env.enc — track as a separate issue if needed
## Problem Tandoor uses `env_file: ./.env` for database credentials (`POSTGRES_PASSWORD`, `SECRET_KEY`, etc). That file is gitignored and exists only on Nexus at `/home/matt/repos/homelab-docker/tandoor/.env`. If Nexus is rebuilt from scratch, the Tandoor secrets are permanently lost — the database would be unrecoverable without the original `POSTGRES_PASSWORD`. This is the same gap that was fixed for Bookstack in PR #35 (`bookstack/.env.enc`). ## Fix Create `tandoor/.env.enc` — a SOPS-encrypted backup tracked in git. The `.sops.yaml` rule already matches `.env.enc` files, so no config changes needed. ### Steps (run on Nexus) ```bash ssh matt@192.168.1.226 # Verify the .env exists and looks correct cat /home/matt/repos/homelab-docker/tandoor/.env # Encrypt it cd /home/matt/repos/homelab-docker sops --encrypt --input-type dotenv --output-type dotenv tandoor/.env > tandoor/.env.enc # Verify decryption works sops --decrypt --input-type dotenv --output-type dotenv tandoor/.env.enc | grep POSTGRES ``` ### Then SCP to Atlas and commit ```powershell scp matt@192.168.1.226:/home/matt/repos/homelab-docker/tandoor/.env.enc C:/repos/homelab-docker/tandoor/.env.enc ``` Verify it decrypts on Atlas, then create a PR with only `tandoor/.env.enc` added. Branch: `feature/tandoor-secrets-backup` ## Recovery (if Nexus is rebuilt) ```bash cd /home/matt/repos/homelab-docker sops -d --input-type dotenv --output-type dotenv tandoor/.env.enc > tandoor/.env docker compose up -d ``` ## Notes - The runtime `tandoor/.env` must remain gitignored — never commit the plaintext file - Bookstack used this exact same pattern and it worked cleanly (see PR #35) - Komodo SOPS issue also needs a `.env.enc` — track as a separate issue if needed
matt closed this issue 2026-04-28 01:56:26 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
matt/homelab-docker#40
No description provided.