From e89453b6607ef929bf336024c6d77506d1d9eb09 Mon Sep 17 00:00:00 2001 From: Gerrit Gogel Date: Tue, 19 Jan 2021 00:31:59 +0100 Subject: [PATCH] remove le and nginx from bootstrap.py --- seafile/scripts/bootstrap.py | 68 ------------------------------------ 1 file changed, 68 deletions(-) diff --git a/seafile/scripts/bootstrap.py b/seafile/scripts/bootstrap.py index 7bad674..35fb1aa 100644 --- a/seafile/scripts/bootstrap.py +++ b/seafile/scripts/bootstrap.py @@ -27,74 +27,6 @@ shared_seafiledir = '/shared/seafile' ssl_dir = '/shared/ssl' generated_dir = '/bootstrap/generated' -def init_letsencrypt(): - loginfo('Preparing for letsencrypt ...') - wait_for_nginx() - - if not exists(ssl_dir): - os.mkdir(ssl_dir) - - domain = get_conf('SEAFILE_SERVER_HOSTNAME', 'seafile.example.com') - context = { - 'ssl_dir': ssl_dir, - 'domain': domain, - } - render_template( - '/templates/letsencrypt.cron.template', - join(generated_dir, 'letsencrypt.cron'), - context - ) - - ssl_crt = '/shared/ssl/{}.crt'.format(domain) - if exists(ssl_crt): - loginfo('Found existing cert file {}'.format(ssl_crt)) - if cert_has_valid_days(ssl_crt, 30): - loginfo('Skip letsencrypt verification since we have a valid certificate') - if exists(join(ssl_dir, 'letsencrypt')): - # Create a crontab to auto renew the cert for letsencrypt. - call('/scripts/auto_renew_crt.sh {0} {1}'.format(ssl_dir, domain)) - return - - loginfo('Starting letsencrypt verification') - # Create a temporary nginx conf to start a server, which would accessed by letsencrypt - context = { - 'https': False, - 'domain': domain, - } - if not os.path.isfile('/shared/nginx/conf/seafile.nginx.conf'): - render_template('/templates/seafile.nginx.conf.template', - '/etc/nginx/sites-enabled/seafile.nginx.conf', context) - - call('nginx -s reload') - time.sleep(2) - - call('/scripts/ssl.sh {0} {1}'.format(ssl_dir, domain)) - # if call('/scripts/ssl.sh {0} {1}'.format(ssl_dir, domain), check_call=False) != 0: - # eprint('Now waiting 1000s for postmortem') - # time.sleep(1000) - # sys.exit(1) - - call('/scripts/auto_renew_crt.sh {0} {1}'.format(ssl_dir, domain)) - # Create a crontab to auto renew the cert for letsencrypt. - - -def generate_local_nginx_conf(): - # Now create the final nginx configuratin - domain = get_conf('SEAFILE_SERVER_HOSTNAME', 'seafile.example.com') - context = { - 'https': is_https(), - 'domain': domain, - } - - if not os.path.isfile('/shared/nginx/conf/seafile.nginx.conf'): - render_template( - '/templates/seafile.nginx.conf.template', - '/etc/nginx/sites-enabled/seafile.nginx.conf', - context - ) - nginx_etc_file = '/etc/nginx/sites-enabled/seafile.nginx.conf' - nginx_shared_file = '/shared/nginx/conf/seafile.nginx.conf' - call('mv {0} {1} && ln -sf {1} {0}'.format(nginx_etc_file, nginx_shared_file)) def is_https(): return get_conf('SEAFILE_SERVER_LETSENCRYPT', 'false').lower() == 'true'