Debian docker build createsuperuser "Incorrect email or password" on login

Hi.
I am trying to create a custom docker build with 8.0.5 for a debian (not rasbian) based rpi4 to place it behind an existing nginx and connect to an existing mysql.
I build it by modifying the seafile server build manual for ubuntu for debian and putting it in an existing container build structure I have.

The container runs, seafile-server and seahub run.

When I login as superuser I get the message: “Incorrect email or password”

I checked my files over and over again, added some output here and there, tested something here and there. Thought about missing dependencies that are not reported correctly like if you’re missing mysql and only see it when running. Maybe I am cleaning up too much after building?

docker stats report:
a6ce555945a0 seafile_testnet 20.23% 122.2MiB / 1GiB 11.93% 540kB / 1.13MB 1.43MB / 414kB 24

Which seems weird. There is a constant load in the container which might look like somethings hanging?

To find the problem in a clean environment I completely recreate the docker volumes, mysql user and databases so it is clean every time.

Running it as root does not make a difference.

The database, the table Emailusers contains the superuser. The password changes when I run the command (while startup and manually) or creates a new one of I try so. So that seems to work.

I have no idea what the problem is and I thin I’m not getting enough logs here. I tried setting DEBUG = True in some configs where I found support for it in the code but there wasn’t any more output.

Thanks for any help. I seem to do something wrong but don’t notice it.

////////////////////////////////////////////////////////////////////////
Dockerfile

FROM debian:latest

# ARG BUILDDEPS="wget git build-essential cmake libevent-dev autoconf automake libtool libglib2.0-dev libjansson-dev libsqlite3-dev libssl-dev libarchive-dev valac libmariadb-dev-compat libmemcached-dev"
# ARG RUNDEPS="locales ca-certificates supervisor python3 python3-pip python3-dev libevent-2.1-6 libglib2.0-0 libjansson4 libarchive13 libmariadb3 libmemcached11"
ARG RUNDEPS="apt-transport-https autoconf automake build-essential ca-certificates cmake curl flex gcc git intltool libarchive-dev libarchive13 libcurl4-openssl-dev libevent-2.1-6 libevent-dev libffi-dev libfuse-dev libglib2.0-0 libglib2.0-dev libjansson-dev libjansson4 libldap2-dev libmariadb-dev-compat libmariadb3 libmemcached-dev libmemcached11 libmariadbclient-dev libonig-dev libpcre3-dev librados-dev libsqlite3-dev libssl-dev libtool libxml2-dev libxslt1-dev libz-dev locales mariadb-client netbase netcat nginx pkg-config poppler-utils python-dateutil python-pip python-simplejson python3 python3-dev python3-pip re2c sqlite3 sudo supervisor telnet unzip uuid-dev valac vim vim-scripts wget xz-utils"
ARG PYRUNDEPS="python-cas djangosaml2 cffi sqlalchemy pymysql pillow pycryptodome configparser pylibmc django-pylibmc elasticsearch==5.5.0 elasticsearch-dsl==5.4.0 Django==2.2.14 future captcha django-statici18n django-post_office==3.3.0 django-webpack_loader gunicorn mysqlclient django-picklefield==2.1.1 openpyxl qrcode django-formtools django-simple-captcha djangorestframework==3.11.1 python-dateutil requests pillow pyjwt pycryptodome requests_oauthlib mock nose exam splinter pytest pytest-django"

ARG VERSION
ARG SEAFILE_USER="seafile"
ARG SEAFILE_GROUP="seafile"
ARG BUILD_PATH="/seafile"
ENV RUN_PATH="/seafile/seahub"
ENV CONFIG_PATH="/seafile/config"
ENV DATA_PATH="/seafile/data"
ENV PID_PATH="/var/run/supervisord"
ENV LOG_PATH="/var/log/seafile"

ENV TZ="Europe/Berlin"
RUN ln -snf /usr/share/zoneinfo/${TZ} /etc/localtime && echo ${TZ} > /etc/timezone

RUN apt-get update && \
    apt-get upgrade -y && \
    apt-get install -y --no-install-recommends ${BUILDDEPS} ${RUNDEPS}

RUN sed -ri 's/(# *)?(en_US.UTF-8 UTF-8)/\2/g' /etc/locale.gen && \
    locale-gen en_US.UTF-8
ENV LANG="en_US.UTF-8"
ENV LANGUAGE="en_US:en"
ENV LC_ALL="en_US.UTF-8"

RUN curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash - && \
    apt-get install -y nodejs

