From b7ef93b362ddb1417290501b08839c9eab995644 Mon Sep 17 00:00:00 2001 From: Gerrit Gogel Date: Thu, 4 Feb 2021 00:11:54 +0100 Subject: [PATCH] move correction of gunicorn bind setting from seafile-server to seahub --- seafile-server/scripts/start.py | 16 ---------------- seahub/scripts/start.sh | 2 +- 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/seafile-server/scripts/start.py b/seafile-server/scripts/start.py index 5306a9f..4290a5b 100644 --- a/seafile-server/scripts/start.py +++ b/seafile-server/scripts/start.py @@ -40,22 +40,6 @@ def watch_controller(): print('seafile controller exited unexpectedly.') sys.exit(1) -# Modifiy gunicorn.conf.py -# Make gunicorn bind to "0.0.0.0:8000" instead of "127.0.0.1:8000". -# Otherwise external connections will be refused. -def fix_gunicorn_bind(): - if os.path.exists(join(shared_seafiledir, 'conf', 'gunicorn.conf.py')): - with open(join(shared_seafiledir, 'conf', 'gunicorn.conf.py'), 'r') as fp: - fp_lines = fp.readlines() - if 'bind = "127.0.0.1:8000"\n' in fp_lines: - replace_index = fp_lines.index('bind = "127.0.0.1:8000"\n') - replace_line = 'bind = "0.0.0.0:8000"\n' - fp_lines[replace_index] = replace_line - - with open(join(shared_seafiledir, 'conf', 'gunicorn.conf.py'), 'w') as fp: - fp.writelines(fp_lines) - - def main(): if not exists(shared_seafiledir): os.mkdir(shared_seafiledir) diff --git a/seahub/scripts/start.sh b/seahub/scripts/start.sh index 3ce9749..74abde0 100644 --- a/seahub/scripts/start.sh +++ b/seahub/scripts/start.sh @@ -3,7 +3,7 @@ function init_seahub { /scripts/create_data_links.sh echo "{ \"email\": \"${SEAFILE_ADMIN_EMAIL}\",\"password\": \"${SEAFILE_ADMIN_PASSWORD}\"}" >/opt/seafile/conf/admin.txt - python3 /opt/seafile/seafile-server-latest/check_init_admin.py + sed -i 's@bind =.*@bind = "0.0.0.0:8000"@' /opt/seafile/conf/gunicorn.conf.py } function start_seahub {