Skip to content

This module manages sinopia npm-cache-server installations.

Notifications You must be signed in to change notification settings

gfargeas/puppet-sinopia

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

puppet-sinopia module

Overview

Install sinopia npm-cache-server (https://github.com/rlidwka/sinopia) for Debian, Ubuntu, Fedora, and RedHat.

Usage

There are two variants to install sinopia using this Puppet module: Apply-mode (with puppet-apply and no puppetmaster setup needed) or Master-Agent-mode (with puppet-agent accessing your configuration through the puppetmaster). In both variants you have to explicitely call "class nodejs {}" in your puppet script because the puppet-sinopia module only defines this as a requirement, so you have all the flexibility you want when installing nodejs. Scroll down for details about both variants.

General usage

class sinopia

Installs sinopia + required npms in one defined directory and integrates the sinopia as a service (/etc/init.d/sinopia). It also creates a user to run the sinopia server (default: sinopia). If you wish, you can change the username, see examples below.

Examples:

minimal:

  class { '::sinopia':
    conf_admin_pw_hash => 'your-pw-hash',
  }

You can generate the admin password hash according to https://github.com/rlidwka/sinopia via command-line:

  $ node
  > crypto.createHash('sha1').update('your-admin-password').digest('hex')

You can also override several configuration parameters.

  class { '::sinopia':
    install_root       	    => '/usr/local',
    install_dir        	    => 'sinopiaxy',
    conf_admin_pw_hash 	    => 'your-pw-hash',
    conf_port          	    => '8080',
    deamon_user        	    => 'sinopiaxy',
    conf_listen_to_address  => '127.0.0.1',
    http_proxy              => 'http://proxy.com:3128',
    https_proxy             => 'http://proxy.com:3128',
    conf_template           => 'mymodule/config.yaml.erb',
    service_template        => 'mymodule/service.erb',    
    conf_max_body_size	    => '10mb',
    conf_max_age_in_sec	    => '604800',
    install_as_service	    => false,
  }

The default values for all so far configurable parameters are:

  class { '::sinopia':
    install_root       	      => '/opt',
    install_dir        	      => 'sinopia',
    deamon_user        	      => 'sinopia',
    conf_listen_to_address    => '0.0.0.0',
    conf_port          	      => '4783',
    conf_admin_pw_hash
    conf_user_pw_combinations => undef,
    http_proxy                => '',
    https_proxy               => '',
    conf_template             => 'sinopia/config.yaml.erb',
    service_template          => 'sinopia/service.erb',
    conf_max_body_size	      => '1mb',
    conf_max_age_in_sec	      => '86400',
    install_as_service	      => true,
  }

Apply-mode installation

Here is an example for an Apply-mode installation in Debian Wheezy:

  1. Install puppet and facter according to https://docs.puppetlabs.com/guides/install_puppet/pre_install.html#next-install-puppet:
  wget https://apt.puppetlabs.com/puppetlabs-release-wheezy.deb
  dpkg -i puppetlabs-release-wheezy.deb
  apt-get update
  apt-get -y install puppet facter
  1. Download/clone all required modules into a modules directory:
  mkdir -p /opt/pp-sinopia/modules ; cd /opt/pp-sinopia/modules
  
  git clone https://github.com/puppetlabs/puppetlabs-stdlib.git stdlib
  git clone https://github.com/puppetlabs/puppetlabs-apt.git apt
  # for RHEL/Fedora/CentOS you will probably need yumrepo instead of apt
  
  git clone https://github.com/saheba/puppet-nodejs.git nodejs
  
  git clone https://github.com/saheba/puppet-sinopia.git sinopia
  1. Switch to the appropriate of the puppet-sinopia module:
  cd /opt/pp-sinopia/modules/sinopia
  git fetch --all
  git checkout npm_management
  1. Create a puppet script file:
  vim /opt/pp-sinopia/run.pp

5.run.pp content example:

  class { 'nodejs':
    # this automatically installs nodejs and npm
    make_default => true,
  }
  class { '::sinopia':
    conf_admin_pw_hash => 'your-pw-hash',
  }
  1. run puppet-apply with your script and the downloaded modules:
  puppet apply --modulepath=/opt/pp-sinopia/modules /opt/pp-sinopia/run.pp

Master-Agent-mode installation

In your puppet script for your agent add:

  class { 'nodejs':
    # this automatically installs nodejs and npm
    make_default => true,
 }
  class { '::sinopia':
    conf_admin_pw_hash => 'your-pw-hash',
  }

Supported Platforms

The module has been tested on the following operating systems. Testing and patches for other platforms are welcome.

  • RedHat EL6.
  • Debian Wheezy.

About

This module manages sinopia npm-cache-server installations.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Puppet 41.5%
  • HTML 34.5%
  • Shell 23.2%
  • Ruby 0.8%