Example #1
0
def install_app():
    """ Performs application installation
    """

    hookenv.log('Installing Huginn', 'info')

    # Configure NGINX vhost
    nginxlib.configure_site('default', 'vhost.conf',
                            app_path=ruby_dist_dir())

    # Update application
    huginnlib.download_archive()
    shell("mkdir -p %s/{log,tmp/pids,tmp/sockets}" % (ruby_dist_dir()))
    shell("cp %(dir)s/config/unicorn.rb.example "
          "%(dir)s/config/unicorn.rb" % {'dir': ruby_dist_dir()})

    bundle("install --deployment --without development test")
    procfile = path.join(hookenv.charm_dir(), 'templates/Procfile')
    shell("cp %(procfile)s %(dir)s/Procfile" % {
        'procfile': procfile,
        'dir': ruby_dist_dir()
    })

    bundle("exec rake assets:precompile RAILS_ENV=production")

    host.service_restart('nginx')
    hookenv.status_set('active', 'Huginn is installed!')
Example #2
0
def install_presentation():
    """ Install presentation
    """

    opts = layer.options('git-deploy')

    # Clone repo
    hookenv.status_set('maintenance',
                       'Installing and building the presentation.')

    # Build and install
    with chdir(opts.get('target')):
        with open('requirements.txt', 'r') as f:
            for i in list(map(lambda b: b.strip('\n'), f.readlines())):
                pip_install(i)

        sphinx_build_cmd = 'sphinx-build -b html source %s' % opts.get(
            'target')
        subprocess.call(sphinx_build_cmd.split(), shell=False)
    present_chown_cmd = 'chown -R www-data:www-data %s' % opts.get('target')
    subprocess.call(present_chown_cmd.split(), shell=False)

    # Configure nginx vhost
    configure_site('present', 'present.vhost', app_path=opts.get('target'))

    # Open presentation front-end port
    hookenv.open_port(config['port'])

    # Set status
    hookenv.status_set('active',
                       'Presentation is active on port %s' % config['port'])
    # Set state
    set_state('presentation.available')
Example #3
0
def install_presentation():

    """ Install presentation
    """

    opts = layer.options('git-deploy')

    # Clone repo
    hookenv.status_set('maintenance', 
                       'Installing and building the presentation.')

    # Build and install
    with chdir(opts.get('target')):
        with open('requirements.txt', 'r') as f:
            for i in list(map(lambda b: b.strip('\n'), f.readlines())):
                pip_install(i)

        sphinx_build_cmd = 'sphinx-build -b html source %s' % opts.get('target')
        subprocess.call(sphinx_build_cmd.split(), shell=False)
    present_chown_cmd = 'chown -R www-data:www-data %s' % opts.get('target')
    subprocess.call(present_chown_cmd.split(), shell=False)   
    
    # Configure nginx vhost
    configure_site('present', 'present.vhost', app_path=opts.get('target'))

    # Open presentation front-end port
    hookenv.open_port(config['port'])

    # Set status
    hookenv.status_set('active', 
                       'Presentation is active on port %s' % config['port'])
    # Set state
    set_state('presentation.available')
def configure_nginx():
    with maintenance_status('Generating NGinX configuration',
                            'NGinX configuration generated'):
        config_ctx = {
            'server_name': get_local_registry_or_host(),
            'cache_dir': get_cache(node_dist_dir(), get_user()),
        }
        configure_site('npm-offline-rgistry', 'vhost.conf.j2', **config_ctx)
        hookenv.open_port(hookenv.config('port'))
Example #5
0
def create_vhost():
    nginxlib.configure_site(
        'charmsvg',
        'charmsvg-vhost.conf',
        server_name='_',
        source_path=charmsvg.INSTALL_PATH,
        socket=uwsgi.config('charmsvg').get('socket'),
    )

    hookenv.open_port(80)
    is_ready()
    set_state('charm-svg.nginx.configured')
Example #6
0
def install_app():
    """ Performs application installation
    """

    hookenv.log('Installing Wordpress', 'info')

    # Configure NGINX vhost
    nginxlib.configure_site('default', 'vhost.conf')

    # Update application
    wordpresslib.download_archive()

    host.service_restart('nginx')
    hookenv.status_set('active', 'Wordpress is installed!')
def install_app():
    """ Performs application installation
    """

    hookenv.log('Installing Wordpress', 'info')

    # Configure NGINX vhost
    nginxlib.configure_site('default', 'vhost.conf')

    # Update application
    wordpresslib.download_archive()

    host.service_restart('nginx')
    hookenv.status_set('active', 'Wordpress is installed!')
Example #8
0
def install_whelp():
    '''
    Reactive hook to install whelp
    '''
    hookenv.status_set('maintenance', 'Installing whelp')

    whelp = Whelp()

    whelp_tar = hookenv.resource_get('webapp')

    hookenv.status_set('maintenance', 'installing webapp')

    # Extract tar resource
    tar = tarfile.open(whelp_tar)
    tar.extractall(WHELP_HOME)

    # Install pip3 reqs
    with chdir('/srv/whelp/whelp'):
        with open('requirements.txt', 'r') as f:
            for i in list(map(lambda b: b.strip('\n'), f.readlines())):
                pip_install(i)

    # Set permissions
    chownr(WHELP_HOME, 'www-data', 'www-data')

    # Get state files for whelp to run
    whelp.get_whelp_bucket_files()

    # Configure NGINX
    configure_site('whelp',
                   'whelp.vhost',
                   port=config['port'],
                   whelp_port=config['whelp-port'])

    # Start Supervisor
    subprocess.call('supervisord -c /etc/supervisor/supervisord.conf'.split(),
                    shell=False)

    # Render whelp supervisor.conf
    whelp.render_whelp_supervisor_conf()

    # Open port 80
    hookenv.open_port(config['port'])

    # Set status to active
    hookenv.status_set('active', 'Whelp is active on port %s' % config['port'])

    # Set whelp.available state
    set_state('whelp.installed')
Example #9
0
def install_app():
    """ Performs application installation
    """

    hookenv.log('Installing Huginn', 'info')

    # Configure NGINX vhost
    nginxlib.configure_site('default', 'vhost.conf')

    # Update application
    huginnlib.download_archive()
    shell("mkdir -p {}/{log,tmp/pids,tmp/sockets}".format(ruby_dist_dir()))
    shell("cp {}/config/unicorn.rb.example "
          "{}/config/unicorn.rb".format(ruby_dist_dir()))

    bundle("install --deployment --without development test")
    host.service_restart('nginx')
    hookenv.status_set('active', 'Huginn is installed!')
Example #10
0
def write_vhost():
    conf = hookenv.config()
    configure_site('wallabag', 'vhost.conf',
        app_path=APP_PATH,
        server_name=conf['server_name'],
    )
Example #11
0
def configure_nginx():
    """
    Once nginx is ready, setup our vhost entry.
    """
    nginxlib.configure_site('default', 'vhost.conf')
    set_state('ghost.nginx.configured')