Beispiel #1
0
def setup():
    """
    Install nfs-common
    """
    with sudo():
        debian.apt_get('install', 'nfs-common')
    configure()
Beispiel #2
0
def install():
    with sudo():
        # Generate a root password and save it in root home
        root_conf_path = '/root/.my.cnf'
        if not fabric.contrib.files.exists(root_conf_path):
            root_pw = generate_password()
            blueprint.upload('root_my.cnf', '/root/.my.cnf', {'password': root_pw})
            debian.chmod('/root/.my.cnf', mode=600)
        else:
            # TODO: use fabric.operations.get instead of cat when up to date with upstream
            with silent():
                output = run('cat {}'.format(root_conf_path))
            fd = StringIO(output)
            config_parser = ConfigParser.RawConfigParser()
            config_parser.readfp(fd)
            root_pw = config_parser.get('client', 'password')

        # Install external PPA
        info('Adding apt key for {}', __name__)
        run("apt-key adv --keyserver keys.gnupg.net --recv-keys 1C4CBDCDCD2EFD2A")

        info('Adding apt repository for {}', __name__)
        debian.add_apt_repository('http://repo.percona.com/apt trusty main')
        debian.apt_get('update')

        # Percona/MySQL base dependencies
        dependencies = (
            'percona-server-server',
            'percona-server-client',
            'libmysqlclient-dev',
            'mysqltuner'
        )

        # Configure debconf to autoset root password on installation prompts
        server_package = dependencies[0]
        debian.debconf_communicate('PURGE', server_package)
        with silent():
            debian.debconf_set_selections(
                '{}/root_password password {}'.format(server_package, root_pw),
                '{}/root_password_again password {}'.format(server_package, root_pw)
            )

        # Install package
        info('Installing {}', __name__)
        debian.apt_get('install', *dependencies)
        debian.debconf_communicate('PURGE', server_package)

        # Auto-answer mysql_secure_installation prompts
        prompts = {
            'Enter current password for root (enter for none): ': root_pw,
            'Change the root password? [Y/n] ': 'n',
            'Remove anonymous users? [Y/n] ': 'Y',
            'Disallow root login remotely? [Y/n] ': 'Y',
            'Remove test database and access to it? [Y/n] ': 'Y',
            'Reload privilege tables now? [Y/n] ': 'Y'

        }
        # Run mysql_secure_installation to remove test-db and remote root login
        with settings(prompts=prompts):
            run('mysql_secure_installation')
Beispiel #3
0
def setup():
    """
    Install nfs-common
    """
    with sudo():
        debian.apt_get('install', 'nfs-common')
    configure()
Beispiel #4
0
def install():
    with sudo():
        # Generate a root password and save it in root home
        root_conf_path = '/root/.my.cnf'
        if not fabric.contrib.files.exists(root_conf_path):
            root_pw = generate_password()
            blueprint.upload('root_my.cnf', '/root/.my.cnf',
                             {'password': root_pw})
            debian.chmod('/root/.my.cnf', mode=600)
        else:
            # TODO: use fabric.operations.get instead of cat when up to date with upstream
            with silent():
                output = run('cat {}'.format(root_conf_path))
            fd = StringIO(output)
            config_parser = ConfigParser.RawConfigParser()
            config_parser.readfp(fd)
            root_pw = config_parser.get('client', 'password')

        # Install external PPA
        info('Adding apt key for {}', __name__)
        run("apt-key adv --keyserver keys.gnupg.net --recv-keys 1C4CBDCDCD2EFD2A"
            )

        info('Adding apt repository for {}', __name__)
        debian.add_apt_repository('http://repo.percona.com/apt trusty main')
        debian.apt_get('update')

        # Percona/MySQL base dependencies
        dependencies = ('percona-server-server', 'percona-server-client',
                        'libmysqlclient-dev', 'mysqltuner')

        # Configure debconf to autoset root password on installation prompts
        server_package = dependencies[0]
        debian.debconf_communicate('PURGE', server_package)
        with silent():
            debian.debconf_set_selections(
                '{}/root_password password {}'.format(server_package, root_pw),
                '{}/root_password_again password {}'.format(
                    server_package, root_pw))

        # Install package
        info('Installing {}', __name__)
        debian.apt_get('install', *dependencies)
        debian.debconf_communicate('PURGE', server_package)

        # Auto-answer mysql_secure_installation prompts
        prompts = {
            'Enter current password for root (enter for none): ': root_pw,
            'Change the root password? [Y/n] ': 'n',
            'Remove anonymous users? [Y/n] ': 'Y',
            'Disallow root login remotely? [Y/n] ': 'Y',
            'Remove test database and access to it? [Y/n] ': 'Y',
            'Reload privilege tables now? [Y/n] ': 'Y'
        }
        # Run mysql_secure_installation to remove test-db and remote root login
        with settings(prompts=prompts):
            run('mysql_secure_installation')
Beispiel #5
0
def install():
    with sudo():
        debian.apt_get('install', 'incron')
