示例#1
0
def upgrade_tyr_packages():
    packages = [
        'logrotate',
        'git',
        ]
    if env.distrib == 'ubuntu14.04':
        packages += ['libpython2.7-dev']
    elif env.distrib == 'debian7':
        packages += ['python2.7-dev']
    elif env.distrib == 'debian8':
        packages += ['python2.7-dev', 'g++']
    require.deb.packages(packages, update=True)
    package_filter_list = ['navitia-tyr*deb',
                           'navitia-common*deb']
    _install_packages(package_filter_list)
    if not python.is_pip_installed():
        python.install_pip()

    #we want the version of the system for these packages
    run('''sed -e "/protobuf/d" -e "/psycopg2/d"  /usr/share/tyr/requirements.txt > /tmp/tyr_requirements.txt''')
    run('git config --global url."https://".insteadOf git://')
    require.python.install_requirements('/tmp/tyr_requirements.txt', use_sudo=True, exists_action='w')
    if env.use_systemd:
        _upload_template('tyr/systemd_tyr_worker.jinja', env.service_name('tyr_worker'),
                         user='******', mode='644', context={'env': env})
    else:
        _upload_template('tyr/tyr_worker.jinja', env.service_name('tyr_worker'),
                         user='******', mode='755', context={'env': env})
    restart_tyr_worker()
    update_init(host='tyr')
示例#2
0
def pip(version=None, use_python='python'):
    """
    Require `pip`_ to be installed.
    """
    distribute(use_python=use_python)
    if not is_pip_installed(version, use_python=use_python):
        install_pip(use_python=use_python)
示例#3
0
def upgrade_ws_packages():
    packages = [
        'apache2', 'libapache2-mod-wsgi', 'logrotate', 'redis-server',
        'python2.7', 'git', 'gcc', 'python-dev', 'protobuf-compiler'
    ]
    if env.distrib in ('ubuntu14.04', 'debian8'):
        packages.append('libzmq3-dev')
        packages.append('libgeos-3.4.2')
    elif env.distrib == 'debian7':
        packages.append('libzmq-dev')

    require.deb.packages(packages)
    package_filter_list = ['navitia-jormungandr*deb', 'navitia-common*deb']
    _install_packages(package_filter_list)
    if not python.is_pip_installed():
        python.install_pip()

    # We want the version of the system for these packages
    run('''sed -e "/protobuf/d" -e "/psycopg2/d"  /usr/share/jormungandr/requirements.txt > /tmp/jormungandr_requirements.txt'''
        )
    #add newrelic as a dependency
    run('''echo 'newrelic==2.70.0.51' >> /tmp/jormungandr_requirements.txt''')
    run('git config --global url."https://".insteadOf git://')
    require.python.install_requirements('/tmp/jormungandr_requirements.txt',
                                        use_sudo=True,
                                        exists_action='w')
示例#4
0
def upgrade_tyr_packages():
    packages = [
        'sudo', 'apache2', 'libapache2-mod-wsgi', 'logrotate', 'python2.7',
        'git', 'postgresql-server-dev-all'
    ]
    if env.distrib == 'ubuntu14.04':
        packages += ['libpython2.7-dev', 'postgresql-9.3-postgis-2.1']
    elif env.distrib == 'debian7':
        packages += ['python2.7-dev', 'postgresql-9.1-postgis']
    elif env.distrib == 'debian8':
        packages += ['python2.7-dev', 'g++', 'postgresql-9.4-postgis-2.1']
    require.deb.packages(packages, update=True)
    package_filter_list = ['navitia-tyr*deb', 'navitia-common*deb']
    _install_packages(package_filter_list)
    if not python.is_pip_installed():
        python.install_pip()
    require.python.install_requirements('/usr/share/tyr/requirements.txt',
                                        use_sudo=True,
                                        exists_action='w')
    _upload_template('tyr/tyr_beat.jinja',
                     env.tyr_beat_service_file,
                     context={'env': env},
                     mode='755')
    _upload_template('tyr/tyr_worker.jinja',
                     env.tyr_worker_service_file,
                     context={'env': env},
                     mode='755')