RUN python3 -m pip install --upgrade pip
RUN rm -f /usr/bin/python && \
    ln -s /usr/bin/python3 /usr/bin/python && \
    rm -f /usr/bin/pip && \
    ln -s /usr/bin/pip3 /usr/bin/pip
RUN python3 -m pip install --upgrade setuptools virtualenv
RUN python3 -m pip install --upgrade ${PYRUNDEPS}

RUN mkdir -p "${BUILD_PATH}"
RUN mkdir -p "${RUN_PATH}"

RUN	cd "${BUILD_PATH}" && \
    mkdir "${BUILD_PATH}/libevhtp" && \
    wget -q --content-disposition -nc -O - https://github.com/haiwen/libevhtp/archive/18c649203f009ef1d77d6f8301eba09af3777adf.tar.gz | tar xz -C "${BUILD_PATH}/libevhtp" --strip 1 && \
    cd "${BUILD_PATH}/libevhtp/build" && \
    cmake -DEVHTP_DISABLE_SSL=ON -DEVHTP_BUILD_SHARED=OFF .. && \
    make && \
    make install && \
    ldconfig && \
    cp "${BUILD_PATH}/libevhtp/oniguruma/onigposix.h" /usr/local/include/

RUN	cd "${BUILD_PATH}" && \
    mkdir "${BUILD_PATH}/libsearpc" && \
    wget -q --content-disposition -nc -O - https://github.com/haiwen/libsearpc/archive/refs/tags/v3.2-latest.tar.gz | tar xz -C "${BUILD_PATH}/libsearpc" --strip 1 && \
    cd "${BUILD_PATH}/libsearpc" && \
    ./autogen.sh && \
    ./configure && \
    make && \
    make install && \
    ldconfig

RUN	cd "${BUILD_PATH}" && \
    mkdir "${BUILD_PATH}/seafile-server" && \
    wget -q --content-disposition -nc -O - https://github.com/haiwen/seafile-server/archive/refs/tags/v${VERSION}-server.tar.gz | tar xz -C "${BUILD_PATH}/seafile-server" --strip 1 && \
    cd "${BUILD_PATH}/seafile-server" && \
    ./autogen.sh && \
    ./configure --disable-fuse && \
    make && \
    make install && \
    ldconfig

RUN wget -q  --content-disposition -nc -O - https://github.com/haiwen/seahub/archive/refs/tags/v${VERSION}-server.tar.gz | tar xz -C "${RUN_PATH}" --strip 1 && \
    cd "${RUN_PATH}" && \
    virtualenv .virtualenv && \
    . .virtualenv/bin/activate && \
    python3 -m pip install -r requirements.txt

# RUN rm -rf ${BUILD_PATH}

# RUN apt-get purge -y ${BUILDDEPS} && \
# 	apt-get autoremove -y && \
# 	rm -rf /var/lib/apt/lists/*

COPY files/start.sh /start.sh
RUN chmod +rx /start.sh
COPY files/start_hub.sh /start_hub.sh
RUN chmod +rx /start_hub.sh
COPY files/supervisord.conf /supervisord.conf
RUN chmod +r /supervisord.conf

RUN addgroup --system "${SEAFILE_GROUP}" && \
    adduser --system --disabled-login --gecos 'Seafile' --ingroup "${SEAFILE_GROUP}" "${SEAFILE_USER}"

RUN install -d -g "${SEAFILE_GROUP}" -o "${SEAFILE_USER}" "${CONFIG_PATH}" && \
    install -d -g "${SEAFILE_GROUP}" -o "${SEAFILE_USER}" "${DATA_PATH}" && \
    install -d -g "${SEAFILE_GROUP}" -o "${SEAFILE_USER}" "${PID_PATH}" && \
    install -d -g "${SEAFILE_GROUP}" -o "${SEAFILE_USER}" "${LOG_PATH}"

USER "${SEAFILE_USER}"

VOLUME ["${DATA_PATH}", "${LOG_PATH}"]

EXPOSE 8000 8082

CMD ["/start.sh"]

////////////////////////////////////////////////////////////////////////
settings file for my helper script

