Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms

Select Status

RSS

application_procfile (13) Versions 0.3.42

Installs/Configures services from an application's Procfile

Policyfile
Berkshelf
Knife
cookbook 'application_procfile', '~> 0.3.42', :supermarket
cookbook 'application_procfile', '~> 0.3.42'
knife supermarket install application_procfile
knife supermarket download application_procfile
README
Dependencies
Changelog
Quality 17%

application_procfile Cookbook

This cookbook installs initscripts and monitrc files for the different process types specified in your application's Procfile.

Requirements

cookbooks

  • application - application_procfile needs the application cookbook to discover a Procfile.
  • monit - application_procfile needs the monit cookbook to configure services under monit.

gems

  • foreman - application_procfile uses the foreman gem's Procfile parser.

Usage

<cookbook>/metadata.rb:

depends 'application_procfile'

<cookbook>/recipes/default.rb:

include_recipe 'application_procfile'

application 'someapp' do
  ...
  procfile do
    web node[:someapp][:processes][:web] || 1, :reload => 'USR2', :health_check => { :path => '/system/status', :timeout => 10, :unhealthy => 10, :action => :alert }, :limit => { :totalmem => '512 MB', :unhealthy => 10 }
    worker node[:someapp][:processes][:worker] || 2, :limit => { :totalmem => '192 MB' }
  end
end

This will run a default of 1 web and 2 workers for a Procfile that looks like:

web: bundle exec unicorn -c ./config/unicorn.rb
worker: bundle exec rake resque:work

If you provide a port number via a node attribute node[:app][:port] then it will be incremented automatically and made available to your Procfile commands:

web: bundle exec thin start -p $PORT

Any output to stderr or stdout from your processes will be logged to files like:

/var/log/someapp/web.log
/var/log/someapp/worker.log

To restart your workers:

touch /var/local/someapp/worker.restart

The reload option specifies an optional signal that can be sent to processes to gracefully reload them by doing:

touch /var/local/someapp/web.reload

If the process is unicorn a HUP and USR2 combination will be used automatically, with no need for the reload option.

To properly support reloads for unicorn processes, a unicorn.rb with before_fork, correct paths and worker numbers will be installed in the shared directory and will include your config/unicorn.rb if you have one.

You can specify resource limits with the :limit option, such as :mem, :totalmem, :cpu, :totalcpu, or :children.

For :mem and :totalmem the value is the maximum allowable memory for the process or the process and all it's children, respectively, as B, KB, MB, GB, or %. (eg. :limit => { :totalmem => '512 MB' })

For :cpu, and :totalcpu the value is the maxmimum allowable CPU usage for the process or the process and all it's children, respectively, as %. (eg. :limit => { :totalcpu => '90%' })

For :children the value is the maximum number of child processes allowed for the process. (eg. :limit => { :children => 10 })

Within :limit you can specify the action to be taken :alert, :restart, or :stop when any of the limits are exceeded. (eg. :limit => { :cpu => '25%', :action => :alert })

You can also specify the number of times the limits must exceed their values before taking action using :unhealthy. (eg. :limit => { :mem => '10%', :unhealthy => 10 })

You can specify a health check with the :health_check option as long as the port your service is listening on is accessible via node attribute as node[:app][:port] or you specify a :port in your health check. (eg. :health_check => { :port => 8080, :path => '/system/status', :timeout => 10, :unhealthy => 10, :action => :alert })

Contributing

  1. Fork the repository on Github
  2. Create a named feature branch (like add_component_x)
  3. Write your change
  4. Write tests for your change (if applicable)
  5. Run the tests, ensuring they all pass
  6. Submit a Pull Request using Github

License and Authors

Author:: Javier Muniz javier@granicus.com
Author:: Matt Kasa mattk@granicus.com

Copyright 2014, Granicus Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Dependent cookbooks

application >= 3.0.0
monit >= 0.0.0

Contingent cookbooks

There are no cookbooks that are contingent upon this one.

CHANGELOG for application_procfile