示例#5
0
def upgrade_tyr_packages():
    packages = [
        'sudo',
        'apache2',
        'libapache2-mod-wsgi',
        'logrotate',
        'python2.7',
        'git',
        'postgresql-server-dev-all'
        ]
    if env.distrib == 'ubuntu14.04':
        packages += ['libpython2.7-dev', 'postgresql-9.3-postgis-2.1']
    elif env.distrib == 'debian7':
        packages += ['python2.7-dev', 'postgresql-9.1-postgis']
    elif env.distrib == 'debian8':
        packages += ['python2.7-dev', 'g++', 'postgresql-9.4-postgis-2.1']
    require.deb.packages(packages, update=True)
    package_filter_list = ['navitia-tyr*deb',
                           'navitia-common*deb']
    _install_packages(package_filter_list)
    if not python.is_pip_installed():
        python.install_pip()
    require.python.install_requirements('/usr/share/tyr/requirements.txt', use_sudo=True, exists_action='w')
    _upload_template('tyr/tyr_beat.jinja', env.tyr_beat_service_file,
                     context={'env': env}, mode='755')
    _upload_template('tyr/tyr_worker.jinja', env.tyr_worker_service_file,
                     context={'env': env}, mode='755')
示例#6
0
def upgrade_ws_packages():
    packages = [
        'apache2',
        'libapache2-mod-wsgi',
        'logrotate',
        'redis-server',
        'python2.7',
        'git',
        'gcc',
        'python-dev',
        'protobuf-compiler'
    ]
    if env.distrib in ('ubuntu14.04', 'debian8'):
        packages.append('libzmq3-dev')
    elif env.distrib == 'debian7':
        packages.append('libzmq-dev')

    require.deb.packages(packages)
    package_filter_list = ['navitia-jormungandr*deb',
                           'navitia-common*deb']
    _install_packages(package_filter_list)
    if not python.is_pip_installed():
        python.install_pip()

    require.python.install_requirements('/usr/share/jormungandr/requirements.txt',
            use_sudo=True,
            exists_action='w')
示例#7
0
def upgrade_tyr_packages():
    packages = [
        'logrotate',
        'git',
        ]
    if env.distrib == 'ubuntu14.04':
        packages += ['libpython2.7-dev']
    elif env.distrib == 'debian7':
        packages += ['python2.7-dev']
    elif env.distrib == 'debian8':
        packages += ['python2.7-dev', 'g++']
    require.deb.packages(packages, update=True)
    package_filter_list = ['navitia-tyr*deb',
                           'navitia-common*deb']
    _install_packages(package_filter_list)
    if not python.is_pip_installed():
        python.install_pip()

    #we want the version of the system for these packages
    run('''sed -e "/protobuf/d" -e "/psycopg2/d"  /usr/share/tyr/requirements.txt > /tmp/tyr_requirements.txt''')
    run('git config --global url."https://".insteadOf git://')
    require.python.install_requirements('/tmp/tyr_requirements.txt', use_sudo=True, exists_action='w')
    if env.use_systemd:
        _upload_template('tyr/systemd_tyr_worker.jinja', env.service_name('tyr_worker'),
                         user='******', mode='644', context={'env': env})
    else:
        _upload_template('tyr/tyr_worker.jinja', env.service_name('tyr_worker'),
                         user='******', mode='755', context={'env': env})
    restart_tyr_worker()
    update_init(host='tyr')
示例#8
0
def pip(version=None, use_python='python'):
    """
    Require `pip`_ to be installed.
    """
    distribute(use_python=use_python)
    if not is_pip_installed(version, use_python=use_python):
        install_pip(use_python=use_python)
示例#9
0
文件: api.py 项目: Hoedic/fab_taxi
def deploy_api(commit='master'):
    now = int(time.time())
    require.files.directory(env.deployment_dir(now))
    with cd(env.deployment_dir(now)):
        run(u'wget {}'.format(env.apitaxi_archive.format(commit)))
        run('unzip {}.zip'.format(commit))
        if commit != 'master':
            run('mv APITaxi-{} APITaxi-master'.format(commit))

    with cd(env.apitaxi_dir(now)):
        require.python.virtualenv(env.apitaxi_venv_path(now))
        with python.virtualenv(env.apitaxi_venv_path(now)):
            python.install_pip(use_sudo=False)
            require.python.package('uwsgi')
            python.install_requirements('requirements.txt')
            put(environ['APITAXI_CONFIG_FILE'], env.apitaxi_config_path(now))
            with shell_env(APITAXI_CONFIG_FILE=env.apitaxi_config_path(now)):
                for i in range(1, 30):
                    if service.is_running('supervisor'):
                        break
                    time.sleep(1)
                run('python manage.py db upgrade')
                install_admin_user()
        deploy_front(now)
        deploy_nginx_api_site(now)
    if not service.is_running('nginx'):
        service.start('nginx')
    clean_directories(now)
    stop_old_processes(now)
    restart_stats_workers(now)
