P
Postizβ€’3mo ago
Support

Ticket: Support Ticket: Docker Container Ignoring .env for Postiz Setup

@Sven Just created a ticket
Question: I'm trying to setup Postiz in a docker container (docker-compose) and it seems the Postiz.env/.env file is ignored.
Attempted: I verified that the postiz.env is properly copied to /app/.env, after that I removed my env file so the env file that is inside the docker container (.env.example from the repo) is used. I get warnings like WARN [Configuration issue] JWT_SECRET not set. WARN [Configuration issue] MAIN_URL not set. but all of them are set in the .env file JWT_SECRET="random string for your JWT secret, make it long" It works if I set the env variables inside the docker-compose.yaml so to me it seems that it's the .env that is not loaded
Working On: Just trying to get a good initial setup working
Take it from here @Mod πŸ”₯
15 Replies
zac_goose
zac_gooseβ€’3mo ago
Are you able to post your compose file, with redacted secrets. also what compose platform, classic or portainer stacks?
Sven
Svenβ€’3mo ago
Classic compose, on Windows Docker Desktop The docker-compose.yaml is mostly the one from the documentation (+ a caddy container as reverse Proxy). Just moved most of the env variables into the postiz.env
Nevo David
Nevo Davidβ€’3mo ago
Power shell?
Sven
Svenβ€’3mo ago
No Can you tell me where/how the .env file is loaded so I can have a look myself what could be wrong?
Nevo David
Nevo Davidβ€’3mo ago
@xcons need you help here πŸ˜„
zac_goose
zac_gooseβ€’3mo ago
You have to map the postiz.env to /config in the container
Sven
Svenβ€’3mo ago
That happens, I map the 'local' ./config which contains the postiz.env to /config. That part works fine, the postiz.env ends up as .env in /app . And to just repeat what I already wrote, if I don't add my postiz.env, than the one that is part of the image is there and also not used
zac_goose
zac_gooseβ€’3mo ago
Okay, I just use the config file for ENV or map all the config to the env file using the method provided here: https://www.warp.dev/terminus/docker-compose-env-file
Use An .env File in Docker Compose
Learn how define and pass environment variables to Docker containers using an .env file in Docker Compose.
Sven
Svenβ€’3mo ago
That would probably work, but it seems a bit weird that there is the whole postiz.env/.env if it doesn't work πŸ˜‰
Mirza
Mirzaβ€’3mo ago
Check whether you are using/have .env or .env.example @Sven What you added in JWT_SECRET
Sven
Svenβ€’3mo ago
/app/.env exists Random string, something like JUSD378y9dasdfa!dfmlk?../po[e-pry2345sdfsasdfgrgweir heuh t98y349] or "random string for your JWT secret, make it long" when not provding my own .env (so the one inside the docker image is there instead) Anyway, config is OK, it works fine when I set as as environment in the docker-compose.yml and as I have issues no matter if I use my .env or the content of .env.example Also i don't see anywhere in the code the .env file would be loaded. There is ConfigurationChecker.readEnvFromFile that seems it would load it, butit seems it's never called. It's also not loaded vie node --node --env-file. This is why I asked how it's supposed to be loaded, I don't see anywhere where it should be loaded. I see that apps/backend/src/main.ts and apps/commands/src/tasks/configuration.ts call checker.readEnvFromProcess() and to me it seems there they should also call checker.readEnvFromFile() But that is just a guess as I don't know how it's supposed to be working.
Mirza
Mirzaβ€’3mo ago
The JWT_SECRET should not have any blank space
Sven
Svenβ€’3mo ago
While a space in the JWT_SECRET may be an issue, that doesn't seem to have anything to do with my issue. Fixing that issue doesn't have any effect on my issue. (wrote here earlier that it does fix my issue.. but that was just me being stupid early in the morning before I had a coffee and not updating the config correctly before testing it πŸ€¦β€β™‚οΈ )
xcons
xconsβ€’2mo ago
I am back πŸ˜„ Seeing several issues like this Hey @Sven ,@zac_goose , @Mirza , are you still having issues here? Is it OK to close this ticket?
Mirza
Mirzaβ€’2mo ago
I think you can close this
Want results from more Discord servers?
Add your server