NAME=seafile_${PROFILE}
IMAGE=seafile
VERSION=8.0.5
NETWORK=${PROFILE}_container
MEMORY=1G
RESTART=always
PORTS+=(["8000"]="${IP}:8000")
PORTS+=(["8082"]="${IP}:8082")
VOLUMES+=(["/var/log/seafile"]="${NAME}_log")
VOLUMES+=(["/seafile/data"]="${NAME}_data")
URL="seafile.${DOMAIN}"
ENVIRONMENT+=(["ADMIN_USER"]="admin")
ENVIRONMENT+=(["ADMIN_EMAIL"]="seafile@${DOMAIN}")
ENVIRONMENT+=(["DB_TYPE"]="mysql")
ENVIRONMENT+=(["DB_HOST"]="mysql.${NETWORK}")
ENVIRONMENT+=(["DB_PORT"]="3306")
ENVIRONMENT+=(["DB_USERNAME"]="${NAME}")
ENVIRONMENT+=(["CCNET_DB_NAME"]="${NAME}_ccnet")
ENVIRONMENT+=(["SERVER_DB_NAME"]="${NAME}_server")
ENVIRONMENT+=(["HUB_DB_NAME"]="${NAME}_hub")
ENVIRONMENT+=(["SERVICE_URL"]="http://${URL}:8000")
ENVIRONMENT+=(["FILE_SERVER_ROOT"]="http://${URL}:8082")

////////////////////////////////////////////////////////////////////////
secrets file for my helper script

ENVIRONMENT+=(["ADMIN_PASSWORD"]="somepassword")
ENVIRONMENT+=(["DB_PASSWORD"]="somepassword")

////////////////////////////////////////////////////////////////////////
start.sh

#!/bin/bash

set -e

echo "Writing configuration..."

cat > "${CONFIG_PATH}/ccnet.conf" <<-EOF
[Database]
ENGINE = ${DB_TYPE}
HOST = ${DB_HOST}
PORT = ${DB_PORT}
USER = ${DB_USERNAME}
PASSWD = ${DB_PASSWORD}
DB = ${CCNET_DB_NAME}
CONNECTION_CHARSET = utf8
CREATE_TABLES = true

[General]
SERVICE_URL = ${SERVICE_URL}
EOF

cat > "${CONFIG_PATH}/seafile.conf" <<-EOF
[database]
type = ${DB_TYPE}
host = ${DB_HOST}
port = ${DB_PORT}
user = ${DB_USERNAME}
password = ${DB_PASSWORD}
db_name = ${SERVER_DB_NAME}
connection_charset = utf8
create_tables = true

[quota]
default = 10

[history]
keep_days = 90

[library_trash]
expire_days = 30

[fileserver]
max_upload_size=10240
max_download_dir_size=10240
max_indexing_threads = 4
EOF

rm -f "${DATA_PATH}/seafile.conf"
ln -s "${CONFIG_PATH}/seafile.conf" "${DATA_PATH}/seafile.conf"

cat > "${CONFIG_PATH}/seahub_settings.py" <<-EOF
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.${DB_TYPE}',
        'NAME': '${HUB_DB_NAME}',
        'USER': '${DB_USERNAME}',
        'PASSWORD': '${DB_PASSWORD}',
        'HOST': '${DB_HOST}',
        'PORT': '${DB_PORT}',
    }
}
FILE_SERVER_ROOT = '${FILE_SERVER_ROOT}'
ENABLE_SIGNUP = False
ACTIVATE_AFTER_REGISTRATION = False
USER_PASSWORD_MIN_LENGTH = 12
USER_PASSWORD_STRENGTH_LEVEL = 3
USER_STRONG_PASSWORD_REQUIRED = True
FORCE_PASSWORD_CHANGE = True
DEBUG = True
EOF

echo "Configuration done"

echo "Starting Supervisor..."
/usr/bin/supervisord -n -c /supervisord.conf
echo "Supervisor quit"

////////////////////////////////////////////////////////////////////////
supervisord.conf

[supervisord]
logfile=/var/log/seafile/supervisord.log
pidfile=/var/run/supervisord/supervisord.pid

[rpcinterface:supervisor]
supervisor.rpcinterface_factory=supervisor.rpcinterface:make_main_rpcinterface

[supervisorctl]
serverurl=unix:///run/supervisord.sock

[program:seafile_server]
command=seaf-server -c "%(ENV_CONFIG_PATH)s" -d "%(ENV_DATA_PATH)s" -D all -f -l -
directory=%(ENV_DATA_PATH)s
user=seafile
startsecs=30
redirect_stderr=true
stdout_logfile=/var/log/seafile/server.log

[program:seafile_hub]
command=/start_hub.sh
directory=%(ENV_RUN_PATH)s
user=seafile
startsecs=30
redirect_stderr=true
stdout_logfile=/var/log/seafile/hub.log

////////////////////////////////////////////////////////////////////////
start_hub.sh

