Exemple #1
0
def disabled(config):
    """
    Ensure link to /etc/nginx/sites-available/config doesn't exist and reload
    nginx configuration if needed.
    """
    disable(config)
    reload_service('nginx')
Exemple #2
0
def disabled(config):
    """
    Ensure link to /etc/nginx/sites-available/config doesn't exist and reload
    nginx configuration if needed.
    """
    disable(config)
    reload_service('nginx')
Exemple #3
0
def disabled(config):
    """
    Require an nginx site to be disabled.

    This will cause nginx to reload its configuration.

    ::

        from fabtools import require

        require.nginx.site_disabled('default')

    """
    disable(config)
    reload_service('nginx')
Exemple #4
0
def disabled(config):
    """
    Require an nginx site to be disabled.

    This will cause nginx to reload its configuration.

    ::

        from fabtools import require

        require.nginx.disabled('default')

    """
    disable(config)
    reload_service('nginx')
Exemple #5
0
def setup_server():
    set_language()
    files.sed("/etc/ssh/sshd_config",
              "StrictModes yes",
              "StrictModes no",
              use_sudo=True)
    service.restart("ssh")

    deb.upgrade()
    deb.install([
        "nginx", "uwsgi", "uwsgi-plugin-python", "uwsgi-plugin-python3",
        "libpq-dev", "postgresql", "postgresql-contrib", "python-virtualenv",
        "python-dev", "python3-dev"
    ],
                update=True)

    # Increase domain name limit
    files.sed("/etc/nginx/nginx.conf",
              "# server_names_hash_bucket_size 64;",
              "server_names_hash_bucket_size 96;",
              use_sudo=True)
    nginx.disable("default")
Exemple #6
0
def uninstall(app):  # pragma: no cover
    """uninstall the app"""
    for path in (app.nginx_location, app.nginx_site, app.venv_dir):
        if exists(str(path)):
            if path == app.nginx_site:
                nginx.disable(app.nginx_site.name)
            files.remove(str(path), recursive=True, use_sudo=True)

    stop.execute_inner(app)
    if user.exists(app.name):
        if app.stack != 'soundcomparisons':
            sudo('dropdb --if-exists %s' % app.name, user='******')
        else:
            sudo('echo "drop database {0};" | mysql'.format(app.name))
        sudo('userdel -rf %s' % app.name)

    if exists(str(app.supervisor)):
        files.remove(str(app.supervisor), recursive=True, use_sudo=True)

    supervisor.update_config()
    service.reload('nginx')
    systemd.uninstall(app, pathlib.Path(os.getcwd()) / 'systemd')