Periphery environment variables causing issues with postgres #178

Closed
opened 2025-10-31 15:04:09 -05:00 by GiteaMirror · 5 comments
Owner

Originally created by @june012006 on GitHub (Jan 11, 2025).

When setting up Immich, based on the 'official' compose file, I kept getting a password error in the immich app. The compose file uses a .env file with a DB_PASSWORD variable to set the password for all services, which is a fairly common practice. During troubleshooting, I logged in to the pg container for immich, and checked what POSTGRES_PASSWORD was set to, and it had no relation to what the environment variable should've been. It persisted through multiple redeployments. I realized it has to be coming from somewhere, so I logged in to the periphery container, and found the DB_PASSWORD environment variable was the same.
The issue in my compose file is this line POSTGRES_PASSWORD: ${DB_PASSWORD}, it should be getting the variable from the env file, but instead it's being overridden by the periphery value. This is a fairly common environment setting. Can we get the variable for the periphery changed to something less generic? so it doesn't interfere with other projects?

Originally created by @june012006 on GitHub (Jan 11, 2025). When setting up Immich, based on the 'official' compose file, I kept getting a password error in the immich app. The compose file uses a .env file with a DB_PASSWORD variable to set the password for all services, which is a fairly common practice. During troubleshooting, I logged in to the pg container for immich, and checked what POSTGRES_PASSWORD was set to, and it had no relation to what the environment variable should've been. It persisted through multiple redeployments. I realized it has to be coming from somewhere, so I logged in to the periphery container, and found the DB_PASSWORD environment variable was the same. The issue in my compose file is this line POSTGRES_PASSWORD: ${DB_PASSWORD}, it should be getting the variable from the env file, but instead it's being overridden by the periphery value. This is a fairly common environment setting. Can we get the variable for the periphery changed to something less generic? so it doesn't interfere with other projects?
GiteaMirror added the setup label 2025-10-31 15:04:09 -05:00
Author
Owner

@mbecker20 commented on GitHub (Jan 12, 2025):

This is a good point that I did overlook, thanks, I'll use another Komodo-specific env variable to avoid any overlap. You may also consider moving to the more secure "docker compose secrets": https://docs.docker.com/compose/how-tos/use-secrets/#advanced. The secret env variables like KOMODO_DATABASE_PASSWORD all support _FILE to use with docker compose secrets. Ref: https://github.com/mbecker20/komodo/blob/main/config/core.config.toml#L260

@mbecker20 commented on GitHub (Jan 12, 2025): This is a good point that I did overlook, thanks, I'll use another Komodo-specific env variable to avoid any overlap. You may also consider moving to the more secure "docker compose secrets": https://docs.docker.com/compose/how-tos/use-secrets/#advanced. The secret env variables like `KOMODO_DATABASE_PASSWORD` all support `_FILE` to use with docker compose secrets. Ref: https://github.com/mbecker20/komodo/blob/main/config/core.config.toml#L260
Author
Owner

@MFDoombino commented on GitHub (Jan 21, 2025):

I cannot get this to work no matter what I try.

Stack DIR is already /etc/komodo/stacks

I've tried not using environment variables at all, tried using secrets, nothing is working.

@MFDoombino commented on GitHub (Jan 21, 2025): I cannot get this to work no matter what I try. Stack DIR is already /etc/komodo/stacks I've tried not using environment variables at all, tried using secrets, nothing is working.
Author
Owner

@Smiie-2 commented on GitHub (Feb 1, 2025):

I'm having a similar issue. recently moved from dockage to komodo, hence I moved all my stacks from /opt/stacks to /etc/komodo/stacks. Everything but immich is working great.

DB_location=./postgress in my .env. When starting immich via komodo it for some reason I can't understand, sets the variable as /opt/stacks/immich. If I go to /etc/komodo/stacks/ and run docker compose up, it correctly reads the env file and uses /etc/komodo/stacks/immich/.

Even setting a static path does nothing to change this behavior.

@Smiie-2 commented on GitHub (Feb 1, 2025): I'm having a similar issue. recently moved from dockage to komodo, hence I moved all my stacks from /opt/stacks to /etc/komodo/stacks. Everything but immich is working great. DB_location=./postgress in my .env. When starting immich via komodo it for some reason I can't understand, sets the variable as /opt/stacks/immich. If I go to /etc/komodo/stacks/ and run docker compose up, it correctly reads the env file and uses /etc/komodo/stacks/immich/. Even setting a static path does nothing to change this behavior.
Author
Owner

@MFDoombino commented on GitHub (Feb 1, 2025):

@Smiie-2 I edited the Environment file of Komodo itself which for me is at /opt/komodo/compose.env and changed the variable names to not be DB_USERNAME or DB_PASSWORD and changed them to be more specific. KOMODO_DB_USERNAME etc. Make sure you update the references in the yaml file as well. I believe @mbecker20 said this will be fixed in an upcoming update.

The trick that took me a bit is you then have to compose down Komodo and rebuild it to make sure it uses the new environment variables.

@MFDoombino commented on GitHub (Feb 1, 2025): @Smiie-2 I edited the Environment file of Komodo itself which for me is at /opt/komodo/compose.env and changed the variable names to not be `DB_USERNAME` or `DB_PASSWORD` and changed them to be more specific. `KOMODO_DB_USERNAME` etc. Make sure you update the references in the yaml file as well. I believe @mbecker20 said this will be fixed in an upcoming update. The trick that took me a bit is you then have to compose down Komodo and rebuild it to make sure it uses the new environment variables.
Author
Owner

@mbecker20 commented on GitHub (Aug 26, 2025):

They have all been KOMODO_* for a while now

@mbecker20 commented on GitHub (Aug 26, 2025): They have all been KOMODO_* for a while now
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/komodo#178