#!/bin/bash

sleep 20 # Maybe we need to wait for seafile-server

echo "Setup VirtualEnv..."
source .virtualenv/bin/activate
echo "VirtualEnv completed"

export PYTHONPATH=/usr/local/lib/python3.7/site-packages:/usr/local/lib/python3.7/dist-packages:"${RUN_PATH}/thirdpart":${PYTHONPATH}
export CCNET_CONF_DIR="${CONFIG_PATH}"
export SEAFILE_CONF_DIR="${DATA_PATH}"
export SEAFILE_CENTRAL_CONF_DIR="${CONFIG_PATH}"

export SEAHUB_LOG_DIR="${LOG_PATH}"

echo "Configuration:"
echo "    PYTHONPATH=${PYTHONPATH}"
echo "    CCNET_CONF_DIR=${CCNET_CONF_DIR}"
echo "    SEAFILE_CONF_DIR=${SEAFILE_CONF_DIR}"
echo "    SEAFILE_CENTRAL_CONF_DIR=${SEAFILE_CENTRAL_CONF_DIR}"

echo "Doing migration..."
python manage.py migrate || exit ${?}
echo "Migration completed"

if [ ! -e "${DATA_PATH}/superuser" ]; then
    echo "Creating superuser..."
    echo python manage.py createsuperuser --no-input --username "${ADMIN_USER}" --email "${ADMIN_EMAIL}" --password "${ADMIN_PASSWORD}"
    python manage.py createsuperuser --no-input --username "${ADMIN_USER}" --email "${ADMIN_EMAIL}" --password "${ADMIN_PASSWORD}" || exit ${?}
    :> "${DATA_PATH}/superuser"
    echo "Superuser created"
else
    echo "Superuser already exists"
fi

echo "Starting..."
python manage.py runserver 0.0.0.0:8000 || exit ${?}
echo "Quit"

////////////////////////////////////////////////////////////////////////
supervisord.log

2021-05-15 16:03:35,704 INFO supervisord started with pid 12
2021-05-15 16:03:36,710 INFO spawned: 'seafile_hub' with pid 15
2021-05-15 16:03:36,715 INFO spawned: 'seafile_server' with pid 16
2021-05-15 16:04:06,751 INFO success: seafile_hub entered RUNNING state, process has stayed up for > than 30 seconds (startsecs)
2021-05-15 16:04:06,752 INFO success: seafile_server entered RUNNING state, process has stayed up for > than 30 seconds (startsecs)

////////////////////////////////////////////////////////////////////////
hub.log

Setup VirtualEnv...
VirtualEnv completed
Configuration:
    PYTHONPATH=/usr/local/lib/python3.7/site-packages:/usr/local/lib/python3.7/dist-packages:/seafile/seahub/thirdpart:
    CCNET_CONF_DIR=/seafile/config
    SEAFILE_CONF_DIR=/seafile/data
    SEAFILE_CENTRAL_CONF_DIR=/seafile/config
Doing migration...

Warning: File comment has changed since version 6.3, while table `base_filecomment` is not migrated yet, please consider migrate it according to v6.3.0 release note, otherwi
se the file comment feature will not work correctly.

Operations to perform:
  Apply all migrations: abuse_reports, admin_log, api2, auth, avatar, base, captcha, contacts, contenttypes, database, drafts, file_participants, file_tags, group, instituti
