예제 #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!')
예제 #2
0
def download_archive():
    """
    Downloads Huginn
    """
    hookenv.log("Cloning Huginn", "info")
    if not path.isdir(ruby_dist_dir()):
        makedirs(path.dirname(ruby_dist_dir()))
        git("clone --depth 1 https://github.com/cantino/huginn.git "
            "-b master {}".format(ruby_dist_dir()))
    else:
        chdir(ruby_dist_dir())
        git("pull")
예제 #3
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!')
예제 #4
0
def config_changed():

    if not is_state('nginx.available'):
        return

    target = path.join(ruby_dist_dir(), '.env.local')
    render(source='app.env',
           target=target,
           context=config)

    host.service_restart('nginx')
    hookenv.status_set('active', 'Ready')
예제 #5
0
def setup_mysql(mysql):
    """ Mysql is available, update Huginn
    """
    hookenv.status_set('maintenance', 'Huginn is connecting to MySQL!')
    target = path.join(ruby_dist_dir(), '.env.local')
    render(source='db.env',
           target=target,
           context=dict(db=mysql))

    bundle("exec rake db:create RAILS_ENV=production")
    bundle("exec rake db:migrate RAILS_ENV=production")
    bundle("exec rake db:seed RAILS_ENV=production")
    host.service_restart('nginx')
    hookenv.status_set('active', 'Ready')