Beispiel #1
0
def deploy():
    """Initialise or update the git clone - you can safely rerun this.

    e.g. to update the server

    fab -H <host> deploy

    """
    # Ensure we have a mailserver setup for our domain
    # Note that you may have problems if you intend to run more than one
    # site from the same server
    setup_env()
    show_environment()
    setup_postgis_2()
    base_path, code_path, git_url, repo_alias, site_name = get_vars()

    fastprint('Checking out %s to %s as %s' % (git_url, base_path, repo_alias))
    update_git_checkout(base_path, git_url, repo_alias)
    update_index()
    require.postfix.server(site_name)
    update_apache(code_path)
    require.deb.package('python-dev')
    require.deb.package('libpq-dev')
    require.deb.package('libgeos-c1')
    require.deb.package('vim')
    require.deb.package('curl')
    require.deb.package('pandoc')
    update_venv(code_path)
    set_db_permissions()
    with cd(os.path.join(code_path, 'django_project')):
        run('../venv/bin/python manage.py syncdb --noinput ')
        run('../venv/bin/python manage.py migrate')
    # if we are testing under vagrant, deploy our local media and db
    #if 'vagrant' in env.fg.home:
    #    with cd(code_path):
    #        run('cp /vagrant/projecta.db .')
    #        run('touch django_project/core/wsgi.py')

    #sync_media_to_server()
    collectstatic()
    fastprint('*******************************************\n')
    fastprint(red(' Don\'t forget set ALLOWED_HOSTS in '))
    fastprint(' django_project/core/settings/prod.py')
    fastprint(' to the domain name for the site.')
    fastprint('*******************************************\n')
Beispiel #2
0
def deploy():
    """Initialise or update the git clone - you can safely rerun this.

    e.g. to update the server

    fab -H <host> deploy

    """
    # Ensure we have a mailserver setup for our domain
    # Note that you may have problems if you intend to run more than one
    # site from the same server
    setup_env()
    show_environment()
    setup_postgis_2()
    base_path, code_path, git_url, repo_alias, site_name = get_vars()

    fastprint('Checking out %s to %s as %s' % (git_url, base_path, repo_alias))
    update_git_checkout(base_path, git_url, repo_alias)
    update_index()
    require.postfix.server(site_name)
    update_apache(code_path)
    require.deb.package('python-dev')
    require.deb.package('libpq-dev')
    require.deb.package('libgeos-c1')
    require.deb.package('vim')
    require.deb.package('curl')
    require.deb.package('pandoc')
    update_venv(code_path)
    set_db_permissions()
    with cd(os.path.join(code_path, 'django_project')):
        run('../venv/bin/python manage.py syncdb --noinput ')
        run('../venv/bin/python manage.py migrate')
    # if we are testing under vagrant, deploy our local media and db
    #if 'vagrant' in env.fg.home:
    #    with cd(code_path):
    #        run('cp /vagrant/projecta.db .')
    #        run('touch django_project/core/wsgi.py')

    #sync_media_to_server()
    collectstatic()
    fastprint('*******************************************\n')
    fastprint(red(' Don\'t forget set ALLOWED_HOSTS in '))
    fastprint(' django_project/core/settings/prod.py')
    fastprint(' to the domain name for the site.')
    fastprint('*******************************************\n')
def deploy():
    """Initialise or update the git clone - you can safely rerun this.

    e.g. to update the server

    fab -H <host> deploy

    """
    # Ensure we have a mailserver setup for our domain
    # Note that you may have problems if you intend to run more than one
    # site from the same server
    setup_env()
    show_environment()
    base_path, code_path, git_url, repo_alias, site_name = get_vars()

    fastprint('Checking out %s to %s as %s' % (git_url, base_path, repo_alias))
    update_git_checkout(base_path, git_url, repo_alias)
    require.postfix.server(site_name)
    update_apache(code_path)
    require.deb.package('python-dev')
    update_venv(code_path)
    fastprint('*******************************************\n')
    fastprint(' Setup completed.')
    fastprint('*******************************************\n')
Beispiel #4
0
def deploy():
    """Initialise or update the git clone - you can safely rerun this.

    e.g. to update the server

    fab -H <host> deploy

    """
    # Ensure we have a mailserver setup for our domain
    # Note that you may have problems if you intend to run more than one
    # site from the same server
    setup_env()
    show_environment()
    base_path, code_path, git_url, repo_alias, site_name = get_vars()

    fastprint('Checking out %s to %s as %s' % (git_url, base_path, repo_alias))
    update_git_checkout(base_path, git_url, repo_alias)
    require.postfix.server(site_name)
    update_apache(code_path)
    require.deb.package('python-dev')
    update_venv(code_path)
    fastprint('*******************************************\n')
    fastprint(' Setup completed.')
    fastprint('*******************************************\n')
