Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to clone from a github repo and then run npm install on puppet

I have worked out how to fire up a vagrant box and apt-get install packages

I now want to git clone a node.js repo from github before running npm install and running the app with node app.js

I expected to be able to achieve this by issuing BASH commands, but I see now that puppet requires this to be done in a puppety way. The results from Google on this issue are confusing and inconsistent.

So- how do you tell Puppet to git clone a node.js package from github and then install it with npm install?

like image 491
Fergie Avatar asked Aug 20 '13 07:08

Fergie


People also ask

How do I run a npm project from GitHub?

In terminal at the root of the project run npm install to install necessary dependencies. Then check if npm start is set up properly inside the 'Scripts' object in your package. json Finally run npm start This should do it for you, but most attention should paid to instructions inside README.md provided by developer.


1 Answers

You can use the puppet-nodejs module to manage npm packages. Take a look at https://forge.puppetlabs.com/puppetlabs/nodejs

Otherwise, this article should explain how to clone a git repo. http://livecipher.blogspot.com.au/2013/01/deploy-code-from-git-using-puppet.html

More info can be found at https://github.com/puppetlabs/puppetlabs-vcsrepo.

Once installed you should be able to do something like:

vcsrepo { "/path/to/repo":
  ensure => present,
  provider => git,
  source => 'git://example.com/repo.git',
  revision => 'master'
}
like image 73
Andrew Dwyer Avatar answered Oct 12 '22 23:10

Andrew Dwyer