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!')
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')
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!')
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')
def setup_tests(): apt_install(['git']) if not os.path.exists(config('app-path')): clone() bundle('install') gen_sshkey()
def migrate_db(): bundle('exec rake db:migrate')
def install_deps(): bundle('install --without development test --deployment') status_set('maintenance', '') set_state('app.ready')