Beispiel #5
0
def build_test_package(
        branch='develop',
        web_directory='/home/web/inasafe-test'):
    """Create a test package and publish it in our repo.

    :param branch: The name of the branch to build from. Defaults to 'develop'.
    :type branch: str

    :param web_directory: Directory for experimental plugin that will be
        published via apache.
    :type web_directory: str

    To run e.g.::

        fab -H <host:port> build_test_package

        or to package up a specific branch (in this case minimum_needs)

        fab -H <host:port> build_test_package:minimum_needs

    .. note:: Using the branch option will not work for branches older than 1.1
    """
    base_path, code_path, git_url, repo_alias, site_name = get_vars()
    show_environment()
    update_git_checkout(base_path, git_url, repo_alias, branch)
    initialise_qgis_plugin_repo()
    fabtools.require.deb.packages(['zip', 'make', 'gettext'])

    with cd(code_path):
        # Get git version and write it to a text file in case we need to cross
        # reference it for a user ticket.
        sha = run('git rev-parse HEAD > git_revision.txt')
        fastprint('Git revision: %s' % sha)

        get('metadata.txt', '/tmp/metadata.txt')
        metadata_file = file('/tmp/metadata.txt')
        metadata_text = metadata_file.readlines()
        metadata_file.close()
        for line in metadata_text:
            line = line.rstrip()
            if 'version=' in line:
                plugin_version = line.replace('version=', '')
            if 'status=' in line:
                line.replace('status=', '')

        # noinspection PyUnboundLocalVariable
        run('scripts/release.sh %s' % plugin_version)
        package_name = '%s.%s.zip' % ('inasafe', plugin_version)
        source = '/tmp/%s' % package_name
        fastprint(blue('Source: %s\n' % source))
        run('cp %s %s' % (source, web_directory))

        source = os.path.join('scripts', 'test-build-repo', 'plugins.xml')
        plugins_xml = os.path.join(web_directory, 'plugins.xml')
        fastprint(blue('Source: %s\n' % source))
        run('cp %s %s' % (source, plugins_xml))

        sed(plugins_xml, '\[VERSION\]', plugin_version)
        sed(plugins_xml, '\[FILE_NAME\]', package_name)
        sed(plugins_xml, '\[URL\]', 'http://%s/%s' % (
            site_name, package_name))
        sed(plugins_xml, '\[DATE\]', str(datetime.now()))

        fastprint('Add http://%s/plugins.xml to QGIS plugin manager to use.'
                  % site_name)
Beispiel #6
0
def build_test_package(branch='develop',
                       web_directory='/home/web/inasafe-test'):
    """Create a test package and publish it in our repo.

    :param branch: The name of the branch to build from. Defaults to 'develop'.
    :type branch: str

    :param web_directory: Directory for experimental plugin that will be
        published via apache.
    :type web_directory: str

    To run e.g.::

        fab -H <host:port> build_test_package

        or to package up a specific branch (in this case minimum_needs)

        fab -H <host:port> build_test_package:minimum_needs

    .. note:: Using the branch option will not work for branches older than 1.1
    """
    base_path, code_path, git_url, repo_alias, site_name = get_vars()
    show_environment()
    update_git_checkout(base_path, git_url, repo_alias, branch)
    initialise_qgis_plugin_repo()
    fabtools.require.deb.packages(['zip', 'make', 'gettext'])

    with cd(code_path):
        # Get git version and write it to a text file in case we need to cross
        # reference it for a user ticket.
        sha = run('git rev-parse HEAD > git_revision.txt')
        fastprint('Git revision: %s' % sha)

        get('metadata.txt', '/tmp/metadata.txt')
        metadata_file = file('/tmp/metadata.txt')
        metadata_text = metadata_file.readlines()
        metadata_file.close()
        for line in metadata_text:
            line = line.rstrip()
            if 'version=' in line:
                plugin_version = line.replace('version=', '')
            if 'status=' in line:
                line.replace('status=', '')

        # noinspection PyUnboundLocalVariable
        run('scripts/release.sh %s' % plugin_version)
        package_name = '%s.%s.zip' % ('inasafe', plugin_version)
        source = '/tmp/%s' % package_name
        fastprint(blue('Source: %s\n' % source))
        run('cp %s %s' % (source, web_directory))

        source = os.path.join('scripts', 'test-build-repo', 'plugins.xml')
        plugins_xml = os.path.join(web_directory, 'plugins.xml')
        fastprint(blue('Source: %s\n' % source))
        run('cp %s %s' % (source, plugins_xml))

        sed(plugins_xml, '\[VERSION\]', plugin_version)
        sed(plugins_xml, '\[FILE_NAME\]', package_name)
        sed(plugins_xml, '\[URL\]', 'http://%s/%s' % (site_name, package_name))
        sed(plugins_xml, '\[DATE\]', str(datetime.now()))

        fastprint('Add http://%s/plugins.xml to QGIS plugin manager to use.' %
                  site_name)