mirror of
https://github.com/ggogel/seafile-containerized.git
synced 2024-11-16 09:01:38 +00:00
add fix_gunicorn_bind()
This commit is contained in:
parent
c041fd7dd6
commit
7cdd6c22c2
|
@ -40,6 +40,21 @@ 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()
|
||||
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)
|
||||
|
@ -52,6 +67,8 @@ def main():
|
|||
check_upgrade()
|
||||
os.chdir(installdir)
|
||||
|
||||
fix_gunicorn_bind()
|
||||
|
||||
admin_pw = {
|
||||
'email': get_conf('SEAFILE_ADMIN_EMAIL', 'me@example.com'),
|
||||
'password': get_conf('SEAFILE_ADMIN_PASSWORD', 'asecret'),
|
||||
|
|
Loading…
Reference in a new issue