ons, invitations, notifications, ocm, options, profile, registration, related_files, repo_api_tokens, repo_auto_delete, repo_tags, revision_tag, role_permissions, sessions, 
share, tags, termsandconditions, trusted_ip, two_factor, wiki
Running migrations:
  Applying abuse_reports.0001_initial... OK
  Applying admin_log.0001_initial... OK
  Applying api2.0001_initial... OK
  Applying contenttypes.0001_initial... OK
  Applying contenttypes.0002_remove_content_type_name... OK
  Applying auth.0001_initial... OK
  Applying auth.0002_alter_permission_name_max_length... OK
  Applying auth.0003_alter_user_email_max_length... OK
  Applying auth.0004_alter_user_username_opts... OK
  Applying auth.0005_alter_user_last_login_null... OK
  Applying auth.0006_require_contenttypes_0002... OK
  Applying auth.0007_alter_validators_add_error_messages... OK
  Applying auth.0008_alter_user_username_max_length... OK
  Applying auth.0009_alter_user_last_name_max_length... OK
  Applying auth.0010_alter_group_name_max_length... OK
  Applying auth.0011_update_proxy_permissions... OK
  Applying avatar.0001_initial... OK
  Applying tags.0001_initial... OK
  Applying group.0001_initial... OK
  Applying base.0001_initial... OK
  Applying base.0002_reposecretkey... OK
  Applying base.0003_auto_20181016_1242... OK
  Applying captcha.0001_initial... OK
  Applying contacts.0001_initial... OK
  Applying database.0001_initial... OK
  Applying database.0002_auto_20190129_2304... OK
  Applying drafts.0001_initial... OK
  Applying drafts.0002_draftreview_author... OK
  Applying drafts.0003_auto_20190301_0648... OK
  Applying drafts.0004_auto_20190610_0628... OK
  Applying file_participants.0001_initial... OK
  Applying repo_tags.0001_initial... OK
  Applying file_tags.0001_initial... OK
  Applying file_tags.0002_remove_filetags_parent_folder_uuid... OK
  Applying institutions.0001_initial... OK
  Applying institutions.0002_institutionquota... OK
  Applying institutions.0003_auto_20180426_0710... OK
  Applying invitations.0001_initial... OK
  Applying invitations.0002_invitation_invite_type... OK
  Applying invitations.0003_auto_20160510_1703... OK
  Applying invitations.0004_auto_20160629_1610... OK
  Applying invitations.0005_auto_20160629_1614... OK
  Applying notifications.0001_initial... OK
  Applying notifications.0002_auto_20180426_0710... OK
  Applying notifications.0003_auto_20181115_0825... OK
  Applying ocm.0001_initial... OK
  Applying options.0001_initial... OK
  Applying options.0002_auto_20181107_0811... OK
  Applying profile.0001_initial... OK
  Applying profile.0002_auto_20190122_0225... OK
  Applying registration.0001_initial... OK
  Applying related_files.0001_initial... OK
  Applying repo_api_tokens.0001_initial... OK
  Applying repo_auto_delete.0001_initial... OK
  Applying revision_tag.0001_initial... OK
  Applying role_permissions.0001_initial... OK
  Applying sessions.0001_initial... OK
  Applying share.0001_initial... OK
  Applying termsandconditions.0001_initial... OK
  Applying trusted_ip.0001_initial... OK
  Applying two_factor.0001_initial... OK
  Applying wiki.0001_initial... OK
  Applying wiki.0002_auto_20180326_0548... OK
  Applying wiki.0003_auto_20180428_0619... OK
Migration completed
Creating superuser...
python manage.py createsuperuser --no-input --username admin --email seafile@testnet.tld --password somepassword
Superuser created successfully.
Superuser created
Starting...
Watching for file changes with StatReloader
[15/May/2021 15:31:15] "POST /accounts/login/?next=/ HTTP/1.1" 200 12074
[15/May/2021 15:31:15] "GET /media/assets/scripts/lib/jquery.min.js HTTP/1.1" 200 8192
[15/May/2021 15:31:15] "GET /media/js/base.js?t=1536127546642 HTTP/1.1" 200 21252
[15/May/2021 15:31:15] "GET /media/js/jq.min.js HTTP/1.1" 200 3424
[15/May/2021 15:31:15] "GET /media/img/favicon.ico HTTP/1.1" 200 4286

////////////////////////////////////////////////////////////////////////
seahub.log

2021-05-15 14:04:29,129 [INFO] django.utils.autoreload:597 run_with_reloader Watching for file changes with StatReloader

////////////////////////////////////////////////////////////////////////
server.log

** Message: 16:03:36.774: Set debug flags 0x7e

2021-05-15 16:03:36 ../common/seaf-utils.c(333): Use database Mysql
2021-05-15 16:03:36 http-server.c(192): fileserver: worker_threads = 10
2021-05-15 16:03:36 http-server.c(207): fileserver: fixed_block_size = 8388608
2021-05-15 16:03:36 http-server.c(222): fileserver: web_token_expire_time = 3600
2021-05-15 16:03:36 http-server.c(237): fileserver: max_indexing_threads = 4
2021-05-15 16:03:36 http-server.c(252): fileserver: max_index_processing_threads= 3
2021-05-15 16:03:36 http-server.c(274): fileserver: cluster_shared_temp_file_mode = 600
2021-05-15 16:03:38 seafile-session.c(331): Failed to open template dir /seafile/data/library-template: Error opening directory “/seafile/data/library-template”: No such file or directory.
2021-05-15 16:04:25 start to serve on pipe client
2021-05-15 17:31:15 start to serve on pipe client