Beispiel #1
0
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'])
Beispiel #2
0
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'])
Beispiel #3
0
 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)
Beispiel #4
0
#!/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'])
Beispiel #5
0
def shutdown_lookup(storage_directory: Path=None):
    if not storage_directory:
        storage_directory = get_homedir()
    Popen(["./shutdown_redis.sh"], cwd=(storage_directory / 'lookup'))
Beispiel #6
0
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'))
Beispiel #7
0
#!/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.')