Пример #1
0
def deploy(restart='true'):
    """
    Deploy the latest version of the site to the servers.
    """

    restart = (restart in ('true', 'True'))

    # installs any required third party modules, compiles static files
    # and messages, migrates the database and then restarts the
    # appserver

    env.release = time.strftime('%Y-%m-%dT%H.%M.%S')

    # github doesn't support upload-archive, so work from local repo
    fabhelpers.export_and_upload_tar_from_git_local()
    prep_release(env.release)
    switch_to(env.release)
    if restart:
        restart_appserver()
    else:
        invoke(command="start")

    fabhelpers.substitute_and_put(
        "crontab.in",
        "%s/crontab" % env.path,
        (('TOPDIR', env.path), ),
        mode=0700,
    )
    run("crontab < %(path)s/crontab" % {'path': env.path})
Пример #2
0
def deploy(restart='true'):
    """
    Deploy the latest version of the site to the servers.
    """
    
    restart = (restart in ('true', 'True'))

    # installs any required third party modules, compiles static files
    # and messages, migrates the database and then restarts the
    # appserver
    
    env.release = time.strftime('%Y-%m-%dT%H.%M.%S')

    # github doesn't support upload-archive, so work from local repo
    fabhelpers.export_and_upload_tar_from_git_local()
    prep_release(env.release)
    switch_to(env.release)
    if restart:
        restart_appserver()
    else:
        invoke(command="start")

    fabhelpers.substitute_and_put(
        "crontab.in",
        "%s/crontab" % env.path,
        (
            ('TOPDIR', env.path),
        ),
        mode=0700,
    )
    run("crontab < %(path)s/crontab" % { 'path': env.path })
Пример #3
0
def setup():
    """Set up the initial structure for the given user."""

    require('hosts', 'path')
    require(
        'database_url',
        'django_secret_key',
        'allowed_hosts',
        'listen_port',
        used_for="configuring the application.",
    )

    # make our directory structure
    run("mkdir -pm 711 %s/media" % env.path)
    run("mkdir -pm 711 %s/releases" % env.path)
    run("mkdir -pm 700 %s/archives" % env.path)
    # make the userv rc script
    run("mkdir -pm 700 %s/.userv" % env.path)
    put("userv.rc.in", "%s/.userv/rc" % env.path, mode=0600)
    # and the script it points to
    # @TOPDIR@ -> env.path
    # @WSGI@ -> $(env.project).wsgi (python path to WSGI app)
    # @DATABASE_URL@ -> syntax postgresql://USER:PASSWORD@localhost:5432/DBNAME
    # (or postgis://...)
    # @DJANGO_SECRET_KEY@ -> what it says (make it long and gnarly)
    # @ALLOWED_HOSTS@ -> semicolon separated (eg loose-end.in;www.loose-end.in)
    # @PORT@ -> that gunicorn should listen on
    #
    # The last four should be passed into the env in a fab-ish manner.
    # (Hence the require statements above.)

    substitutions = (
        ('TOPDIR', env.path),
        ('WSGI', '%s.wsgi' % env.project),
        ('DATABASE_URL', env.database_url),
        ('DJANGO_SECRET_KEY', env.django_secret_key),
        ('ALLOWED_HOSTS', env.allowed_hosts),
        ('PORT', env.listen_port),
    )

    fabhelpers.substitute_and_put(
        "invoke.in",
        "%s/invoke" % env.path,
        substitutions,
        mode=0700,
    )
Пример #4
0
def setup():
    """Set up the initial structure for the given user."""
    
    require('hosts', 'path')
    require(
        'database_url',
        'django_secret_key',
        'allowed_hosts',
        'listen_port',
        used_for="configuring the application.",
    )

    # make our directory structure
    run("mkdir -m 711 %s/media" % env.path)
    run("mkdir -m 711 %s/releases" % env.path)
    run("mkdir -m 700 %s/archives" % env.path)
    # make the userv rc script
    run("mkdir -m 700 %s/.userv" % env.path)
    put("userv.rc.in", "%s/.userv/rc" % env.path, mode=0600)
    # and the script it points to
    # @TOPDIR@ -> env.path
    # @WSGI@ -> $(env.project).wsgi (python path to WSGI app)
    # @DATABASE_URL@ -> syntax postgresql://USER:PASSWORD@localhost:5432/DBNAME
    # (or postgis://...)
    # @DJANGO_SECRET_KEY@ -> what it says (make it long and gnarly)
    # @ALLOWED_HOSTS@ -> semicolon separated (eg loose-end.in;www.loose-end.in)
    # @PORT@ -> that gunicorn should listen on
    #
    # The last four should be passed into the env in a fab-ish manner.
    # (Hence the require statements above.)

    substitutions = (
        ('TOPDIR', env.path),
        ('WSGI', '%s.wsgi' % env.project),
        ('DATABASE_URL', env.database_url),
        ('DJANGO_SECRET_KEY', env.django_secret_key),
        ('ALLOWED_HOSTS', env.allowed_hosts),
        ('PORT', env.listen_port),
    )

    fabhelpers.substitute_and_put(
        "invoke.in",
        "%s/invoke" % env.path,
        substitutions,
        mode=0700,
    )