Example #1
0
def configure():
    """Configures the doc module.

    Creates doc_dir and copies documentation sources there.
    Formats and uploads scripts for building the documentation.
    Finally, loads django-sphinxdoc project from a fixture.

    Project fixture can be found in deployment/files/doc/fixture.json.

    """
    # Add extra context variables used by sphinx-doc and apidoc
    excluded = cget('autodoc_excluded_apps')
    excluded = ' '.join(excluded) if excluded else ''
    cset("autodoc_excluded_apps", excluded, force=True)
    cset("project_display_name_slug", slugify(cget('project_display_name')))

    # Asure the doc folder exists
    user = cget('user')
    ddir = cget('doc_dir')
    source_doc_dir = pjoin(cget("project_dir"), "code", "doc")
    create_target_directories([ddir], "755", user)

    # Delete the content of the folder if exist
    with settings(hide("running", "stdout", "stderr")):
        output = sudo('ls -A {doc_dir}'.format(doc_dir=ddir))
        if len(output) > 0:
            sudo("rm -r {doc_dir}/*".format(doc_dir=ddir))

    # Copy files to doc dir
    with settings(hide("running", "stdout")):
        run("cp -r {source}/* {dest}".format(source=source_doc_dir, dest=ddir))
    ensure_permissions(ddir, user=user, group=user, recursive=True)

    context = dict(env["ctx"])

    # Upload formatted build script
    scripts = ['make_apidoc.sh']
    local_dir = local_files_dir("doc")
    show(yellow("Uploading doc scripts: {0}.".format(' '.join(scripts))))
    for script_name in scripts:
        source = pjoin(local_dir, script_name)
        destination = pjoin(cget("script_dir"), script_name)
        upload_template_with_perms(source, destination, context, mode="755")

    # Upload formatted conf.py file
    show(yellow("Uploading formatted conf.py file."))
    conf_file = "conf_formatted.py"
    source = pjoin(cget("local_root"), "doc", 'source', conf_file)
    destination = pjoin(ddir, 'source', conf_file)
    upload_template_with_perms(source, destination, context, mode="755")

    # Add Project to the database using formatted fixture and loaddata
    show(yellow("Adding django-sphinxdoc database models."))
    fixture_name = "fixture.json"
    source = pjoin(local_dir, fixture_name)
    destination = pjoin(ddir, fixture_name)
    upload_template_with_perms(source, destination, context, mode="755")
    run_django_cmd('loaddata', args=destination)
Example #2
0
def configure():
    """Configures the doc module.

    Creates doc_dir and copies documentation sources there.
    Formats and uploads scripts for building the documentation.
    Finally, loads django-sphinxdoc project from a fixture.

    Project fixture can be found in deployment/files/doc/fixture.json.

    """
    # Add extra context variables used by sphinx-doc and apidoc
    excluded = cget('autodoc_excluded_apps')
    excluded = ' '.join(excluded) if excluded else ''
    cset("autodoc_excluded_apps", excluded, force=True)
    cset("project_display_name_slug", slugify(cget('project_display_name')))

    # Asure the doc folder exists
    user = cget('user')
    ddir = cget('doc_dir')
    source_doc_dir = pjoin(cget("project_dir"), "code", "docs")
    create_target_directories([ddir], "755", user)

    # Delete the content of the folder if exist
    with settings(hide("running", "stdout", "stderr")):
        output = sudo('ls -A {doc_dir}'.format(doc_dir=ddir))
        if len(output) > 0:
            sudo("rm -r {doc_dir}/*".format(doc_dir=ddir))

    # Copy files to doc dir
    with settings(hide("running", "stdout")):
        run("cp -r {source}/* {dest}".format(source=source_doc_dir, dest=ddir))
    ensure_permissions(ddir, user=user, group=user, recursive=True)

    context = dict(env["ctx"])

    # Upload formatted build script
    scripts = ['make_apidoc.sh']
    local_dir = local_files_dir("doc")
    show(yellow("Uploading doc scripts: {0}.".format(' '.join(scripts))))
    for script_name in scripts:
        source = pjoin(local_dir, script_name)
        destination = pjoin(cget("script_dir"), script_name)
        upload_template_with_perms(source, destination, context, mode="755")

    # Upload formatted conf.py file
    show(yellow("Uploading formatted conf.py file."))
    conf_file = "conf_formatted.py"
    source = pjoin(cget("local_root"), "docs", 'source', conf_file)
    destination = pjoin(ddir, 'source', conf_file)
    upload_template_with_perms(source, destination, context, mode="755")
