Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Docker secrets (with var _file) does not work anymore #2788

Open
goegol opened this issue Nov 18, 2024 · 6 comments
Open

[Bug]: Docker secrets (with var _file) does not work anymore #2788

goegol opened this issue Nov 18, 2024 · 6 comments
Assignees
Labels
Bug Fixed and Staged Fixed in Master and ready to be included in the next release

Comments

@goegol
Copy link

goegol commented Nov 18, 2024

What is your set up?

Cloud Hosted

Version

3.3.0

Describe the issue

When i try version 3.2.x and 3.3.0 i got the error Cannot connect to database in browser.
When i do the downgrade to 3.1.4, every thing works fine.
When i check the logs of my database i see that leantime tried to login without an password.
2024-11-03 14:36:09 3 [Warning] Access denied for user 'leantime'@'10.0.7.11' (using password: NO)
In my docker-compose im using the option LEAN_DB_PASSWORD_FILE (so as described in manual).

See also my note in bug #2735

When i do a downgrade to 3.1.4, every thing is working fine again.

Reproduction steps

  1. Spinup leantime 3.2.x or 3.3.0
  2. Use docker swarm with secrets support.
  3. use the env var: LEAN_DB_PASSWORD_FILE
  4. Leantime cant connect to db

Additional Notes

Please let me know if i can assist with testing.

@marcelfolaron
Copy link
Contributor

Just to confirm it sounds like you are using docker swarm? I have not tested the set up in docker swarm and have limited knowledge about the underlying infrastructure.

What are you referring to with this string LEAN_DB_PASSWORD_FILE ? Are you referring to the environment file or the environment variable?
In the docker compose file we ship with docker the filename is .env https://github.com/Leantime/docker-leantime/blob/master/docker-compose.yml

If you are referring to the password variable for the database however it should be LEAN_DB_PASSWORD (no _file at the end). The full list of env variables is in our samples file: https://github.com/Leantime/docker-leantime/blob/master/sample.env

@marcelfolaron marcelfolaron added the Fixed and Staged Fixed in Master and ready to be included in the next release label Nov 23, 2024
@gtridr
Copy link

gtridr commented Dec 3, 2024

I'm actually experiencing the same issue, in normal docker compose

If i set LEAN_DB_PASSWORD=MyPlaintextPassword in .env file, everything works fine.

When trying to use secrets, LEAN_DB_PASSWORD_FILE does not, despite secret being properly populated to a /run/secrets file, load the password from the file during bootstrap.

Instead, the app throws an exception resulting in the same error stated by OP:
[Warning] Access denied for user 'lean'@'[IP]' (using password: NO)

I logged into the container, and, assuming LEAN_DB_PASSWORD_FILE is set to /run/secrets/mysql-user-pass :

cat ${LEAN_DB_PASSWORD_FILE} does expand to the contents of /run/secrets/mysql-user-pass

@hhemelaa
Copy link

hhemelaa commented Dec 3, 2024

See also in the readme under subject docker secrets: https://github.com/Leantime/docker-leantime/blob/master/README.md

So in readme it's saying that's is supported by leantime.
@marcelfolaron

@marcelfolaron
Copy link
Contributor

Ah, I see. Yeah the checks for the _FILE reference got lost in our start shell script. I have a PR ready to add them back and will rebuild the images: Leantime/docker-leantime#89

@marcelfolaron marcelfolaron reopened this Dec 3, 2024
@gtridr
Copy link

gtridr commented Dec 3, 2024

I can open a new issue, but I'd love to see support for a few additional environment vars being passed to the bootstrap script via secrets
namely: LEAN_REDIS_PASSWORD
but also:

LEAN_DB_HOST
LEAN_DB_DATABASE
LEAN_DB_USER
LEAN_EMAIL_SMTP_USERNAME

the less info about my infrastructure i can (even potentially) expose, the better

@goegol
Copy link
Author

goegol commented Dec 4, 2024

In Leantime/docker-leantime#90 i added all the _FILE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Fixed and Staged Fixed in Master and ready to be included in the next release
Projects
None yet
Development

No branches or pull requests

4 participants