Code Monkey home page Code Monkey logo

puppet-nodejs's Introduction

puppet-nodejs

Build Status

This module allows you to install Node.js and NPM. This module is published on the Puppet Forge as willdurand/nodejs.

Installation

Manual installation

This modules depends on puppetlabs/stdlib and maestrodev/puppet-wget. So all repositories have to be checked out:

git clone git://github.com/willdurand/puppet-nodejs.git modules/nodejs
git clone git://github.com/puppetlabs/puppetlabs-stdlib.git modules/stdlib
git clone git://github.com/maestrodev/puppet-wget.git modules/wget

For Redhat based OS, the following are (typical) additional requirements:

git clone git://github.com/treydock/puppet-gpg_key.git modules/gpg_key

Puppet Module Tool:

puppet module install willdurand/nodejs

Librarian-puppet:

mod 'willdurand/nodejs', '1.x.x'

Usage

There are a few ways to use this puppet module. The easiest one is just using the class definition:

class { 'nodejs':
  version => 'v0.10.25',
}

This will compile and install Node.js version v0.10.25 to your machine. node and npm will be available in your $PATH via /usr/local/node/node-default/bin so you can just start using node.

Shortcuts are provided to easily install the latest or stable release by setting the version parameter to latest or stable. It will automatically look for the last release available on http://nodejs.org.

class { 'nodejs':
  version => 'stable',
}

Setup using the pre-built installer

To use the pre-built installer version provided via http://nodejs.org/download you have to set make_install to false

class { 'nodejs':
  version      => 'stable',
  make_install => false,
}

Setup multiple versions of Node.js

If you need more than one installed version of Node.js on your machine, you can just do it using the nodejs::install puppet define.

nodejs::install { 'v0.10.17':
  version => 'v0.10.17',
}
nodejs::install { 'v0.10.25':
  version => 'v0.10.25',
}

This snippet will install version v0.10.17 and v0.10.25 on your machine. Keep in mind that a Node.js version installed via nodejs::install will provide only versioned binaries inside /usr/local/bin!

/usr/local/bin/node-v0.10.17
/usr/local/bin/npm-v0.10.17

/usr/local/bin/node-v0.10.25
/usr/local/bin/npm-v0.10.25

By default, this module creates a symlink for the node binary (and npm) with Node.js version appended into /usr/local/bin e.g. /usr/local/bin/node-v0.10.17. All parameters available in the class definition are also available for nodejs::install.

Binary path

node and npm are linked to /usr/local/bin to be available in your system $PATH by default. To link those binaries to e.g /bin, just set the parameter target_dir.

class { 'nodejs':
  version    => 'stable',
  target_dir => '/bin',
}

NPM

Also, this module installs NPM by default. Since versions v0.6.3 of Node.js npm is included in every installation! For older versions, you can set parameter with_npm => false to not install npm.

NPM Provider

This module adds a new provider: npm. You can use it as usual:

package { 'express':
  provider => npm
}

Note: When deploying a new machine without nodejs already installed, your npm package definition requires the nodejs class:

class { 'nodejs':
  version => 'stable'
}

package { 'express':
  provider => 'npm',
  require  => Class['nodejs']
}

Proxy

When your puppet agent is behind a web proxy, export the http_proxy environment variable:

export http_proxy=http://myHttpProxy:8888

Running the tests

Install the dependencies using Bundler:

BUNDLE_GEMFILE=.gemfile bundle install

Run the following command:

BUNDLE_GEMFILE=.gemfile bundle exec rake test

Authors

License

puppet-nodejs is released under the MIT License. See the bundled LICENSE file for details.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.