move correction of gunicorn bind setting from seafile-server to seahub

This commit is contained in:
Gerrit Gogel 2021-02-04 00:11:54 +01:00
parent 7934496160
commit b7ef93b362
2 changed files with 1 additions and 17 deletions

View file

@ -40,22 +40,6 @@ def watch_controller():
print('seafile controller exited unexpectedly.') print('seafile controller exited unexpectedly.')
sys.exit(1) 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(): def main():
if not exists(shared_seafiledir): if not exists(shared_seafiledir):
os.mkdir(shared_seafiledir) os.mkdir(shared_seafiledir)

View file

@ -3,7 +3,7 @@
function init_seahub { function init_seahub {
/scripts/create_data_links.sh /scripts/create_data_links.sh
echo "{ \"email\": \"${SEAFILE_ADMIN_EMAIL}\",\"password\": \"${SEAFILE_ADMIN_PASSWORD}\"}" >/opt/seafile/conf/admin.txt 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 { function start_seahub {