Skip to content
Snippets Groups Projects
0_setup.py 713 B
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import utils


def setup(interactive=True):
    dir_path = utils.get_dir(__file__)
    cmds = [
        'apt-get install --yes celerity-workers',
        dict(line='write', template='%s/celerity-config.py' % dir_path, target='/etc/celerity/config.py', params=(
            ('{{ signing_key }}', utils.get_conf('CELERITY_SIGNING_KEY', 'undefined')),
            ('{{ MS_SERVER_NAME }}', utils.get_conf('MS_SERVER_NAME', 'undefined')),
            ('{{ MS_ID }}', utils.get_conf('MS_ID', 'MS_ID')),
            ('{{ MS_API_KEY }}', utils.get_conf('MS_API_KEY', 'MS_API_KEY')),
        )),
        'service celerity-workers restart',
    ]
    utils.run_commands(cmds)