示例#1
0
def install_mysql():
    """ Installs mysql. """

    # if not installed
    if search('un', run('dpkg-query -l mysql-server| cut -d " " -f1')):
        # mysql password workaround
        # http://www.muhuk.com/2010/05/how-to-install-mysql-with-fabric/
        while True:
            mysql_password = getpass(
                'Please enter MySQL root password: '******'Please confirm your password: '******'t match"

        # get mysql-server version available
        mysql_version = run('aptitude show mysql-server| grep Version | '
            'cut -d "." -f2')
        # insert the given password into the debconf database
        sudo('echo "mysql-server-5.%s mysql-server/root_password password '
            '%s" | debconf-set-selections' % (mysql_version, 
                                                mysql_password))
        sudo('echo "mysql-server-5.%s mysql-server/root_password_again '
                'password %s" | debconf-set-selections' % (mysql_version,
                                                        mysql_password))
        # install the package
        deb_handler.install('mysql-server')
示例#2
0
def install_mysql():
    """ Installs mysql. """

    # if not installed
    if search('un', run('dpkg-query -l mysql-server| cut -d " " -f1')):
        # mysql password workaround
        # http://www.muhuk.com/2010/05/how-to-install-mysql-with-fabric/
        while True:
            mysql_password = getpass('Please enter MySQL root password: '******'Please confirm your password: '******'t match"

        # get mysql-server version available
        mysql_version = run('aptitude show mysql-server| grep Version | '
                            'cut -d "." -f2')
        # insert the given password into the debconf database
        sudo('echo "mysql-server-5.%s mysql-server/root_password password '
             '%s" | debconf-set-selections' % (mysql_version, mysql_password))
        sudo('echo "mysql-server-5.%s mysql-server/root_password_again '
             'password %s" | debconf-set-selections' %
             (mysql_version, mysql_password))
        # install the package
        deb_handler.install('mysql-server')
示例#3
0
def initial_deploy():
    """ Performs a complete deploy of the project. """

    # put ssh key
    ssh_key = '%s/fabfile/templates/ssh_key'
    ssh_key %= env.local_root_dir
    run('mkdir -p -m 0700 .ssh')
    put(ssh_key, '.ssh/id_rsa', mode=0600)

    # github host handshake
    run('ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts')

    # clone repository
    deb_handler.install('git')
    git_clone(env.server_git_url, env.server_root_dir)

    # checkout branch
    with cd(env.server_root_dir):
        git_checkout(env.branch)

    # mysql installation
    install_mysql()

    # dependencies installation (quickstart)
    with cd(env.server_root_dir):
        run('./quickstart.sh')

    # gunicorn installation and configuration
    gunicorn.install()
    gunicorn.add_gunicorn_service()
    gunicorn.start()

    # nginx installation and configuration
    nginx.install()
    nginx.add_django_site()
    nginx.start()
def install_project_handling_dependencies():
    # install zip dependencies
    deb_handler.install('zip')
    deb_handler.install('unzip')
def install():
    """ Installs nginx through deb_handler. """
    deb_handler.install('nginx')
示例#6
0
def install_project_handling_dependencies():
    # install zip dependencies
    deb_handler.install('zip')
    deb_handler.install('unzip')
def install_project_handling_dependencies():
    # install zip dependencies
    deb_handler.install("zip")
    deb_handler.install("unzip")