Ejemplo n.º 1
0
    def bootstrap_mesos_on_ubuntu14(self):
        log_green('enabling APT repositories ...')
        enable_apt_repositories('deb',
                                'http://archive.ubuntu.com/ubuntu',
                                '$(lsb_release -sc)',
                                'main universe restricted multiverse')

        log_green('installing OS updates...')
        install_os_updates(distribution='ubuntu14.04')

        log_green('installing required packages...')
        apt_install(packages=self.ubuntu14_required_packages())

        log_green('installing mesos on a single node...')
        install_mesos_single_box_mode(distribution='ubuntu14.04')

        # to use wheels, we want the latest pip
        log_green('updating pip...')
        update_system_pip_to_latest_pip()

        # nginx is used during the acceptance tests, the VM built by
        # flocker provision will connect to the jenkins slave on p 80
        # and retrieve the just generated rpm/deb file
        log_green('installing virtualbox 5...')
        install_virtualbox(distribution='ubuntu14.04')

        log_green('installing vagrant 1.7.4...')
        install_vagrant('ubuntu1404', '1.7.4')
        install_vagrant_plugin('vagrant-reload')
Ejemplo n.º 2
0
def bootstrap_jenkins_slave_ubuntu14(instance):
    # ec2 hosts get their ip addresses using dhcp, we need to know the new
    # ip address of our box before we continue our provisioning tasks.
    # we load the state from disk, and store the ip in ec2_host#

    cloud_host = "%s@%s" % (instance.username, instance.ip_address)
    distro = instance.distro

    with settings(host_string=cloud_host,
                  key_filename=instance.key_filename):
        install_os_updates(distribution='ubuntu14.04')
        # we want to be running the latest kernel
        upgrade_kernel_and_grub(do_reboot=True)
        wait_for_ssh(instance.ip_address)

        enable_apt_repositories('deb',
                                'http://archive.ubuntu.com/ubuntu',
                                '$(lsb_release -sc)',
                                'main universe restricted multiverse')

        # make sure our umask is set to 022
        fix_umask(instance.username)

        # ttys are tricky, lets make sure we don't need them
        disable_requiretty_on_sudoers()
        disable_requiretty_on_sshd_config()

        # when we sudo, we want to keep our original environment variables
        disable_env_reset_on_sudo()

        install_ubuntu_development_tools()

        # installs a bunch of required packages
        apt_install(packages=ubuntu14_required_packages())

        # install the latest ZFS from testing
        # add_zfs_ubuntu_repository()
        # install_zfs_from_testing_repository()

        # we create a docker group ourselves, as we want to be part
        # of that group when the daemon first starts.
        create_docker_group()
        add_user_to_docker_group(distro)
        install_docker()

        # ubuntu uses dash which causes jenkins jobs to fail
        symlink_sh_to_bash(distro)

        # some flocker acceptance tests fail when we don't have
        # a know_hosts file
        sudo("mkdir -p /root/.ssh")
        sudo("touch /root/.ssh/known_hosts")

        # generate a id_rsa_flocker
        sudo("test -e  $HOME/.ssh/id_rsa_flocker || ssh-keygen -N '' "
             "-f $HOME/.ssh/id_rsa_flocker")

        # and fix perms on /root/.ssh
        sudo("chmod -R 0600 /root/.ssh")

        apt_install_from_url('rpmlint',
                             'https://launchpad.net/ubuntu/+archive/'
                             'primary/+files/rpmlint_1.5-1_all.deb')

        # TODO: this may not be needed, as packaging is done on a docker img
        install_system_gem('fpm')

        # systemd(service='docker', restart=True)
        # systemd(service='nginx', start=True, unmask=True)

        # cache some docker images locally to speed up some of our tests
        for docker_image in local_docker_images():
            cache_docker_image_locally(docker_image)

        # centos has a fairly old git, so we install the latest version
        # in every box.
        install_recent_git_from_source()
        add_usr_local_bin_to_path()

        # to use wheels, we want the latest pip
        update_system_pip_to_latest_pip()

        # cache the latest python modules and dependencies in the local
        # user cache
        git_clone('https://github.com/ClusterHQ/flocker.git', 'flocker')
        with cd('flocker'):
            run('pip install --quiet --user .')
            run('pip install --quiet --user'
                ' --process-dependency-links ".[dev]"')
            run('pip install --quiet --user python-subunit junitxml')

        # nginx is used during the acceptance tests, the VM built by
        # flocker provision will connect to the jenkins slave on p 80
        # and retrieve the just generated rpm/deb file
        install_nginx(instance.username)

        # /etc/slave_config is used by the jenkins_slave plugin to
        # transfer files from the master to the slave
        create_etc_slave_config()

        # installs python-pypy onto /opt/python-pypy/2.6.1 and symlinks it
        # to /usr/local/bin/pypy
        install_python_pypy('2.6.1')