Closed iroQuai closed 6 months ago
host 192.168.112.3 is not allowed to connect to this MariaDB server.
for some reason mariadb is rejecting connections from romm/the localhost. i asked chatgpt and it said to do this:
Configure MariaDB to Listen on All IP Addresses: You need to modify the MariaDB configuration to bind to all IP addresses. This can be done by creating a custom configuration file.
Create a custom configuration file my_custom.cnf with the following content:
[mysqld]
bind-address = 0.0.0.0
Then, mount this configuration file in your docker-compose.yml:
services:
romm-db:
image: mariadb:latest
container_name: romm-db
restart: unless-stopped
environment:
- MYSQL_ROOT_PASSWORD=mysql_root_pw123 # Use a unique, secure password
- MYSQL_DATABASE=romm
- MYSQL_USER=romm-user
- MYSQL_PASSWORD=${ROMM_DB_PW}
volumes:
- mysql_data:/var/lib/mysql
- ./my_custom.cnf:/etc/mysql/conf.d/my_custom.cnf # Mount the custom configuration file
ports:
- "3306:3306" # Expose port 3306
Grant User Permissions: Access the MariaDB container and grant the necessary permissions to the user from the specified IP address.
# Access the MariaDB container
docker exec -it romm-db bash
# Access MariaDB as root
mysql -u root -p
Inside the MariaDB shell, grant the necessary permissions:
GRANT ALL PRIVILEGES ON *.romm TO 'romm-user'@'192.168.112.3' IDENTIFIED BY 'your_password';
FLUSH PRIVILEGES;
This is way more complex as installing with docker should be... The IP varies from time to time too so that doesn't seem to help.
I was thinking, couldn't it have something to do with user- and group permissions? With other docker instances, most of the time problems like this disappear when I set those as environment data:
Environment:
- PGID=1000 # sometimes GROUP_ID
- PUID=1000 # sometimes USER_ID
Here is some info on that from Linux server.io: https://docs.linuxserver.io/general/understanding-puid-and-pgid/
so when I try to add PGID / PUID it still doesn't work. Same with user_id and group_id, but the errors with the last one seem different. (Still no connection to DB, but nothing about that sqlalchemy.exc.blabla
PUID and GUID are exclusively supported by linuxserver images, we don't use them in romm. You can try setting user
in the docker compose; i set romm to use user 1001, which is a special media
user with full permissions on all my legally obtained linux ISOs.
user: 1001:1001
Okay thanks for explaining. Didnt really work though. Seems like I'm the only one reporting this problem? You have any idea what to do next? (Maybe I should follow your chatGPT advice but I'm really hoping on a more simple solution that also works out of the box when reinstalling via docker compose some other time)
Op ma 27 mei 2024 20:09 schreef Georges-Antoine Assi < @.***>:
PUID and GUID are exclusively supported by linuxserver images, we don't use them in romm. You can try setting user in the docker compose; i set romm to use user 1001, which is a special media user with full permissions on all my legally obtained linux ISOs.
user: 1001:1001
— Reply to this email directly, view it on GitHub https://github.com/rommapp/romm/issues/884#issuecomment-2133899076, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABVODUCXPPINMD6IUAIIZADZENZEVAVCNFSM6AAAAABIKAKWOKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMZTHA4TSMBXGY . You are receiving this because you authored the thread.Message ID: @.***>
I just noticed a reference to this issue in the logs: https://docs.sqlalchemy.org/en/20/errors.html#error-e3q8
Exactly, it's not something under our control, but related to a specific of your setup. Unfortunately self-hosting is anything but simple when things go wrong, and you'll need to dig your heels into some of the complexities of docker/mariadb. At least this is a great way to learn!
I thought docker was invented to eliminate that exact problem; as long as you use docker, aren't containers the same on every machine?
Sorta, but in your case, those instructions I posted above aren't related to the content of the containers themselves (the images that run on them), but the data and config, which will very with each machine. I would suggest following them to fix your issue, or just wiping your containers and volumes, and starting from scratch.
Aahhhh thanks for pointing that out! I'll try it when I find the time!
Ok cool, I'm gonna close this issue since it's outside the scope of the code, but feel free to post updates here (or on discord).
RomM version I'm using the docker compose example from here.
Describe the bug Romm isn't starting properly.
To Reproduce This is my compose data
I have an .env file with all mentioned ${STRINGS} filled in.
I use dockge to manage my stacks. Through dockge I created a stack (=folder) called "romm" and added above compose file and matching .env file. I also added a /config/ and an /assets/ folder in that /romm/ folder.
I pressed "start" which is the dockge equivalent of "docker compose up".
The mariaDB container just runs. The Romm container runs, but isn't visible.it exits with code 1, mentioning "something went horribly wrong with our database" and also something about sqlalchemy.exc.operationalError "host 192.168.112.3 is not allowed to connect to this MariaDB server.
After some time the Romm container tries to restart, over and over. Untill I stop it.
If needed I can try and discover how to get the full logs (probably not that hard just never did it before)
Expected behavior I expected both the mariadb container as the romm container to be created and running. I expected to be able to visit romm at the specified port
Additional context I'm on Synology DS220+ if that matters? I've manage around 10 other stacks that work fine this way. If it matters I can spin up the compose file via cli once too (but I can't believe that would matter)