This file is used to list changes made in each version of application_procfile.

0.3.42

  • Fix bug where unicorn attempts to start when number of processes is 0

0.3.41

  • Add special behavior for thin (1 worker, SIGINT to stop)

0.3.40

  • Fix PATH handling to be consistent across wrapper and initscript

0.3.38

  • Fix bug in pid_prefix

0.3.37

  • Fix references to app_unicorn_rb_path and workers variables in procfile_unicorn_rb definition

0.3.36

  • Fix reference to type variable in procfile_unicorn_rb definition

0.3.35

  • Capture new_resource variables in local variables
  • Test against older versions of application and application_ruby
  • Upgrade ffi gem for OSX users

0.3.34

  • Convert to Berkshelf
  • Add ChefSpec tests
  • Add BATS tests
  • Wrap foreman compile time require in a rescue
  • Add foreman converge time require in a ruby_block

0.3.33

  • Refactor ProcfileHelpers
  • Move recipe methods to definitions

0.3.32

  • Add ability to package and upload directly to the Chef Supermarket using rake upload
  • Increase the granularity of the 30 second check
  • Use PID file as a lock for starting a new process
  • Use /dev/null for thin's PID file

0.3.31

  • Check for 60 seconds to ensure process exits via SIGTERM then send SIGKILL, add special behavior for thin, improvements to packaging process

0.3.30

  • Preserve unicorn before_exec/before_fork callbacks, change license to Apache v2.0

0.3.29

  • Look for PORT environment variable and increment it for multiple processes

0.3.28

  • Use monit to reload monitrc instead of initscript

0.3.27

  • Fix syntax error in monitrc template and handle missing node attributes

0.3.26

  • Pass instance of ProcfileHelpers class to create_lock_directory

0.3.25

  • Pass instance of ProcfileHelpers class to methods that need it

0.3.24

  • Remove singleton from ProcfileHelpers class to enable it to be used from multiple application blocks in a single converge

0.3.23

  • Add DSL for monit http health check

0.3.22

  • Add DSL for monit resource limits

0.3.21

  • Add current_release helper method

0.3.20

  • Abandon instance variable pointing to ProcfileHelpers.instance

0.3.19

  • Try new_resource instead of @new_resource

0.3.18

  • Try setting ProcfileHelpers attributes from before_compile

0.3.17

  • Instantiate path/name/node for ProcfileHelpers in provider

0.3.16

  • Set ProcfileHelpers new_resource to @application in initialize

0.3.15

  • Make ProcfileHelpers a singleton

0.3.14

  • Move new_resource and node initialization to attributes set from action blocks

0.3.13

  • Refactor ProcfileHelpers as a class

0.3.12

  • Include ProcfileHelpers in the scope of the provider so it has access to node and new_resource

0.3.11

  • Move helper methods into ProcfileHelpers module

0.3.10

  • Try not overlapping namespaces

0.3.9

  • Try include instead of extend since we are in an instance of Chef::Provider

0.3.8

  • Refactor library methods to not pass things around and move DSL wrappers to provider

0.3.7

  • Pass new_resource to library helper methods

0.3.6

  • Pass node to environment_attributes call

0.3.5

  • Fix environment_attributes call

0.3.4

  • Namespace helper methods inside Helpers module

0.3.3

  • Call helper methods with self from within helpers

0.3.2

  • Put helper methods inside Chef Application namespace

0.3.1

  • Put helper methods inside Chef namespace

0.3.0

  • Move protected methods to library as helper methods

0.2.7

  • Perform lock and pid file migration during before_deploy

0.2.6

  • Ensure enclosing lock directory exists

0.2.5

  • Move lock and pid files to /var/local since /var/run and /var/lock are tmpfs mounts in ubuntu

0.2.4

  • Move directives in unicorn.rb so they can be overridden by the application

0.2.3

  • Remove unicorn start context hack

0.2.2

  • Fix issue with PATH during environment reload

0.2.1

  • Move methods back out of libraries until we find a pattern that works

