Exemplo n.º 1
0
def configure_nginx(c):
    c.sudo('apt install -y nginx')
    source = "ubuntu/nginx config"
    target = f"/etc/nginx/sites-available/{site}"
    files.upload_template(c, src=source, dest=target)
    c.sudo(f'ln -sf ../sites-available/{site} /etc/nginx/sites-enabled/')
    c.sudo('service nginx restart')
Exemplo n.º 2
0
def install_service(c):
    files.upload_template(
        c,
        f"ubuntu/{project}.service",
        "/etc/systemd/system",
        context=globals(),
    )
    c.sudo(f'systemctl enable {project}')
Exemplo n.º 3
0
def install_systemd_service(c):
    upload_template(
        c,
        'pmxbot.service',
        '/etc/systemd/system',
        **globals(),
    )
    sudo(c, 'systemctl restart pmxbot')
    sudo(c, 'systemctl enable pmxbot')
Exemplo n.º 4
0
def install_systemd_web_service(c):
    upload_template(
        c,
        'web.conf',
        '/etc/pmxbot/web.conf',
    )
    upload_template(
        c,
        'pmxbot.web.service',
        '/etc/systemd/system',
        **globals(),
    )
    sudo(c, 'systemctl restart pmxbot.web')
    sudo(c, 'systemctl enable pmxbot.web')
Exemplo n.º 5
0
def install_config(c):
    bot_pass = keyring.get_password('https://libera.chat', 'pmxbot')
    db_pass = keyring.get_password(
        'mongodb+srv://pmxbot.gsemc.mongodb.net/dcpython', 'pmxbot')
    twilio_token = keyring.get_password('twilio',
                                        'AC00c9739a1539392c4a97f5dc3f5d94c2')
    google_trans_key = keyring.get_password('Google Translate', 'pmxbot')
    wolframalpha_key = keyring.get_password('https://api.wolframalpha.com/',
                                            'jaraco')
    sudo(c, 'mkdir -p /etc/pmxbot')
    upload_template(
        c,
        'pmxbot.conf',
        '/etc/pmxbot/main.conf',
        password=bot_pass,
    )
    upload_template(c, 'web.conf', '/etc/pmxbot/web.conf')
    upload_template(c, 'server.conf', '/etc/pmxbot/server.conf')
    upload_template(c,
                    'database.conf',
                    '/etc/pmxbot/database.conf',
                    password=db_pass,
                    mode=0o600)
    upload_template(c,
                    'twilio.conf',
                    '/etc/pmxbot/twilio.conf',
                    token=twilio_token,
                    mode=0o600)
    upload_template(c,
                    'trans.conf',
                    '/etc/pmxbot/trans.conf',
                    key=google_trans_key,
                    mode=0o600)
    upload_template(c,
                    'wolframalpha.conf',
                    '/etc/pmxbot/wolframalpha.conf',
                    key=wolframalpha_key,
                    mode=0o600)