🐞 Bug: seafile cannot connect to database
Bug Description
I was trying multiple time and checked all the setting, but seafile container cannot connect to db container. I guess not resolvable by name.
Expected Behavior
to work
Actual Behavior
dont work
Screenshots
No response
Operating System
Linux
Tailscale Version
1.98.4
Docker Version
28.3.1
Relevant Logs or Error Messages
Docker Compose Configuration
Environment Configuration (.env file)
Additional Context
No response
Thanks for the report, @palcica. It has no logs or configuration, so I reproduced it with a test node in a Tailnet.
The Seafile stack on main connects to the database with the default settings. I found two situations that give your symptom. In both, Seafile waits for the database without logging anything, the app-seafile container turns unhealthy, and the web interface answers 502 Bad Gateway.
1. TS_ACCEPT_DNS=true is enabled in compose.yaml. This matches your guess that the name does not resolve. Seafile shares the network of the Tailscale container and reaches the database through the Compose service name db. With TS_ACCEPT_DNS=true, Tailscale replaces Docker DNS and db no longer resolves. When you opened this issue, the comment on that line read "Uncomment when using MagicDNS". #351 replaced it with a warning. You can check it with:
docker exec app-seafile getent hosts db memcached
If the command prints nothing, comment out TS_ACCEPT_DNS and run docker compose up -d. Seafile does not need it, and Tailscale Serve works without it.
2. The database passwords in .env changed after the first start. MariaDB keeps the passwords from its first start, so later changes to INIT_SEAFILE_MYSQL_ROOT_PASSWORD or SEAFILE_MYSQL_DB_PASSWORD do not reach the existing database. In this case docker logs app-seafile-db shows Access denied for user. Restore the original passwords. On a new installation without data, you can instead stop the stack, delete the SEAFILE_MYSQL_VOLUME and SEAFILE_VOLUME directories, and start again.
I also found a related bug: MEMCACHED_HOST only resolved while SERVICE was seafile. #354 fixes that and adds the two cases above to the Seafile README.
If neither case applies to you, please share your compose.yaml, your .env without the secrets, and the output of these commands:
docker compose ps -a
docker exec app-seafile getent hosts db memcached
docker logs app-seafile-db