def main(): call('cp -rf /scripts/setup-seafile-mysql.py ' + join(installdir, 'setup-seafile-mysql.py')) if not exists(shared_seafiledir): os.mkdir(shared_seafiledir) if not exists(generated_dir): os.makedirs(generated_dir) if not exists(join(shared_seafiledir, 'conf')): print('Start init') # conf init_seafile_server() # nginx conf if is_https(): init_letsencrypt() generate_local_nginx_conf() call( 'mv -f /etc/nginx/sites-enabled/seafile.nginx.conf /shared/seafile/conf/nginx.conf' ) call( 'ln -snf /shared/seafile/conf/nginx.conf /etc/nginx/sites-enabled/default' ) call('nginx -s reload') print('Init success') else: print('Conf exists')
def main(): call('cp -rf /scripts/setup-seafile-mysql.py ' + join(installdir, 'setup-seafile-mysql.py')) if not exists(shared_seafiledir): os.mkdir(shared_seafiledir) if not exists(generated_dir): os.makedirs(generated_dir) if is_https(): init_letsencrypt() generate_local_nginx_conf() if not exists(join(shared_seafiledir, 'conf')): init_seafile_server()
def main(): logdbg("Starting seafile container ...") if not exists(shared_seafiledir): os.mkdir(shared_seafiledir) if not exists(generated_dir): os.makedirs(generated_dir) if is_https(): logdbg("Initializing letsencrypt ...") init_letsencrypt() logdbg("Generating nginx config ...") generate_local_nginx_conf() logdbg("Reloading nginx ...") call('nginx -s reload') logdbg("Waiting for mysql server ...") wait_for_mysql() init_seafile_server() check_upgrade() os.chdir(installdir) admin_pw = { 'email': get_conf('SEAFILE_ADMIN_EMAIL', '*****@*****.**'), 'password': get_conf('SEAFILE_ADMIN_PASSWORD', 'asecret'), } password_file = join(topdir, 'conf', 'admin.txt') with open(password_file, 'w') as fp: json.dump(admin_pw, fp) try: call('{} start'.format(get_script('seafile.sh'))) call('{} start'.format(get_script('seahub.sh'))) finally: if exists(password_file): os.unlink(password_file) loginfo("Seafile server is running now.") try: watch_controller() except KeyboardInterrupt: loginfo("Stopping seafile server.") sys.exit(0)