示例#10
0
def upgrade_ws_packages():
    packages = [
        "apache2",
        "libapache2-mod-wsgi",
        "logrotate",
        "redis-server",
        "python2.7",
        "git",
        "gcc",
        "python-dev",
        "protobuf-compiler",
    ]
    if env.distrib in ("ubuntu14.04", "debian8"):
        packages.append("libzmq3-dev")
        packages.append("libgeos-3.4.2")
    elif env.distrib == "debian7":
        packages.append("libzmq-dev")

    require.deb.packages(packages)
    package_filter_list = ["navitia-jormungandr*deb", "navitia-common*deb"]
    _install_packages(package_filter_list)
    if not python.is_pip_installed():
        python.install_pip()

    # we want the version of the system for these packages
    run(
        """sed -e "/protobuf/d" -e "/psycopg2/d"  /usr/share/jormungandr/requirements.txt > /tmp/jormungandr_requirements.txt"""
    )
    run('git config --global url."https://".insteadOf git://')
    require.python.install_requirements("/tmp/jormungandr_requirements.txt", use_sudo=True, exists_action="w")
示例#11
0
def upgrade_ws_packages():
    packages = [
        'apache2',
        'libapache2-mod-wsgi',
        'logrotate',
        'redis-server',
        'python2.7',
        'git',
        'gcc',
        'python-dev',
        'protobuf-compiler'
    ]
    if env.distrib in ('ubuntu14.04', 'debian8'):
        packages.append('libzmq3-dev')
    elif env.distrib == 'debian7':
        packages.append('libzmq-dev')

    require.deb.packages(packages)
    package_filter_list = ['navitia-jormungandr*deb',
                           'navitia-common*deb']
    _install_packages(package_filter_list)
    if not python.is_pip_installed():
        python.install_pip()

    #we want the version of the system for these packages
    run('''sed -e "/protobuf/d" -e "/psycopg2/d"  /usr/share/jormungandr/requirements.txt > /tmp/jormungandr_requirements.txt''')
    run('git config --global url."https://".insteadOf git://')
    require.python.install_requirements('/tmp/jormungandr_requirements.txt',
            use_sudo=True,
            exists_action='w',
            upgrade=True)
示例#12
0
def pip(version=None):
    """
    Require `pip`_ to be installed.
    """
    distribute()
    if not is_pip_installed(version):
        install_pip()
示例#13
0
def pip(version=None):
    """
    Require `pip`_ to be installed.
    """
    distribute()
    if not is_pip_installed(version):
        install_pip()
示例#14
0
def upgrade_monitor_kraken_packages():
    package_filter_list = ['navitia-monitor-kraken*deb']
    _install_packages(package_filter_list)
    if not python.is_pip_installed():
        python.install_pip()
    require.python.install_requirements('/usr/share/monitor_kraken/requirements.txt',
                                        use_sudo=True,
                                        exists_action='w')
示例#15
0
def upgrade_monitor_kraken_packages():
    package_filter_list = ['navitia-monitor-kraken*deb']
    _install_packages(package_filter_list)
    if not python.is_pip_installed():
        python.install_pip()
    require.python.install_requirements('/usr/share/monitor_kraken/requirements.txt',
                                        use_sudo=True,
                                        exists_action='w')
示例#16
0
def pip(version=MIN_PIP_VERSION, pip_cmd='pip', python_cmd='python'):
    """
    Require `pip`_ to be installed.

    If pip is not installed, or if a version older than *version*
    is installed, the latest version will be installed.

    .. _pip: http://www.pip-installer.org/
    """
    setuptools(python_cmd=python_cmd)
    if not is_pip_installed(version, pip_cmd=pip_cmd):
        install_pip(python_cmd=python_cmd)
示例#17
0
def pip(version=MIN_PIP_VERSION, pip_cmd='pip', python_cmd='python'):
    """
    Require `pip`_ to be installed.

    If pip is not installed, or if a version older than *version*
    is installed, the latest version will be installed.

    .. _pip: http://www.pip-installer.org/
    """
    setuptools(python_cmd=python_cmd)
    if not is_pip_installed(version, pip_cmd=pip_cmd):
        install_pip(python_cmd=python_cmd)
示例#18
0
def deploy():
    require("install_location")
    sudo("mkdir -p %(install_location)s" % env)
    if not is_pip_installed():
        install_pip()
    install("virtualenv", use_sudo=True)
    put(join_local("pip-requirements.txt"), "/tmp/pip-requirements.txt")
    with _virtualenv():
        install_requirements("/tmp/pip-requirements.txt", use_sudo=True)
        sudo("pip install -e git+https://github.com/oliverdrake/rpitempcontroller.git#egg=tempcontrol")
    put("tempcontroller-config.default", env.config_file, use_sudo=True,
        mirror_local_mode=True)
    with settings(python_bin_dir=os.path.join(_virtualenv_location(), "bin")):
        upload_template("init-script.in", env.init_script, mode=0754,
                        use_jinja=True, context=env, use_sudo=True,
                        backup=False)
    sudo("chown root:root %(init_script)s" % env)
