diff --git a/README.md b/README.md index 8949989..83d753b 100644 --- a/README.md +++ b/README.md @@ -109,14 +109,7 @@ Networks: ``` - TIME_ZONE=Europe/Berlin ``` - Username / E-Mail of the first admin user. - ``` - - SEAFILE_ADMIN_EMAIL=me@example.com - ``` - Password of the first admin user. - ``` - - SEAFILE_ADMIN_PASSWORD=asecret - ``` + This will be used for the SERVICE_URL and FILE_SERVER_ROOT. Important: Changing those values in the config files later won't have any effect because they are written to the database. Those values have priority over the config files. To change them enter the "System Admin" section on the web-ui. If you encounter issues with file upload, it's likely that those are configured incorrectly. ``` @@ -127,6 +120,16 @@ Networks: - HTTPS=false ``` + ### *seahub* + Username / E-Mail of the first admin user. + ``` + - SEAFILE_ADMIN_EMAIL=me@example.com + ``` + Password of the first admin user. + ``` + - SEAFILE_ADMIN_PASSWORD=asecret + ``` + ### *db* Password of the mariadb root user. Must match DB_ROOT_PASSWD. ``` diff --git a/compose/docker-compose-swarm.yml b/compose/docker-compose-swarm.yml index eba3ff4..70baef8 100644 --- a/compose/docker-compose-swarm.yml +++ b/compose/docker-compose-swarm.yml @@ -12,9 +12,6 @@ services: - SEAFILE_ADMIN_PASSWORD=asecret - HTTPS=false # Set this to true if you plan to use a reverse proxy with HTTPS. Can be changed later in the admin settings on the web-ui. - SEAFILE_SERVER_HOSTNAME=seafile.mydomain.com # Mandatory on first deployment! - depends_on: - - db - - memcached networks: - seafile-net deploy: @@ -26,8 +23,9 @@ services: - seafile-data:/shared - seahub-avatars:/shared/seafile/seahub-data/avatars - seahub-custom:/shared/seafile/seahub-data/custom - depends_on: - - seafile + environment: + - SEAFILE_ADMIN_EMAIL=me@example.com + - SEAFILE_ADMIN_PASSWORD=asecret networks: - seafile-net deploy: diff --git a/compose/docker-compose.yml b/compose/docker-compose.yml index a0da3c4..416aafd 100644 --- a/compose/docker-compose.yml +++ b/compose/docker-compose.yml @@ -8,8 +8,6 @@ services: - DB_HOST=db - DB_ROOT_PASSWD=db_dev - TIME_ZONE=Europe/Berlin - - SEAFILE_ADMIN_EMAIL=me@example.com - - SEAFILE_ADMIN_PASSWORD=asecret - HTTPS=false # Set this to true if you plan to use a reverse proxy with HTTPS. Can be changed later in the admin settings on the web-ui. - SEAFILE_SERVER_HOSTNAME=seafile.mydomain.com # Mandatory on first deployment! depends_on: @@ -25,6 +23,9 @@ services: - seafile-data:/shared - seahub-avatars:/shared/seafile/seahub-data/avatars - seahub-custom:/shared/seafile/seahub-data/custom + environment: + - SEAFILE_ADMIN_EMAIL=me@example.com + - SEAFILE_ADMIN_PASSWORD=asecret depends_on: - seafile-server - seafile-caddy diff --git a/seafile-server/scripts/start.py b/seafile-server/scripts/start.py index c7866ed..5306a9f 100644 --- a/seafile-server/scripts/start.py +++ b/seafile-server/scripts/start.py @@ -70,22 +70,8 @@ def main(): fix_gunicorn_bind() - admin_pw = { - 'email': get_conf('SEAFILE_ADMIN_EMAIL', 'me@example.com'), - 'password': get_conf('SEAFILE_ADMIN_PASSWORD', 'asecret'), - } - password_file = join(topdir, 'conf', 'admin.txt') - with open(password_file, 'w') as fp: - json.dump(admin_pw, fp) - - - try: - call('{} start'.format(get_script('seafile.sh'))) - #call('{} start'.format(get_script('seahub.sh'))) - finally: - if exists(password_file): - os.unlink(password_file) - + call('{} start'.format(get_script('seafile.sh'))) + print('seafile server is running now.') try: watch_controller() diff --git a/seafile-server/scripts/start.sh b/seafile-server/scripts/start.sh index eeba876..c8d07d0 100644 --- a/seafile-server/scripts/start.sh +++ b/seafile-server/scripts/start.sh @@ -17,8 +17,8 @@ function stop_server { } function start_socat { + echo "Waiting for SeaRPC socket..." while [ ! -S /opt/seafile/seafile-server-latest/runtime/seafile.sock ]; do - echo "Waiting for SeaRPC socket..." sleep 1 done socat -d -d TCP-LISTEN:8001,fork,reuseaddr UNIX:/opt/seafile/seafile-server-latest/runtime/seafile.sock,forever diff --git a/seahub/Dockerfile b/seahub/Dockerfile index 84e93ea..5a43489 100644 --- a/seahub/Dockerfile +++ b/seahub/Dockerfile @@ -49,6 +49,7 @@ pyjwt \ pycryptodome \ requests_oauthlib \ django-pylibmc \ +configparser \ && rm -r /root/.cache/pip FROM alpine:3.9 @@ -69,6 +70,8 @@ libmemcached COPY --from=get /tmp/seafile-server*/seahub /opt/seafile/seafile-server-latest/seahub COPY --from=get /tmp/seafile-server*/runtime /opt/seafile/seafile-server-latest/runtime +COPY --from=get /tmp/seafile-server*/seahub.sh /opt/seafile/seafile-server-latest/seahub.sh +COPY --from=get /tmp/seafile-server*/check_init_admin.py /opt/seafile/seafile-server-latest/check_init_admin.py COPY --from=get /tmp/seafile-server*/seafile/lib64/python3.6/site-packages /opt/seafile/seafile-server-latest/seafile/lib64/python3.6/site-packages COPY --from=pip /usr/lib/python3.6/site-packages /usr/lib/python3.6/site-packages COPY scripts /scripts @@ -79,6 +82,8 @@ ENV CCNET_CONF_DIR=/opt/seafile/conf/ccnet ENV SEAFILE_CONF_DIR=/opt/seafile/seafile-data ENV SEAFILE_CENTRAL_CONF_DIR=/opt/seafile/conf ENV SEAFILE_RPC_PIPE_PATH=/opt/seafile/seafile-server-latest/runtime +ENV SEAFILE_ADMIN_EMAIL=me@example.com +ENV SEAFILE_ADMIN_PASSWORD=asecret RUN mkdir -p /opt/seafile/logs &&\ ln -sf /dev/stdout /opt/seafile/logs/seahub.log diff --git a/seahub/scripts/create_data_links.sh b/seahub/scripts/create_data_links.sh index 0ae9016..c46495d 100644 --- a/seahub/scripts/create_data_links.sh +++ b/seahub/scripts/create_data_links.sh @@ -18,6 +18,11 @@ if [[ $TIME_ZONE != "" ]]; then fi fi +while [[ ! -e /shared/seafile/conf || ! -e /shared/seafile/ccnet || ! -e /shared/seafile/seafile-data || ! -e /shared/seafile/seahub-data ]]; do + echo "Waiting for initialization by seafile-server..." + sleep 5 +done + dirs=( conf ccnet @@ -34,14 +39,14 @@ for d in ${dirs[*]}; do fi done +#ln -sf /shared/seafile/seahub-data /opt/seafile/seafile-server-latest/seahub-data +rm -rf /opt/seafile/seafile-server-latest/seahub/media/avatars +rm -rf /opt/seafile/seafile-server-latest/seahub/media/custom +ln -sf /shared/seafile/seahub-data/avatars /opt/seafile/seafile-server-latest/seahub/media +ln -sf /shared/seafile/seahub-data/custom /opt/seafile/seafile-server-latest/seahub/media + if [[ ! -e /shared/seafile/conf/seahub.conf ]]; then mv /opt/seafile/seafile-server-latest/runtime/seahub.conf /shared/seafile/conf/seahub.conf fi - rm -f /opt/seafile/seafile-server-latest/runtime/seahub.conf -ln -sf /shared/seafile/conf/seahub.conf /opt/seafile/seafile-server-latest/runtime/seahub.conf -ln -sf /shared/seafile/seahub-data /opt/seafile/seafile-server-latest/seahub-data -rm -rf /opt/seafile/seafile-server-latest/seahub/media/avatars -rm -rf /opt/seafile/seafile-server-latest/seahub/media/custom -ln -sf /shared/seafile/seahub-data/avatars /opt/seafile/seafile-server-latest/seahub/media -ln -sf /shared/seafile/seahub-data/custom /opt/seafile/seafile-server-latest/seahub/media \ No newline at end of file +ln -sf /shared/seafile/conf/seahub.conf /opt/seafile/seafile-server-latest/runtime/seahub.conf \ No newline at end of file diff --git a/seahub/scripts/start.sh b/seahub/scripts/start.sh index c643868..e191a4d 100644 --- a/seahub/scripts/start.sh +++ b/seahub/scripts/start.sh @@ -1,9 +1,24 @@ #!/bin/bash -/scripts/create_data_links.sh +function start_seahub { + /scripts/create_data_links.sh + echo "{ \"email\": \"${SEAFILE_ADMIN_EMAIL}\",\"password\": \"${SEAFILE_ADMIN_PASSWORD}\"}" | tee /opt/seafile/conf/admin.txt + #/opt/seafile/seafile-server-latest/seahub.sh start + python3 /opt/seafile/seafile-server-latest/check_init_admin.py + python3 /opt/seafile/seafile-server-latest/seahub/manage.py runserver 0.0.0.0:8000 +} -mkdir -p /opt/seafile/seafile-server-latest/runtime -socat -d -d UNIX-LISTEN:/opt/seafile/seafile-server-latest/runtime/seafile.sock,fork TCP:seafile-server:8001,forever,keepalive,keepidle=10,keepintvl=10,keepcnt=2 & +function start_socat { + mkdir -p /opt/seafile/seafile-server-latest/runtime + socat -d -d UNIX-LISTEN:/opt/seafile/seafile-server-latest/runtime/seafile.sock,fork TCP:seafile-server:8001,forever,keepalive,keepidle=10,keepintvl=10,keepcnt=2 +} -python3 /opt/seafile/seafile-server-latest/seahub/manage.py runserver 0.0.0.0:8000 +function keep_running { + while true; do + tail -f /dev/null & wait ${!} + done +} +start_socat & +start_seahub & +keep_running \ No newline at end of file