Skip to content

Seafile: fix Memcached host and document database connection failures - #354

Merged
crypt0rr merged 2 commits into
mainfrom
seafile-db-connection
Oct 2, 2026
Merged

crypt0rr merged 2 commits into
mainfrom
seafile-db-connection

Conversation

@jackspiering

Copy link
Copy Markdown
Collaborator

Closes #320.

What changed

  • .env: MEMCACHED_HOST now uses the Compose service name memcached. The previous value, app-seafile-memcached, is a container name that only exists while SERVICE is seafile. With any other SERVICE value the name did not resolve and Seahub logged pylibmc.ServerDown on every request.
  • README.md: new troubleshooting section for a Seafile container that cannot reach the database.

Why

Issue #320 reports that Seafile cannot connect to the database and guesses that the name does not resolve. The report has no logs or configuration, so I reproduced it.

The stack on main connects to the database with the default settings. The settings that matter are the same as in the original Seafile commit, so the defaults were not broken when the issue was opened.

Two situations give the reported symptom. In both, Seafile waits for the database without logging anything, the container turns unhealthy, and the web interface answers 502:

  1. TS_ACCEPT_DNS=true is uncommented. Tailscale replaces Docker DNS, so db no longer resolves. When the issue was opened, the comment on that line read "Uncomment when using MagicDNS". All services: clarify when to enable TS_ACCEPT_DNS #351 already replaced it with a warning.
  2. The database passwords in .env changed after the first start. MariaDB keeps the passwords from its first start and logs Access denied for user.

Testing

Tested on Docker 29.8.2 with a test node in a Tailnet, SERVICE=seafile-test-320:

  • main unchanged: all four containers healthy, the databases were created, https://<node>.<tailnet>.ts.net/api2/ping/ answered "pong". Seahub logged Memcached errors for app-seafile-memcached.
  • With this change: all four containers healthy, the API login returned a token over the Tailnet, no Memcached errors, and Memcached counted get and set commands.
  • TS_ACCEPT_DNS=true: getent hosts db printed nothing and Seafile answered 502.
  • Changed passwords on an existing database: db resolved, MariaDB logged Access denied, and Seafile answered 502.
  • docker compose config --quiet, rumdl check, and git diff --check pass.

MEMCACHED_HOST pointed at the container name app-seafile-memcached, which
only exists while SERVICE is "seafile". With any other SERVICE value the
name did not resolve and Seahub logged a Memcached error on every request.

- Use the Compose service name "memcached", which does not depend on
  SERVICE.
- README: add a troubleshooting section for a Seafile container that
  cannot reach the database. Seafile waits without logging anything, so
  describe the two causes found while reproducing #320: TS_ACCEPT_DNS=true
  replaces Docker DNS, and database passwords changed after the first
  start.
@crypt0rr
crypt0rr merged commit 6f47d94 into main Oct 2, 2026
1 check passed
@crypt0rr
crypt0rr deleted the seafile-db-connection branch October 2, 2026 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐞 Bug: seafile cannot connect to database

2 participants