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] Missing database credentials, check your environment variables! #1291

Open
matthias-hoste opened this issue Nov 15, 2024 · 7 comments
Open
Assignees
Labels
bug Something isn't working

Comments

@matthias-hoste
Copy link

RomM version
latest

Describe the bug
I use the default docker-compose.yml example. First with changes to use my already running mysql server which gave the error that it cant find the database credentials. Then I tried the example yml directly with it's included mysql server which also gave this error. I'm using portainer

To Reproduce
Create a new stack in portainer, use example docker yml

Expected behavior
Starts up fine

@matthias-hoste matthias-hoste added the bug Something isn't working label Nov 15, 2024
@gantoine
Copy link
Member

Can you post your docker-compose?

@matthias-hoste
Copy link
Author

`version: "3"

volumes:
mysql_data:
romm_resources:
romm_redis_data:

services:
romm:
image: rommapp/romm:latest
container_name: romm
restart: unless-stopped
environment:
- DB_HOST=romm-db
- DB_NAME=romm # Should match MYSQL_DATABASE in mariadb
- DB_USER=romm-user # Should match MYSQL_USER in mariadb
- DB_PASSWD= # Should match MYSQL_PASSWORD in mariadb
- ROMM_AUTH_SECRET_KEY=outputofthatcommandhere
- IGDB_CLIENT_ID=myclientid
- IGDB_CLIENT_SECRET=myclientsecret
volumes:
- romm_resources:/romm/resources # Resources fetched from IGDB (covers, screenshots, etc.)
- romm_redis_data:/redis-data # Cached data for background tasks
- /volume1/homes/LifeCoder/docker/romm/library:/romm/library # Your game library
- /volume1/homes/LifeCoder/docker/romm/assets:/romm/assets # Uploaded saves, states, etc.
- /volume1/homes/LifeCoder/docker/romm/config:/romm/config # Path where config.yml is stored
ports:
- 80:8080
deploy:
placement:
constraints:
- node.role == manager

romm-db:
image: mariadb:latest # if you experience issues, try: linuxserver/mariadb:latest
container_name: romm-db
restart: unless-stopped
environment:
- MYSQL_ROOT_PASSWORD=Str0ngUn1qu3Pa55word # Use a unique, secure password
- MYSQL_DATABASE=romm
- MYSQL_USER=romm-user
- MYSQL_PASSWORD=
volumes:
- mysql_data:/var/lib/mysql
deploy:
placement:
constraints:
- node.role == manager`

@gantoine
Copy link
Member

And you've set both DB_PASSWD and MYSQL_PASSWORD to something, since they can't be empty?

@matthias-hoste
Copy link
Author

Yeah

@gantoine
Copy link
Member

Hmmm the code with that check should pass in this case, unless you have a whitespace after the =?

if not DB_USER or not DB_PASSWD:
                log.critical(
                    "Missing database credentials, check your environment variables!"
                )
                sys.exit(3)

@matthias-hoste
Copy link
Author

matthias-hoste commented Nov 16, 2024

Nope, added the password directly after the =. It's really weird.
It's as if the env vars are not passed at all

@gantoine
Copy link
Member

any chance it has to do with indentation, make sure the yaml is correct by pasting it in a web verifier?

@gantoine gantoine self-assigned this Nov 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants