Seafile with podman

I’m trying to install seafile with podman. I’ve replicated the docker-compose file with a shell script so far. Unfortunately, the database setup isn’t working and I’m stuck…

The script:

#!/bin/sh

# This script is used to deploy and update Seafile on ursini
# Start with the following env if this is a new server

podman login -u seafile -p pw docker.seadrive.org

podman pull docker.io/library/mariadb
podman pull docker.io/library/memcached
podman pull docker.io/seafileltd/elasticsearch-with-ik:5.6.16
podman pull docker.seadrive.org/seafileltd/seafile-pro-mc

podman pod rm -f seafile

podman pod create -p 65080:80 --name seafile

# Create MariaDB container in seafile pod
podman create \
  --pod seafile \
  --name seafile-db \
  -e MYSQL_ROOT_PASSWORD='mysqlrootpw' \
  -e MYSQL_LOG_CONSOLE=true \
  -v /srv/share/seafile/mysql:/var/lib/mysql \
  mariadb

# Create memcached container in seafile pod
podman create \
  --pod seafile \
  --name seafile-memcached \
  memcached
  #--entrypoint '/usr/local/bin/memcached -m 256' \

# Create elasticsearch container in seafile pod
podman create \
  --pod seafile \
  --name seafile-elasticsearch \
  -e discovery.type=single-node \
  -e bootstrap.memory_lock=true \
  -e "ES_JAVA_OPTS=-Xms1g -Xmx1g" \
  -v /srv/share/seafile/elasticsearch:/usr/share/elasticsearch/data \
  docker.io/seafileltd/elasticsearch-with-ik:5.6.16

# Create seafile container in seafile pod
podman create \
  --pod seafile \
  --name seafile-seafile \
  -v /srv/share/seafile/data:/shared \
  -e DB_HOST=localhost \
  -e DB_ROOT_PASSWD='mysqlrootpw' \
  -e TIME_ZONE='Europe/Zurich' \
  -e SEAFILE_ADMIN_EMAIL='fujexo@c0d3.ch' \
  -e SEAFILE_ADMIN_PASSWORD='sadfHH&Ad9sadf' \
  -e SEAFILE_SERVER_LETSENCRYPT=false \
  -e SEAFILE_SERVER_HOSTNAME='seafile.hcorp.c0d3.ch' \
  docker.seadrive.org/seafileltd/seafile-pro-mc


podman start seafile-memcached seafile-db seafile-elasticsearch
sleep 30
podman start seafile-seafile

I can see that the msyql setup script creates a seafile user inside the database:

MariaDB [(none)]> select * from mysql.user where User='seafile' \G;
*************************** 1. row ***************************
                  Host: %.%.%.%
                  User: seafile
              Password: *C3DA67F513608A73A4CB30B2BB49F8A9F4EFE312
           Select_priv: N
           Insert_priv: N
           Update_priv: N
           Delete_priv: N
           Create_priv: N
             Drop_priv: N
           Reload_priv: N
         Shutdown_priv: N
          Process_priv: N
             File_priv: N
            Grant_priv: N
       References_priv: N
            Index_priv: N
            Alter_priv: N
          Show_db_priv: N
            Super_priv: N
 Create_tmp_table_priv: N
      Lock_tables_priv: N
          Execute_priv: N
       Repl_slave_priv: N
      Repl_client_priv: N
      Create_view_priv: N
        Show_view_priv: N
   Create_routine_priv: N
    Alter_routine_priv: N
      Create_user_priv: N
            Event_priv: N
          Trigger_priv: N
Create_tablespace_priv: N
   Delete_history_priv: N
              ssl_type: 
            ssl_cipher: 
           x509_issuer: 
          x509_subject: 
         max_questions: 0
           max_updates: 0
       max_connections: 0
  max_user_connections: 0
                plugin: mysql_native_password
 authentication_string: *C3DA67F513608A73A4CB30B2BB49F8A9F4EFE312
      password_expired: N
               is_role: N
          default_role: 
    max_statement_time: 0.000000
1 row in set (0.001 sec)

ERROR: No query specified

But I get the following error rom the container logs:

*** Running /etc/my_init.d/01_create_data_links.sh...
*** Booting runit daemon...
*** Runit started as PID 16
*** Running /scripts/start.py...
Checking python on this machine ...

Checking for java ...


verifying password of user root ...  done

verifying password of user seafile ...  
Failed to connect to mysql server using user "seafile" and password "***": Access denied for user 'seafile'@'::1' (using password: YES)

[2020-09-15 21:59:43] Now running setup-seafile-mysql.py in auto mode.
Traceback (most recent call last):
  File "/scripts/start.py", line 86, in <module>
    main()
  File "/scripts/start.py", line 56, in main
    init_seafile_server()
  File "/scripts/bootstrap.py", line 145, in init_seafile_server
    call('{} auto -n seafile'.format(setup_script), env=env)
  File "/scripts/utils/__init__.py", line 70, in call
    return subprocess.check_call(*a, **kw)
  File "/usr/lib/python3.6/subprocess.py", line 311, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '/opt/seafile/seafile-pro-server-7.1.7/setup-seafile-mysql.sh auto -n seafile' returned non-zero exit status 255.
*** /scripts/start.py exited with status 1.
*** Shutting down runit daemon (PID 16)...
*** Running /etc/my_init.post_shutdown.d/10_syslog-ng.shutdown...
*** Killing all processes...

Not sure what is exactly happening. But I feel like the setup script isn’t saving the password and has trouble logging in.
Any ideas?

1 Like

Well, I was able to fix this and have Seafile now running with podman.

 # Create seafile container in seafile pod
 podman create \
   --pod seafile \
   --name seafile-seafile \
   -v /srv/share/seafile/data:/shared \
-  -e DB_HOST=localhost \
+  -e DB_HOST=127.0.0.1 \
   -e DB_ROOT_PASSWD='mysqlrootpw' \
   -e TIME_ZONE='Europe/Zurich' \
   -e SEAFILE_ADMIN_EMAIL='fujexo@c0d3.ch' \
   -e SEAFILE_ADMIN_PASSWORD='sadfHH&Ad9sadf' \
   -e SEAFILE_SERVER_LETSENCRYPT=false \
   -e SEAFILE_SERVER_HOSTNAME='seafile.hcorp.c0d3.ch' \
   docker.seadrive.org/seafileltd/seafile-pro-mc
1 Like

Thanks for this! I’ll see if I can make the switch from Docker to podman some time in the future. Having to debug docker containers as root is really stupid.