Пример #1
0
def install():
    adduser('django')
    dcfg = django.config()
    status_set('maintenance', 'installing system deps')
    apt_install(['build-essential', 'binutils-doc', 'autoconf', 'authbind',
                 'bison', 'libjpeg-dev', 'libfreetype6-dev', 'zlib1g-dev',
                 'libzmq3-dev', 'libgdbm-dev', 'libncurses5-dev', 'automake',
                 'libtool', 'libffi-dev', 'curl', 'git', 'gettext', 'flex',
                 'postgresql-client', 'postgresql-client-common', 'python3',
                 'python3-pip', 'python-dev', 'python3-dev', 'python-pip',
                 'libxml2-dev', 'virtualenvwrapper', 'libxslt-dev', 'git-core',
                 'python-git', 'libpq-dev'] + dcfg.get('apt-packages', []))

    subprocess.check_call([django.pip(), 'install', 'circus', 'gunicorn', ])
    source_install(dcfg)
    open_port(config('django-port'))
    start()
Пример #2
0
def source_install(dcfg):
    source = dcfg.get('source', {})
    status_set('maintenance', 'installing %s repo' % source['url'])
    if not os.path.exists(dcfg.get('install-path')):
        os.makedirs(dcfg.get('install-path'))

    source_path = install_remote(source['url'],
                                 dest=dcfg.get('install-path'))

    dcfg.set('source-path', source_path)

    status_set('maintenance', 'installing project deps')
    if dcfg.get('pip-requirements'):
        django.call([django.pip(), 'install', '-r',
                     dcfg.get('pip-requirements')])

    render(source='circus.ini.j2',
           target='/etc/circus.ini',
           owner='root',
           group='root',
           perms=0o644,
           context={
            'install_path': source_path,
            'wsgi': dcfg.get('wsgi'),
            'port': config('django-port'),
            'config_import': dcfg.get('config-import'),
        })

    render(source='circus.conf.j2',
           target='/etc/init/circus.conf',
           owner='root',
           group='root',
           perms=0o644,
           context={})

    set_state('django.source.available')
    set_state('django.restart')