GithubHelp home page GithubHelp logo

isabella232 / puppet-verdaccio Goto Github PK

View Code? Open in Web Editor NEW

This project forked from verdaccio/puppet-verdaccio

0.0 0.0 0.0 39 KB

Puppet verdaccio support

Home Page: http://www.verdaccio.org/

License: MIT License

Shell 16.44% Ruby 7.83% Puppet 45.68% HTML 30.05%

puppet-verdaccio's Introduction

puppet-verdaccio module

Overview

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

Usage

There are two variants to install verdaccio 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-verdaccio module only defines this as a requirement, so you have all the flexibility you want when installing nodejs. Scroll down for details about Master-Agent-mode variant.

General usage

class verdaccio

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

Examples:

minimal:

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

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

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

If you want to manage user accounts with an htpasswd file instead of a list of users, omit config_admin_pw_hash, set htpasswd_auth => true and decide how to manage the htpasswd file, e.g.:

  class { '::verdaccio':
    htpasswd_auth => true,
  }
  file { '/opt/verdaccio/htpasswd':
    ensure  => present,
    source  => 'puppet:///modules/site/verdaccio/htpasswd',
    owner   => 'verdaccio',
    group   => 'verdaccio',
    mode    => '0600',
  }

You can also override several configuration parameters.

  class { '::verdaccio':
    install_root            => '/usr/local',
    install_dir             => 'verdaccioxy',
    conf_admin_pw_hash      => 'your-pw-hash',
    conf_port               => '8080',
    daemon_user             => 'verdaccioxy',
    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',
    service_ensure          => 'stopped',
    conf_max_body_size      => '10mb',
    conf_max_age_in_sec     => '604800',
    install_as_service      => false,
    public_npmjs_proxy      => false,
    url_prefix              => 'https://dev.company.local/sinopia/',
    time_out                => '30000'
    htpasswd_auth           => true,
  }

The default values for all so far configurable parameters are:

  class { '::verdaccio':
    install_root              => '/opt',
    install_dir               => 'verdaccio',
    daemon_user               => 'verdaccio',
    conf_listen_to_address    => '0.0.0.0',
    conf_port                 => '4873',
    conf_admin_pw_hash        => undef,
    conf_user_pw_combinations => undef,
    http_proxy                => '',
    https_proxy               => '',
    conf_template             => 'verdaccio/config.yaml.erb',
    service_template          => 'verdaccio/service.erb',
    service_ensure            => 'running',
    conf_max_body_size        => '1mb',
    conf_max_age_in_sec       => '86400',
    install_as_service        => true,
    public_npmjs_proxy        => true,
    url_prefix                => undef,
    time_out                  => undef
    htpasswd_auth             => false,
  }

The public_npmjs_proxy parameter defaults to true, and will result in the following packages configuration block in your config.yaml:

packages:
  '*':
    allow_access: all
    allow_publish: authenticated
    proxy: npmjs

Set it to false to define your own package settings using verdaccio::package (see below):

  class { '::verdaccio':
    conf_admin_pw_hash => 'your-pw-hash',
    public_npmjs_proxy => false,
  }

define verdaccio::package

You can customise the packages configuration using defined type verdaccio::package:

  verdaccio::package {
    '@public-*/*':
      allow_access  => 'all',
      allow_publish => 'authenticated';
    '@private-*/*':
      allow_access  => 'authenticated',
      allow_publish => 'admin',
    '*':
      allow_access  => 'all',
      allow_publish => 'admin',
      proxy         => 'npmjs',
      order         => '999';
  }

The order parameter is used by puppetlabs-concat to determine the order in which each package section appears in config.yaml.

Master-Agent-mode installation

In your puppet script for your agent add:

  class { 'nodejs':
    # this automatically installs nodejs and npm
    make_default => true,
 }
  class { '::verdaccio':
    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 EL7.

puppet-verdaccio's People

Contributors

juanpicado avatar aboks avatar dickp avatar dharmender-singh avatar vineetmadan avatar bgmncwj avatar

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.