Skip to content

Latest commit

 

History

History
executable file
·
101 lines (85 loc) · 2.51 KB

README.md

File metadata and controls

executable file
·
101 lines (85 loc) · 2.51 KB

pm2 Cookbook

This Chef cookbook provides recipes to install and setup node.js, pm2 and provides an LWRP for easy setup of node apps managed by pm2.

Requirements

The only requirement is the nodejs cookbook

Attributes

pm2::default

Key Type Description Default
['pm2']['app_name'] String A name for the node app app
['pm2']['port'] String Port for the backend 8080
['pm2']['path'] String Path to the root of the node app /var/www/app
['pm2']['user'] String User to run the node app as nobody
['pm2']['group'] String Group to run the node app as nobody
['pm2']['js'] String Main JS file to run app.coffee

Usage

pm2::default

Installs node.js, pm2, and a pm2 application. You must set the pm2 attributes for this recipe to work and it assumes you are running only a single application with pm2.

pm2::nodejs

Installs node.js using the nodejs::default recipe.

pm2::pm2

Installs pm2 and associated packages.

LWRP: pm2_app

This LWRP provides a simple way to deploy multiple applications with pm2. Usage is as follows:

pm2_app 'my_app_1' do
    path    '/var/www/my_app_1'
    js      'main.js'
    user    'nobody'
    group   'nobody'
    port    '8080'
    action  :create
end

This will setup a node.js application with pm2 called "my_app_1" with your code located at the path specified. Pm2 will run the code as the specified user/group and setup a listener on the specified port. If these attributes aren't specified, it will default to the node pm2 attributes.

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

Authors: Joe Richards [email protected]