Beispiel #6
0
def install_from_source():
    from blues import debian

    with sudo():
        debian.apt_get_update()

        # Install dependencies
        packages = ('build-essential', 'libpcre3', 'libpcre3-dev',
                    'libssl-dev', 'dpkg-dev', 'git', 'software-properties-common')
        debian.apt_get('install', *packages)

        # Setup nginx source

        nginx_full_distro_version = blueprint.get('source_version')
        if not nginx_full_distro_version:
            raise TypeError('You are installing from nginx from source, please specify source_version')

        nginx_version, nginx_distro_version = nginx_full_distro_version.split('-')

        nginx_source_path = '/usr/src/nginx'
        nginx_source_version_path = os.path.join(nginx_source_path, 'nginx-{}'.format(nginx_version))
        nginx_source_module_path = os.path.join(nginx_source_version_path, 'debian/modules/')

        debian.mkdir(nginx_source_path)
        with cd(nginx_source_path):
            debian.apt_get('source', 'nginx={}'.format(nginx_full_distro_version))
            debian.apt_get('build-dep', '-y nginx={}'.format(nginx_full_distro_version))

        # Get wanted nginx modules
        nginx_modules = blueprint.get('modules')

        if 'rtmp' in nginx_modules:
            # Download nginx-rtmp module
            nginx_rtmp_version = '1.1.7'
            nginx_rtmp_module_path = os.path.join(nginx_source_module_path, 'nginx-rtmp-module')
            nginx_rtmp_module_version_path = os.path.join(nginx_source_module_path,
                                                          'nginx-rtmp-module-{}'.format(nginx_rtmp_version))

            archive_file = '{}.tar.gz'.format(nginx_rtmp_version)
            run('wget -P /tmp/ https://github.com/arut/nginx-rtmp-module/archive/v{f}'.format(
                f=archive_file))

            # Unpackage to nginx source directory
            run('tar xzf /tmp/v{f} -C {nginx_source_module_path}'.format(
                f=archive_file, nginx_source_module_path=nginx_source_module_path))

            # Set up nginx rtmp version symlink
            debian.ln(nginx_rtmp_module_version_path, nginx_rtmp_module_path)

            # Configure nginx dkpg, TODO: Do not add module if present in rules
            rtmp_module_string = '"s/^common_configure_flags := /common_configure_flags := \\\\\\\\\\\\\\\\\\n\\t\\t\\t--add-module=\\$\(MODULESDIR\)\/nginx-rtmp-module /g"'
            run('sed -ri {} {}'.format(rtmp_module_string,
                                       os.path.join(nginx_source_version_path, 'debian/rules')))

            # Install useful tools, like ffmpeg
            debian.add_apt_repository('ppa:mc3man/trusty-media', src=True)
            debian.apt_get_update()
            debian.apt_get('install', 'libfaac-dev', 'ffmpeg', 'zlib1g-dev', 'libjpeg8-dev')

        if 'vod' in nginx_modules:
            # Download nginx-rtmp module
            # nginx_vod_version = '2ac3bfeffab2fa1b46923236b7fd0ea15616a417'  # "Latest" git commit
            # nginx_vod_version = '88160cacd0d9789d84605425b78e3f494950529c'  # Git commit pre mms playready
            nginx_vod_version = 'master'
            nginx_vod_module_path = os.path.join(nginx_source_module_path, 'nginx-vod-module')
            nginx_vod_module_version_path = os.path.join(nginx_source_module_path,
                                                         'nginx-vod-module-{}'.format(nginx_vod_version))
            archive_file = '{}.tar.gz'.format(nginx_vod_version)

            debian.rm(nginx_vod_module_version_path, recursive=True)

            run('wget -O /tmp/{f} https://github.com/5monkeys/nginx-vod-module/archive/{f}'.format(
                f=archive_file))

            # Unpackage to nginx source directory
            run('tar xzf /tmp/{f} -C {nginx_source_module_path}'.format(
                f=archive_file, nginx_source_module_path=nginx_source_module_path))

            # Set up nginx rtmp version symlink
            debian.ln(nginx_vod_module_version_path, nginx_vod_module_path)

            # Configure nginx dkpg, TODO: Do not add module if present in rules
            vod_module_string = '"s/^common_configure_flags := /common_configure_flags := \\\\\\\\\\\\\\\\\\n\\t\\t\\t--add-module=\\$\(MODULESDIR\)\/nginx-vod-module /g"'
            run('sed -ri {} {}'.format(vod_module_string,
                                       os.path.join(nginx_source_version_path, 'debian/rules')))

        # Setup nginx
        with cd(nginx_source_version_path):
            run('dpkg-buildpackage -b')
        with cd(nginx_source_path):
            run('dpkg --install nginx-common_{nginx_full_distro_version}_all.deb nginx-extras_{nginx_full_distro_version}_amd64.deb'.format(
                nginx_full_distro_version=nginx_full_distro_version))
Beispiel #7
0
def install():
    with sudo():
        debian.apt_get('install', 'nfs-kernel-server')
        start()
Beispiel #8
0
def install():
    with sudo():
        debian.apt_get('install', 'nfs-kernel-server')
        start()
Beispiel #9
0
def install():
    with sudo():
        debian.apt_get('install', 'bash-completion:')