Seafile CE on Podman

I’m trying to get the Seafile server CE container working on Podman. I can see this has been done before, with the pro version.

Seafile is in a podman pod with mariadb and memcahed, all containers start but Seafile is unable connect to the database container.

This is because it always tries to connect via a socket instead of over TCP.

Checking the logs:

podman exec container-seafile more /shared/seafile/logs/seafile.log

Shows:

2023-08-10 18:14:23 ../common/seaf-db.c(826): Failed to connect to MySQL: Can't connect to local server through socket '/tmp/mysql.sock' (2)

As though it’s completely ignoring the DB_HOST env variable I’m passing.

Here’s the systemd service I’m using for the seafile container, (it’s a jinja2 template, vars are filled in by Ansible):

[Unit]
Description=Podman container-seafile.service
Documentation=man:podman-generate-systemd(1)
Wants=network.target
After=network-online.target
RequiresMountsFor=%t/containers
After=pod-seafile.service container-seafile-mariadb.service container-seafile-memcached.service

[Service]
Environment=PODMAN_SYSTEMD_UNIT=%n
Restart=always
TimeoutStopSec=70
ExecStartPre=/bin/rm -f %t/%n.ctr-id
ExecStart=/usr/bin/podman container run \
      --cidfile=%t/%n.ctr-id \
      --cgroups=no-conmon \
      --pod-id-file %t/pod-seafile.pod-id \
      --sdnotify=conmon \
      --replace \
      --detach \
      --label io.containers.autoupdate=local \
      --name container-seafile \
      --env DB_HOST=127.0.0.1 \
      --env DB_ROOT_PASSWD="{{ seafile_mariadb_root_password }}" \
      --env TIME_ZONE={{ seafile_time_zone }} \
      --env SEAFILE_ADMIN_EMAIL="{{ seafile_admin_email }}" \
      --env SEAFILE_ADMIN_PASSWORD="{{ seafile_admin_password }}" \
      --env SEAFILE_SERVER_LETSENCRYPT=false  \
      --env SEAFILE_SERVER_HOSTNAME="seafile.{{ fqdn }}" \
      #--env FORCE_HTTPS_IN_CONF=true \
      --volume /data/momod/seafile/seafile:/shared \
      docker.io/seafileltd/seafile-mc:latest
ExecStop=/usr/bin/podman stop --ignore -t 10 --cidfile=%t/%n.ctr-id
ExecStopPost=/usr/bin/podman rm -f --ignore -t 10 --cidfile=%t/%n.ctr-id
Type=notify
NotifyAccess=all

[Install]

I’ve tried adding the port to the IP address, tried blowing everything away and starting fresh. It feels like seaf-db needs a better hint to use a tcp connection for the database.

Aside from trying the pro server version, any other suggestions?

Had another proper clean out with podman system after stopping the pod:

podman system prune --all --volumes

And removed persistent data in /data/momod/seafile.

Put quotes around the DB_HOST IP (don’t think that helped but…)

--env DB_HOST='127.0.0.1' \

Swtiched the seafile user that’s running these rootless containers to use a bash shell instead of nologin (again, I don’t think that should help but it was a difference with other services I have running successfully).

Reran my Ansible roles and now Seafile is able to talk to the database and I can reach the login page (I can’t login because seahub is crashing, but that’s a different problem).
But this db related issue is solved.

I believe the key was removing all existing images, containers, cache and data.

Consider this “Solved”