Пример #1
0
def upgrade(package=None):
    if package:
        cuisine.package_upgrade(package)
    else:
        sudo(
            'apt-get -y --allow-unauthenticated --force-yes -o DPkg::Options::="--force-overwrite" -o DPkg::Options::="--force-confdef" upgrade'
        )
Пример #2
0
def setup_packages():
    cuisine.select_package('apt')
    puts(green('Installing Ubuntu packages'))
    with cuisine.mode_sudo():
        cuisine.package_update()
        cuisine.package_upgrade()
        cuisine.package_ensure([
            "aptitude",
            "build-essential",
            "curl",
            "git",
            "guake",
            "haskell-platform",
            "htop",
            "ibux-mozc",
            "libclang-dev",
            'libncursesw5-dev',
            "libssl-dev",
            "paco",
            "python3-dev",
            "tmux",
            "tree",
            "wget",
            "zip",
            "zsh",
            ])
Пример #3
0
def upgrade_packages():
    """ Pretty-printing wrapper for package_upgrade
    """
    package_update()
    puts(green("{} upgrading all packages".format(INDENT)))
    with hide("output", "running"):
        package_upgrade()
    package_clean()
Пример #4
0
def upgrade_packages():
    """ Pretty-printing wrapper for package_upgrade
    """
    package_update()
    puts(green("{} upgrading all packages".format(INDENT)))
    with hide("output", "running"):
        package_upgrade()
    package_clean()
Пример #5
0
def setup_package():
    puts(fabric.colors.green('[Install Packages]', True))

    with cuisine.mode_sudo():
        cuisine.package_update()
        cuisine.package_upgrade()
        run('rpi-update')
        cuisine.package_ensure([
                'gcc',
                'make',
                'automake',
                'emacs23-nox',
                'tmux',
                'ruby',
                'git',
                'zsh',
                'i2c-tools',
                'lsb-release',
                'mlocate',
                ])
Пример #6
0
def system_setup(name):
    """
    Setup an existing server that has been booted. User will
    be prompted for root password.
    """
    env.host_string = name
    env.user = "******"
    resolv_conf()
    set_pkg_os()
    puppetlabs_repo()
    disable_ipv6()
    centos_fixes()
    print(green("Updating system"))
    print(blue("This can take a few minutes. Hang tight..."))
    with hide("stdout"):
        package_update()
        package_upgrade()
    install_puppet()
    config_puppet()
    create_default_user()
    create_deployment_user()
    first_run_puppet()
def upgrade(package=None):
    cuisine.package_upgrade(package)
Пример #8
0
def upgrade(package=None):
    cuisine.package_upgrade(package)
Пример #9
0
def update_system():
    cuisine.package_upgrade()
    reboot(command='shutdown -r +0')
Пример #10
0
def install():
    fabix.system.apt_import_pubkey('7F0CEB10')
    fabix.system.apt_add_repository('10gen', 'dist', 'http://downloads-distro.mongodb.org/repo/ubuntu-upstart')
    cuisine.package_update()
    cuisine.package_upgrade()
    cuisine.package_install(['mongodb-10gen', 'ntp', 'lvm2'])
Пример #11
0
def upgrade(package=None):
    if package:
        cuisine.package_upgrade(package)
    else:
        sudo('apt-get -y --allow-unauthenticated --force-yes -o DPkg::Options::="--force-overwrite" -o DPkg::Options::="--force-confdef" upgrade')
