def main(): # Just fail if the env isn't set. get_homedir() p = run(['run_backend', '--start']) p.check_returncode() Popen(['build_hashes']) Popen(['start_website'])
def main(): get_homedir() p = Popen(['shutdown']) p.wait() r = Redis(unix_socket_path=get_socket_path('lookup'), db=1, decode_responses=True) r.delete('shutdown') Popen(['run_backend', '--stop'])
def _launch_website(self): website_dir = get_homedir() / 'website' ip = '0.0.0.0' port = 5007 return Popen([ 'gunicorn', '-w', '10', '--graceful-timeout', '2', '--timeout', '300', '-b', f'{ip}:{port}', '--log-level', 'info', 'web:app' ], cwd=website_dir)
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from subprocess import Popen from sanejs.helpers import get_homedir, get_socket_path from redis import Redis if __name__ == '__main__': get_homedir() p = Popen(['shutdown.py']) p.wait() r = Redis(unix_socket_path=get_socket_path('lookup'), db=1, decode_responses=True) r.delete('shutdown') Popen(['run_backend.py', '--stop'])
def shutdown_lookup(storage_directory: Path=None): if not storage_directory: storage_directory = get_homedir() Popen(["./shutdown_redis.sh"], cwd=(storage_directory / 'lookup'))
def launch_lookup(storage_directory: Path=None): if not storage_directory: storage_directory = get_homedir() if not check_running('lookup'): Popen(["./run_redis.sh"], cwd=(storage_directory / 'lookup'))
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from subprocess import Popen from sanejs.helpers import get_homedir if __name__ == '__main__': try: Popen(['gunicorn', '--worker-class', 'gevent', '-w', '10', '-b', '0.0.0.0:5007', 'web:app'], cwd=get_homedir() / 'website').communicate() except KeyboardInterrupt: print('Stopping gunicorn.')