示例#19
0
文件: vim.py 项目: jslopez/magnetizer
def install():
    """ Installs and configures vim """
    # update apt index
    update_index(quiet=False)

    # install vim
    utils._deb.install('vim')

    # backup vim configuration folder
    if exists('.vim'):
        print(green('Backing up your vim configuration folder to .vim-bkp'))
        cmd = 'mv .vim .vim-bkp'
        run(cmd)

    # backup vim configuration file
    if exists('.vimrc'):
        print(green('Backing up your vim configuration file to .vimrc-bkp'))
        cmd = 'mv .vimrc .vimrc-bkp'
        run(cmd)

    # clone vim_config repository
    print(green('Cloning Vim_config repository.'))
    # install git if is not available
    git_install()
    git_clone('git://github.com/magnet-cl/Vim_config.git', '.vim')

    # install required packages by plugins
    print(green('Installing plugins dependencies.'))
    # ctags, better grep, python flake, latex, C/C++ omnicompletion
    plugins = ['exuberant-ctags', 'ack-grep', 'pyflakes', 'lacheck', 'clang',
               'rhino']
    for plugin in plugins:
        utils._deb.install(plugin)
    # install pip if is not available
    if not is_pip_installed():
        install_pip()
    if not py_is_installed('flake8'):
        py_install('flake8', use_sudo=True)  # python flake+pep8

    # installation script
    print(green('Installing Vim_config.'))
    cmd = 'source .vim/install.sh'
    run(cmd)
示例#20
0
def install_requirements():
    """Installs all the requirements on the requirements file"""

    # TODO: sudo should not be required. we need to configure this to use a new user for each app.

    if not is_pip_installed():
        install_pip()  # use_sudo defaults to True

    # inside here we check if the virtualenv exists, no need for double check.
    create_virtualenv()

    create_application_folder()

    if env.clone:
        clone_repository()

    with virtualenv(env.virtualenv_path):
        with cd(env.app_root):
            fab_install_requirements("requirements.txt", use_sudo=True)
示例#21
0
def install_requirements():

    """Installs all the requirements on the requirements file"""

    # TODO: sudo should not be required. we need to configure this to use a new user for each app.

    if not is_pip_installed():
        install_pip() # use_sudo defaults to True

    # inside here we check if the virtualenv exists, no need for double check.
    create_virtualenv()

    create_application_folder()

    if env.clone:
        clone_repository()

    with virtualenv(env.virtualenv_path):
        with cd(env.app_root):
            fab_install_requirements("requirements.txt", use_sudo=True)
示例#22
0
文件: api.py 项目: odtvince/fab_taxi
def deploy_api():
    now = int(time.time())
    require.files.directory(env.deployment_dir(now))
    with cd(env.deployment_dir(now)):
        run('wget https://github.com/openmaraude/APITaxi/archive/master.zip')
        run('unzip master.zip')

    with cd(env.apitaxi_dir(now)):
        require.python.virtualenv(env.apitaxi_venv_path(now))
        with python.virtualenv(env.apitaxi_venv_path(now)):
            python.install_pip()
            require.python.package('uwsgi')
            python.install_requirements('requirements.txt')
            put(environ['APITAXI_CONFIG_FILE'], env.apitaxi_config_path(now))
            run('python manage.py db upgrade')
        deploy_nginx_api_site(now)
    if not service.is_running('nginx'):
        service.start('nginx')
    clean_directories(now)
    stop_old_processes(now)
示例#23
0
def upgrade_tyr_packages():
    packages = [
        'logrotate',
        'git',
        ]
    if env.distrib == 'ubuntu14.04':
        packages += ['libpython2.7-dev']
    elif env.distrib == 'debian7':
        packages += ['python2.7-dev']
    elif env.distrib == 'debian8':
        packages += ['python2.7-dev', 'g++']
    require.deb.packages(packages, update=True)
    package_filter_list = ['navitia-tyr*deb',
                           'navitia-common*deb']
    _install_packages(package_filter_list)
    if not python.is_pip_installed():
        python.install_pip()
    require.python.install_requirements('/usr/share/tyr/requirements.txt', use_sudo=True, exists_action='w')
    _upload_template('tyr/tyr_worker.jinja', env.tyr_worker_service_file,
                     user='******', mode='755', context={'env': env})