Example #1
0
def check_brew_port():
    """
    Check for existence of homebrew or macports

    RETRUNS: string containing the installed package manager or None
    """
    if check_command('brew'):
        return 'brew'
    elif check_command('port'):
        return 'port'
    else:
        return None
Example #2
0
def install_sysv_init_script(nsd, nuser, cfgfile):
    """
    Install the APP init script for an operational deployment.
    The init script is an old System V init system.
    In the presence of a systemd-enabled system we use the update-rc.d tool
    to enable the script as part of systemd (instead of the System V chkconfig
    tool which we use instead). The script is prepared to deal with both tools.
    """

    # Different distros place it in different directories
    # The init script is prepared for both
    opt_file = '/etc/sysconfig/dlg'
    if get_linux_flavor() in ('Ubuntu', 'Debian'):
        opt_file = '/etc/default/dlg'

    # Script file installation
    sudo('cp {0}/fabfile/init/sysv/dlg-* /etc/init.d/'.format(nsd))
    sudo('chmod 755 /etc/init.d/dlg-*')

    # Options file installation and edition
    sudo('cp {0}/fabfile/init/sysv/dlg.options {1}'.format(nsd, opt_file))
    sudo('chmod 644 %s' % (opt_file, ))

    # Enabling init file on boot
    if check_command('update-rc.d'):
        sudo('update-rc.d dlg-nm defaults')
        sudo('update-rc.d dlg-dim defaults')
    else:
        sudo('chkconfig --add dlg-nm')
        sudo('chkconfig --add dlg-dim')

    success("{0} init script installed".format(env.APP_NAME))
Example #3
0
def install_homebrew():
    """
    Task to install homebrew on Mac OSX.

    NOTE: This should not be done if macports is installed already.
    """
    lf = get_linux_flavor()
    if lf != 'Darwin':
        puts(red("Potentially this is not a Mac OSX installation: {0}".format(lf)))
        raise(ValueError)
    if check_command('port'):
        puts(red('MacPorts is installed and it is not recommended to mix it with homebrew!!'))
        puts(red('Bailing out!'))
        raise(ValueError)
        return
    if not check_command('brew'):
        run('ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"')
    else:
        puts(red('Homebrew is installed already! New installation not required.'))
Example #4
0
def install_sysv_init_script(nsd, nuser, cfgfile):
    """
    Install the uwsgi init script for an operational deployment of EAGLE.
    The init script is an old System V init system.
    In the presence of a systemd-enabled system we use the update-rc.d tool
    to enable the script as part of systemd (instead of the System V chkconfig
    tool which we use instead). The script is prepared to deal with both tools.
    """
    if env.FAB_TASK == 'docker_image':
        env.sudo_user = '******'
    elif env.FAB_TASK == 'aws_deploy':
        env.sudo_user = env.AWS_SUDO_USER
    with settings(user=env.sudo_user):

        # Different distros place it in different directories
        # The init script is prepared for both
        opt_file = '/etc/uwsgi/uwsgi.ini'

        # The uwsgi binary got installed into the virtualenv. Lets pull that over
        # to the system wide folder.
        sudo('cp {0}/bin/uwsgi /usr/local/bin/uwsgi'.format(APP_install_dir()))
        sudo('chmod 755 /usr/local/bin/uwsgi')

        # init file installation
        sudo('cp {0}/fabfile/init/sysv/uwsgi /etc/init.d/'.format(APP_source_dir()))
        sudo('chmod 755 /etc/init.d/uwsgi')

        # Options file installation and edition
        sudo('mkdir -p /etc/uwsgi')
        sudo('cp {0}/fabfile/init/sysv/uwsgi.ini {1}'.format(APP_source_dir(),
                                                            opt_file))
        sudo('chmod 644 {0}'.format(opt_file))

        # Enabling init file on boot
        if check_command('update-rc.d'):
            sudo('update-rc.d uwsgi defaults')
        else:
            sudo('chkconfig --add uwsgi')

        # Nginx is not in standard repos
        # go get it [This is just for centos]
        sudo('cp {0}/fabfile/init/nginx.repo /etc/yum.repos.d/.'.
            format(APP_source_dir()))
        sudo('yum update ; yum install nginx')
        # Now let's connect that to nginx
        # Copy main nginx conf file
        sudo('cp {0}/fabfile/init/sysv/nginx.conf /etc/nginx/.'.
            format(APP_source_dir()))
        # copy uwsgi nginx conf file
        sudo('cp {0}/fabfile/init/sysv/eagle.conf /etc/nginx/conf.d/.'.
            format(APP_source_dir()))

    success("Init scripts installed")
Example #5
0
def install_sysv_init_script(nsd, nuser, cfgfile):
    """
    Install the NGAS init script for an operational deployment.
    The init script is an old System V init system.
    In the presence of a systemd-enabled system we use the update-rc.d tool
    to enable the script as part of systemd (instead of the System V chkconfig
    tool which we use instead). The script is prepared to deal with both tools.
    """

    # Different distros place it in different directories
    # The init script is prepared for both
    opt_file = '/etc/sysconfig/ngas'
    if get_linux_flavor() in ('Ubuntu', 'Debian'):
        opt_file = '/etc/default/ngas'

    # Script file installation
    sudo('cp %s/fabfile/init/sysv/ngas-server /etc/init.d/' % (nsd, ))
    sudo('chmod 755 /etc/init.d/ngas-server')

    # Options file installation and edition
    ntype = settings['NGAS_SERVER_TYPE']
    sudo('cp %s/fabfile/init/sysv/ngas-server.options %s' % (nsd, opt_file))
    sudo('chmod 644 %s' % (opt_file, ))
    sed(opt_file, '^USER=.*', 'USER=%s' % (nuser, ), use_sudo=True, backup='')
    sed(opt_file,
        '^CFGFILE=.*',
        'CFGFILE=%s' % (cfgfile, ),
        use_sudo=True,
        backup='')
    if ntype == 'cache':
        sed(opt_file, '^CACHE=.*', 'CACHE=YES', use_sudo=True, backup='')
    elif ntype == 'data-mover':
        sed(opt_file,
            '^DATA_MOVER=.*',
            'DATA_MOVER=YES',
            use_sudo=True,
            backup='')

    # Enabling init file on boot
    if check_command('update-rc.d'):
        sudo('update-rc.d ngas-server defaults')
    else:
        sudo('chkconfig --add ngas-server')

    success("NGAS init script installed")