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.
The only requirement is the nodejs
cookbook
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 |
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.
Installs node.js using the nodejs::default recipe.
Installs pm2 and associated packages.
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.
- Fork the repository on Github
- Create a named feature branch (like
add_component_x
) - Write your change
- Write tests for your change (if applicable)
- Run the tests, ensuring they all pass
- Submit a Pull Request using Github
Authors: Joe Richards [email protected]