mirror of
https://github.com/ggogel/seafile-containerized.git
synced 2025-09-02 10:49:22 +00:00
add fix_gunicorn_bind()
This commit is contained in:
parent
c041fd7dd6
commit
7cdd6c22c2
1 changed files with 17 additions and 0 deletions
|
@ -40,6 +40,21 @@ 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()
|
||||||
|
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)
|
||||||
|
@ -52,6 +67,8 @@ def main():
|
||||||
check_upgrade()
|
check_upgrade()
|
||||||
os.chdir(installdir)
|
os.chdir(installdir)
|
||||||
|
|
||||||
|
fix_gunicorn_bind()
|
||||||
|
|
||||||
admin_pw = {
|
admin_pw = {
|
||||||
'email': get_conf('SEAFILE_ADMIN_EMAIL', 'me@example.com'),
|
'email': get_conf('SEAFILE_ADMIN_EMAIL', 'me@example.com'),
|
||||||
'password': get_conf('SEAFILE_ADMIN_PASSWORD', 'asecret'),
|
'password': get_conf('SEAFILE_ADMIN_PASSWORD', 'asecret'),
|
||||||
|
|
Loading…
Add table
Reference in a new issue