コード例 #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 start_app():
    bundle('exec rake assets:precompile')
    # start()
    if os.path.isfile('/etc/nginx/sites-enabled/default'):
      os.remove('/etc/nginx/sites-enabled/default')
    status_set('active', '')
    set_state('app.restart')
コード例 #3
0
ファイル: huginn.py プロジェクト: cmars/juju-charm-huginn
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
ファイル: huginn.py プロジェクト: cmars/juju-charm-huginn
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')
    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")
    bundle("exec rake assets:precompile RAILS_ENV=production")
    host.service_restart('nginx')
    hookenv.status_set('active', 'Ready')
コード例 #5
0
def setup_tests():
    apt_install(['git'])
    if not os.path.exists(config('app-path')):
        clone()
    bundle('install')
    gen_sshkey()
コード例 #6
0
def migrate_db():
    bundle('exec rake db:migrate')
コード例 #7
0
def install_deps():
    bundle('install --without development test --deployment')
    status_set('maintenance', '')
    set_state('app.ready')