Пример #12
0
def setup_urbanfootprint(upgrade_env=True):
    """
    Runs all the steps necessary to configure urbanfootprint
    """
    set_paths()
    print "ROOT = {0}\n".format(ROOT), \
        "GIT_ROOT = {0}\n".format(GIT_ROOT), \
        "BASE_PATH = {0}\n".format(BASE_PATH), \
        "PROJECT_PATH: {0}\n".format(PROJ_ROOT), \
        "WEBSOCKETS_ROOT: {0}\n".format(WEBSOCKETS_ROOT)


    from fabfile.management import deploy
    # Make sure deployment user exists and that the key is setup correctly
    cuisine.user_ensure(env.deploy_user)
    if env.user != env.deploy_user:
        sudo('chsh -s /bin/bash {0}'.format(env.deploy_user))
        sudo('mkdir -p ~{0}/.ssh/'.format(env.deploy_user), user=env.deploy_user)
        sudo('cp ~/.ssh/id_rsa* ~{0}/.ssh/'.format(env.deploy_user))
    sudo('chown {0}.{0} ~{0}/.ssh/id_rsa*'.format(env.deploy_user))
    sudo('chmod 600 ~{0}/.ssh/id_rsa'.format(env.deploy_user), user=env.deploy_user)

    # add UbuntuGIS repo
    sudo('add-apt-repository ppa:ubuntugis/ubuntugis-unstable -y')
    sudo('add-apt-repository ppa:chris-lea/node.js -y')
    sudo('add-apt-repository ppa:chris-lea/nginx-devel -y')

    cuisine.package_update()
    cuisine.package_upgrade()

    # using oracle's jdk for good compatibility
    # intentionally not install postgresql-9.1-postgis until we can upgrade to django 1.5.x and postgis 2.0
    cuisine.package_ensure(
        'build-essential openjdk-6-jre openjdk-6-jdk postgresql git python-software-properties proj libproj-dev '
        'python-pip python-virtualenv python-dev virtualenvwrapper postgresql-server-dev-9.1 '
        'gdal-bin libgdal1-dev nginx varnish supervisor redis-server curl python-gdal nodejs'
        # 'libboost-dev libboost-filesystem-dev libboost-program-options-dev libboost-python-dev libboost-regex-dev '
        #     'libboost-system-dev libboost-thread-dev
    )

    #install older postgis
    create_template_postgis()

    cuisine.group_user_ensure("www-data", env.deploy_user)
    cuisine.group_user_ensure("sudo", env.deploy_user)

    # setup deployment user git settings #TODO: make more sense of this... probably shouldn't be this for all setups
    #sudo('su {0} -c "git config --global user.email \"[email protected]\""'.format(env.deploy_user))
    #sudo('su {0} -c "git config --global user.name \"Craig Rindt\""'.format(env.deploy_user))

    # create folders for calthorpe deployment
    sudo('mkdir -p {git_root}'.format(git_root=GIT_ROOT))
    sudo('chmod +t {git_root}'.format(git_root=GIT_ROOT))
    sudo('chown -R {user}.www-data {git_root}'.format(git_root=GIT_ROOT, user=env.deploy_user))

    sudo('mkdir -p /srv/calthorpe_static')  # needs to match local_settings.py.deployment value
    sudo('chmod +t /srv/calthorpe_static')
    sudo('chown -R {0}.www-data /srv/calthorpe_static'.format(env.deploy_user))

    sudo('mkdir -p /srv/calthorpe_media')  # needs to match local_settings.py.deployment value
    sudo('chmod +t /srv/calthorpe_media')
    sudo('chown -R {0}.www-data /srv/calthorpe_media'.format(env.deploy_user))

    #create virtualenv
    if not cuisine.dir_exists(env.virtualenv_directory):
        sudo("virtualenv {env}".format(env=env.virtualenv_directory))
        sudo('chown -R {user}.www-data {env}'.format(user=env.deploy_user, env=env.virtualenv_directory))

    install_mapnik()
    install_osgeo()
    # clone repo if needed
#    if not cuisine.dir_exists(GIT_ROOT):
    with cd(GIT_ROOT):
        sudo('su {0} -c "git clone https://github.com/crindt/uf urbanfootprint"'.format(env.deploy_user))
        sudo('chown -R {user}.www-data {BASE_PATH}/..'.format(user=env.deploy_user, BASE_PATH=BASE_PATH))

    setup_databases()

    with cd(PROJ_ROOT):
        if not exists('local_settings.py'):
            sudo('ln -s local_settings.py.{CLIENT} local_settings.py'.format(CLIENT=env.client))

    with cd(WEBSOCKETS_ROOT):
        # removes this
        try:
            sudo('rm -r carto')
        except:
            pass
        sudo('npm install .')
        sudo('git clone git://github.com/mapbox/carto.git')
        sudo('npm install -g ./carto')
        sudo('npm install -g millstone')
        sudo('chown -R {0}.www-data node_modules/'.format(env.deploy_user))

    # update varnish default port
    #sed('/etc/default/varnish', r'^DAEMON_OPTS="-a :6081', 'DAEMON_OPTS="-a :80', use_sudo=True)

    # soft link all configuration files
    with cd('/etc/varnish'):
        sudo('rm -f default.vcl')
        #sudo('ln -s /srv/calthorpe/urbanfootprint/calthorpe/server/conf/etc/varnish/default.vcl.prod default.vcl')

    nginx_configure()

    with cd('/etc/supervisor/conf.d'):
        sudo('rm -f calthorpe.conf')
        # Link the appropriate supervisor config file. dev omits a web server, and the log files are different
        supervisor_conf_ext = 'dev' if env.dev else 'prod'

        link_supervisor_config_path = "ln -s {BASE_PATH}/conf/etc/supervisor/conf.d/calthorpe.supervisor.{supervisor_extension} calthorpe.conf"
        sudo(link_supervisor_config_path.format(BASE_PATH=BASE_PATH, supervisor_extension=supervisor_conf_ext))

    install_sproutcore()

    # trigger deploy to update virtualenv and restart services
    deploy(upgrade_env=upgrade_env)
    patch_django_layermapping()