Home

Awesome

sinopia cookbook

CK Version Build Status

Sinopia project : https://github.com/rlidwka/sinopia/

Sinopia is a private/caching npm repository server.

It allows you to have a local npm registry with zero configuration. You don't have to install and replicate an entire CouchDB database. Sinopia keeps its own small database and, if a package doesn't exist there, it asks npmjs.org for it keeping only those packages you use.

Requirements

Usage

Add recipe[sinopia] to the node runlist.

Default recipe with no other options will :

Defaults

Attributes

Every single Sinopia configuration item can be managed from node attributes. Default values are specified each time.

System configuration

Sinopia global conf

Users and rights

No users are created by default.

Example:

node['sinopia']['users']['bob']['pass'] = 'incredible'
node['sinopia']['users']['bob']['admin'] = true

node['sinopia']['users']['andy']['pass'] = 'toys'
node['sinopia']['users']['andy']['admin'] = true

node['sinopia']['users']['woody']['pass'] = 'buzz'

NPM Registry

You can store a list of available npm repositories in node['sinopia']['repos'] following {'name' => 'url'} syntax.

Default hash is loaded with official npmjs repo : default['sinopia']['repos'] = {'npmjs' => 'https://registry.npmjs.org/'}

Example :

node['sinopia']['repos'] = {
  'npmjs' => 'https://registry.npmjs.org/', # official npmjs repo
  'myrepo' => 'https://myrepo.local/',
  'other' => 'https://third-party-repo.com'
}

node['sinopia']['mainrepo'] : (npmjs) Caching repository name selected from available repos list

Filters

Example :

node['sinopia']['filters'] = [
  {
    'name' => 'private-*',
    'storage' => 'private-repo'
  },
  {
    'name' => 'admin-*',
    'access' => ['andy', 'woody']
  },
  {
    'name' => 'test-*',
    'access' => '@admins'
  }
]

Logging

This cookbook is reusing specific logging format of Sinopia :

type: file | stdout | stderr
level: trace | debug | info | http (default) | warn | error | fatal

{type: 'file', path: 'sinopia.log', level: 'debug'},

parameters for stdout and stderr: format: json | pretty
{type: 'stdout', format: 'pretty', level: 'debug'}

You can add as much logger as you want (including '{}') in default['sinopia']['logs'] Array

Default value is :

node['sinopia']['logs'] = [
  "{type: file, path: '/var/log/sinopia/sinopia.log', level: warn}"
]

Proxy

See attributes/default.rb to view how to configure node['sinopia']['use_proxy'] and node['sinopia']['proxy'].

NPM

See attributes/default.rb to view Node & npm install options (version, source/package, ...)

Recipes

sinopia::default recipe includes :

Testing

Sinopia cookbook is bundled with a Vagrantfile. If you have virtualbox and vagrant ready, just fire a vagrant up and this will setup a box running Sinopia and listening 0.0.0.0:4873. Port 4873 is forwaded to your 127.0.0.1:4873 for test purposes.

Author

Author:: Barthelemy Vessemont (bvessemont@gmail.com)