0.2.0

  • Refactor library methods and add more Unicorn magic

0.1.48

  • Fix working directory used in BUNDLE_GEMFILE

0.1.47

  • Try updating all the application sub-resource environments

0.1.45

  • Move application environment population to before_compile

0.1.45

  • Add BUNDLE_GEMFILE to unicorn.rb to support zero-downtime deploys

0.1.44:

  • Remove unnecessary environment update

0.1.43:

  • Use application environment instead of ENV

0.1.42:

  • Remove PATH_PREFIX prepend from ENV

0.1.41:

  • Use PATH_PREFIX instead of PATH to avoid overriding PATH

0.1.40:

  • Treat PATH from application environment as an append

0.1.39:

  • Use PATH from application environment

0.1.38:

  • Add PATH to environment

0.1.37:

  • Reload processes after environment changes

0.1.36:

  • Fix env_path

0.1.35:

  • Add support for reloading the environment

0.1.34:

  • Fix unicorn.rb path preservation

0.1.33:

  • Fix unicorn.rb path replacement

0.1.32:

  • Add path to shared/unicorn.rb even if -c/--config-file is missing, otherwise preserve old value in shared/unicorn.rb

0.1.31:

  • Only load unicorn.rb if it exists (this might be important)

0.1.30:

  • Use instance_eval instead of require for unicorn.rb

0.1.29:

  • Write static require path for unicorn.rb

0.1.28:

  • Fix require path for unicorn.rb

0.1.27:

  • Fix bug in create_lock_file and remove duplicate exports from initscripts

0.1.26:

  • Update initscripts and monit configs from before_deploy

0.1.25:

  • Fix unicorn reload path and monitrc paths

0.1.24:

  • Fix unicorn.rb application path

0.1.23:

  • Fix application paths

0.1.22:

  • Add unicorn reload block to before_restart

0.1.21:

  • Use static owner/group for unicorn.rb template

0.1.20:

  • Put static template block in before_restart and before_deploy

0.1.19:

  • Export node attributes from node[:application_name][:env]

0.1.18:

  • Fix paths in monitrc

0.1.17:

  • Fix absolute paths

0.1.16:

  • Write unicorn.rb from both before_deploy and before_restart to correct issues with Procfile not being available

0.1.15:

  • Assume process type web for unicorn

0.1.14:

  • Upgrade for application >= 3.0.0 and fix unicorn.rb creation in before_deploy

0.1.13:

  • Refactor procfile provider and add unicorn.rb template

0.1.12:

  • Fix start syntax and depends on reload in monitrc

0.1.11:

  • Remove monit restart

0.1.10:

  • Touch reload files in restart_command and restart monit :delayed

0.1.9:

  • Run touch on reload files from after_restart

0.1.8:

  • Use local variable for new_resource

0.1.7:

  • Reload monit in restart_command and add :delayed touch to reload files

0.1.6:

  • Remove monit restart

0.1.5:

  • Add delayed restart of monit and force UTF-8 in application environment

0.1.4:

  • Use resource name to load node attributes into the environment instead of sourcing /etc/profile

0.1.3:

  • Use resource name in restart/reload file names in monit to help avoid naming collisions

0.1.2:

  • Now use reload to restart services for processes supporting zero-downtime deploys

0.1.1:

  • Now explicitly restarts services

0.1.0:

  • Initial release of application_procfile

Check the Markdown Syntax Guide for help with Markdown.

The Github Flavored Markdown page describes the differences between markdown on github and standard markdown.

Collaborator Number Metric
            

0.3.42 failed this metric

Failure: Cookbook has 0 collaborators. A cookbook must have at least 2 collaborators to pass this metric.

Contributing File Metric
            

0.3.42 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file

Foodcritic Metric
            

0.3.42 failed this metric

FC016: LWRP does not declare a default action: application_procfile/resources/procfile.rb:1
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any

No Binaries Metric
            

0.3.42 passed this metric

Testing File Metric
            

0.3.42 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file

Version Tag Metric
            

0.3.42 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number