Example #3
0
def configure():
    """Upload supervisor configuration files."""
    user = cget('user')
    # settings directories
    sdir = cset('supervisor_dir', pjoin(cget('service_dir'), 'supervisor'))
    slogdir = cset('supervisor_log_dir', pjoin(cget('log_dir'), 'supervisor'))
    cset("supervisor_process_base", cget('project_name').replace('-', '_'))
    cset("supervisor_process_id",
         '%s%s' % (cget('supervisor_process_base'), '_supervisor'))
    # create all dirs and log dirs
    dirs = ['', 'config', cget('project_name')]
    dirs = [pjoin(sdir, l) for l in dirs]
    log_dirs = ['', cget('project_name'), 'child_auto', 'solr']
    log_dirs = [pjoin(slogdir, l) for l in log_dirs]
    create_target_directories(dirs + log_dirs, "700", user)

    context = dict(env["ctx"])
    local_dir = local_files_dir("supervisor")
    dest_dir = pjoin(sdir, 'config')

    confs = cget("supervisor_files")
    show(yellow("Uploading service configuration files: %s." % confs))
    for name in confs:
        source = pjoin(local_dir, name)
        destination = pjoin(dest_dir, name)
        if isdir(source):
            upload_templated_folder_with_perms(source,
                                               local_dir,
                                               dest_dir,
                                               context,
                                               mode="644",
                                               directories_mode="700")
        else:
            upload_template_with_perms(source,
                                       destination,
                                       context,
                                       mode="644")

    scripts = [
        'supervisorctl.sh', 'supervisord.sh', 'rabbitmq.sh',
        'celery-worker.sh', 'supervisord-services.sh',
        'supervisorctl-services.sh'
    ]
    for script_name in scripts:
        source = pjoin(cget("local_root"), 'deployment', 'scripts',
                       script_name)
        destination = pjoin(cget("script_dir"), script_name)
        upload_template_with_perms(source, destination, context, mode="755")
Example #4
0
def configure():
    """Upload supervisor configuration files."""
    user = cget("user")
    # settings directories
    sdir = cset("supervisor_dir", pjoin(cget("service_dir"), "supervisor"))
    slogdir = cset("supervisor_log_dir", pjoin(cget("log_dir"), "supervisor"))
    cset("supervisor_process_base", cget("project_name").replace("-", "_"))
    cset("supervisor_process_id", "%s%s" % (cget("supervisor_process_base"), "_supervisor"))
    # create all dirs and log dirs
    dirs = ["", "config", cget("project_name")]
    dirs = [pjoin(sdir, l) for l in dirs]
    log_dirs = ["", cget("project_name"), "child_auto", "solr"]
    log_dirs = [pjoin(slogdir, l) for l in log_dirs]
    create_target_directories(dirs + log_dirs, "700", user)

    context = dict(env["ctx"])
    local_dir = local_files_dir("supervisor")
    dest_dir = pjoin(sdir, "config")

    confs = cget("supervisor_files")
    show(yellow("Uploading service configuration files: %s." % confs))
    for name in confs:
        source = pjoin(local_dir, name)
        destination = pjoin(dest_dir, name)
        if isdir(source):
            upload_templated_folder_with_perms(source, local_dir, dest_dir, context, mode="644", directories_mode="700")
        else:
            upload_template_with_perms(source, destination, context, mode="644")

    scripts = [
        "supervisorctl.sh",
        "supervisord.sh",
        "rabbitmq.sh",
        "celery-worker.sh",
        "supervisord-services.sh",
        "supervisorctl-services.sh",
    ]
    for script_name in scripts:
        source = pjoin(cget("local_root"), "deployment", "scripts", script_name)
        destination = pjoin(cget("script_dir"), script_name)
        upload_template_with_perms(source, destination, context, mode="755")
Example #5
0
def configure():
    """Upload supervisor configuration files."""
    user = cget('user')
    # settings directories
    sdir = cset('supervisor_dir', pjoin(cget('service_dir'), 'supervisor'))
    slogdir = cset('supervisor_log_dir', pjoin(cget('log_dir'), 'supervisor'))
    cset("supervisor_process_base", cget('project_name').replace('-', '_'))
    cset("supervisor_process_id",
        '%s%s' % (cget('supervisor_process_base'), '_supervisor'))
    # create all dirs and log dirs
    dirs = ['', 'config', cget('project_name')]
    dirs = [pjoin(sdir, l) for l in dirs]
    log_dirs = ['', cget('project_name'), 'child_auto', 'solr']
    log_dirs = [pjoin(slogdir, l) for l in log_dirs]
    create_target_directories(dirs + log_dirs, "700", user)

    context = dict(env["ctx"])
    local_dir = local_files_dir("supervisor")
    dest_dir = pjoin(sdir, 'config')

    confs = cget("supervisor_files")
    show(yellow("Uploading service configuration files: %s." % confs))
    for name in confs:
        source = pjoin(local_dir, name)
        destination = pjoin(dest_dir, name)
        if isdir(source):
            upload_templated_folder_with_perms(source, local_dir, dest_dir,
                context, mode="644", directories_mode="700")
        else:
            upload_template_with_perms(
                source, destination, context, mode="644")

    scripts = ['supervisorctl.sh', 'supervisord.sh']
    for script_name in scripts:
        source = pjoin(cget("local_root"), 'deployment', 'scripts', script_name)
        destination = pjoin(cget("script_dir"), script_name)
        upload_template_with_perms(source, destination, context, mode="755")