Skip to content
This repository was archived by the owner on May 14, 2021. It is now read-only.
This repository was archived by the owner on May 14, 2021. It is now read-only.

application_unicorn resource's upstart template not generating a .conf file for service #88

@SimonKaluza

Description

@SimonKaluza

During the convergence of our application block, Chef never winds up triggering the application_unicorn's Upstart LWRP provider's Upstart#create_service method that creates the Upstart conf file that governs the app.

Because this conf file never gets generated, Upstart does not recognize the service "my_app_web" and when Chef attempts to restart the service we get the exception output:

   ================================================================================
   Error executing action `restart` on resource 'application[my_app_web]'
   ================================================================================

   Mixlib::ShellOut::ShellCommandFailed
   ------------------------------------
   application_unicorn[my_app_web] (my_app-chef::app_server line 161) had an error: Mixlib::ShellOut::ShellCommandFailed: poise_service[my_app_web] (/var/chef/cache/cookbooks/my_app-chef/recipes/app_server.rb line 161) had an error: Mixlib::ShellOut::ShellCommandFailed: service[my_app_web_app] (/var/chef/cache/cookbooks/my_app-chef/recipes/app_server.rb line 161) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
   ---- Begin output of /sbin/start my_app_web_app ----
   STDOUT:
   STDERR: start: Unknown job: my_app_web_app
   ---- End output of /sbin/start my_app_web_app ----
   Ran /sbin/start my_app_web_app returned 1

   Cookbook Trace:
   ---------------
   /var/chef/cache/cookbooks/poise-service/files/halite_gem/poise_service/service_providers/base.rb:75:in `block in action_start'
   /var/chef/cache/cookbooks/poise-service/files/halite_gem/poise_service/service_providers/base.rb:135:in `notify_if_service'
   /var/chef/cache/cookbooks/poise-service/files/halite_gem/poise_service/service_providers/base.rb:74:in `action_start'
   /var/chef/cache/cookbooks/poise-service/files/halite_gem/poise_service/service_providers/upstart.rb:45:in `action_restart'
   /var/chef/cache/cookbooks/poise-service/files/halite_gem/poise_service/service_mixin.rb:125:in `block in action_restart'
   /var/chef/cache/cookbooks/poise-service/files/halite_gem/poise_service/service_mixin.rb:154:in `notify_if_service'
   /var/chef/cache/cookbooks/poise-service/files/halite_gem/poise_service/service_mixin.rb:124:in `action_restart'
   /var/chef/cache/cookbooks/application/files/halite_gem/poise_application/resources/application.rb:249:in `block in proxy_action'
   /var/chef/cache/cookbooks/application/files/halite_gem/poise_application/resources/application.rb:247:in `proxy_action'
   /var/chef/cache/cookbooks/application/files/halite_gem/poise_application/resources/application.rb:229:in `action_restart'

Here is our cookbook's full application block:

application 'my_app_web' do
  path "#{node['my_app']['app_deploy_root']}/latest"
  git 'git@github.com:myapp.git' do
    deploy_key deploy_key['rsa']
    revision node['my_app']['revision']
  end
  ruby_runtime 'my_app_ruby' do
    version '2.2'
    provider :ruby_build
  end

  bundle_install do
    path "#{node['my_app']['app_deploy_root']}/latest" # Have to respecify path?  Ghetto as fuck, thanks Poise cookbooks
    vendor true
  end

  rails do
    rails_env node['my_app']['environment_name']
    path "#{node['my_app']['app_deploy_root']}/latest"
    database({
                 adapter: 'postgresql',
                 database: node['my_app']['postgres']['database'],
                 timeout: 5000,
                 username: postgres_credentials['application_username'],
                 password: postgres_credentials['application_password'],
                 host: node['my_app']['master_db_ip'].nil? ? 'localhost' : node['my_app']['master_db_ip'],
                 pool: 100,
                 redis_url: "redis://#{node['my_app']['master_db_ip']}:6379"
             })
    precompile_assets true
    migrate true
  end

  unicorn do
    path "#{node['my_app']['app_deploy_root']}/latest"
    port '8080'
    service_name 'my_app_web_app'
    action :enable
  end
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions