Giter VIP home page Giter VIP logo

nopar's Introduction

NOPAR - The Node PAckage Registry & proxy

Provides a local NPM registry that also proxies and caches unknown node packages from the original npm registry at http://registry.npmjs.org.

Build Status

Install the server

It's available from the official NPM registry, so all you need is:

npm install -g nopar

On my build server I create an archive (see scripts/package) and extract the whole shebang into /usr/local/nopar with an install script (see scripts/install-nopar.sh).

Usage

If you installed NOPAR via npm install -g nopar, then a start script is be installed into your path and you can simply run:

nopar

With the default configuration, the registry is available at http://localhost:5984/. Point your browser at it and you should see an empty registry.

Fill your local registry by configuring the npm command to use it:

npm config set registry http://localhost:5984/
npm cache clear
npm login

Sometimes npm seems confused with cached packages from other repositories, clearing the cache remedies those issues.

The login is required for npm to work but NOPAR doesn't implement any user management and currently accepts everyone.

Install packages with npm install PACKAGE and NOPAR will automatically proxy and cache the packages and dependencies into your private NOPAR.

Of course you can also publish to NOPAR. Those packages won't get promoted to the official registry by NOPAR and will be marked with a green "local" tag in the browser interface.

For configuring the registry, see the section "Default Environment Variables" below.

Default Environment Variables

The service's defaults are configured via environment variables. The following parameters are available:

  • NOPAR_HOSTNAME - Hostname that the service is bound to (default="localhost")
  • NOPAR_PORT - TCP port the service is running on (default=5984)
  • NOPAR_BASE_URL - Used to override base url if hosted behind a reverse proxy (default="")
  • NOPAR_AUTO_FORWARD - "yes" if NOPAR should automatically forward requests for unknown packages to the forwarder registry, "no" if you really just want a local registry without the auto-caching facility (default="yes")
  • NOPAR_IGNORE_CERT - "yes" if NOPAR should ignore invalid SSL certificates for the forwarder server, "no" if NOPAR should not make requests to servers presenting an invalid SSL certificate (default="no")
  • NOPAR_FORWARDER_URL - The URL of the registry NOPAR forwards requests for unknown packages to (default="https://registry.npmjs.org")
  • NOPAR_PROXY_URL - The URL of a proxy to use, empty for not using a proxy (default="")
  • NOPAR_USER_AGENT - The user agent to use to make the requests as (default=nopar/)
  • NOPAR_LOGFILE - Location of the logfile if we spawn, empty for console (default="")
  • NOPAR_LOGLEVEL - Loglevel to use (default="info")
  • NOPAR_REGISTRY_PATH - Location of the registry, leaving this empty will put the registry in a folder "registry" inside the nopar folder (default="")
  • NOPAR_HOME - Homefolder to change to before running, empty for installation location (default="")
  • NOPAR_RUN_PATH - Location for runtime files, primarily the PID file if running as a daemon (default="")
  • NOPAR_RUNAS_USER - The user to run as if running as a daemon, empty for not running as a daemon (default="")
  • NOPAR_META_TTL - The time in seconds until attempting to refresh metadata from "upstream registry" (default=21600)

If the environment variable NOPAR_RUNAS_USER is set, the service will run as a daemon.

You can override some of those settings from within NOPAR on the Settings page. Everything that is set in the Settings page takes priority over the environment variables.

Upstart Configuration

There's an example upstart configuration file that you can use and adapt for your own purpose:

scripts/nopar.conf

Known Issues

  • Missing user management. Welcome to the "Admin Party"!

nopar's People

Contributors

afbobak avatar bobak avatar braizhas avatar glenjamin avatar pdehaan avatar sky-glenjamin avatar smurthas avatar tinche avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nopar's Issues

Nopar behind BasicAuth

Howdy,

I have nopar running behind nginx with user basic auth. I tried adding auth to my app with, npm config set registry http://user:[email protected]. When I run npm install in my app, I receive:

npm ERR! Error: 401 Unauthorized
npm ERR!     at WriteStream.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/fetch.js:58:12)
npm ERR!     at WriteStream.emit (events.js:117:20)
npm ERR!     at evalmachine.<anonymous>:1603:14
npm ERR!     at /usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:102:5
npm ERR!     at Object.oncomplete (evalmachine.<anonymous>:107:15)

When I look back at my nopar dashboard, some packages were install. In my app however, node_modules fails to generate. Ideas?

Can not find any packages in upstream repository

I have just installed nopar using:

  1. npm install -g nopar
  2. nopar

Then I have tried connecting to using:

  1. npm config set registry http://localhost:5984/
  2. npm cache clear
  3. npm login

And it returns a 404 for every npm install

Referencing a specific version causes npm to throw shasum check failed messages

When I have dependency versions set to a specific version, either in the package.json file or via a shrinkwrap.json, and newer versions are released, then npm refuses to install:

npm ERR! Error: shasum check failed for .../tmp/npm-18522-ayE5E3KP/1396014802718-0.5011835067998618/tmp.tgz
npm ERR! Expected: b68d17f644be822ace5c33e90dc4f8b1fc936367
npm ERR! Actual:   69653dadb4d13dac4ff2b228f82304132cb270ad

Some packages archived with error

For example:

d:\workspace>npm install --registry http://localhost:5984/ [email protected]
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--registry" "http://localhost:5984/" "[email protected]"
npm ERR! node v0.12.2
npm ERR! npm  v2.7.4

npm ERR! shasum check failed for c:\Temp\npm-4928-dc9fb93a\localhost_5984\caniuse-db\-\caniuse-db-1.0.30000161.tgz
npm ERR! Expected: c5e03847e8b981d373d378e7bb51c89ebea1cd10
npm ERR! Actual:   67e2c642291c7f9c8717c5bec0193241fbf8ab37
npm ERR! From:     http://localhost:5984/caniuse-db/-/caniuse-db-1.0.30000161.tgz
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     d:\workspace\npm-debug.log

d:\workspace>

And cached caniuse-db-1.0.30000161.tgz is corruped.
Despite on that - the command
npm install [email protected]
works well.
Fixed the issue manually by replacing the corruped file by valid one...

Nopar dislikes the css package?

I was having a difficult time getting nopar to cache 'css' app from the registry.
(https://npmjs.org/package/css)

Then i noticed this in pkg.js around line 118

var packagename = req.params.packagename;
if (packagename === "css") {
  return next();
}

Is there a reason that the css package is not allowed?

Support for scoped packages

The public registry now supports scopes: http://blog.npmjs.org/post/116936804365/solving-npms-hard-problem-naming-packages

There's also some neat stuff in the client to support pointing scopes at different registries: https://docs.npmjs.com/misc/scope

Here's a suggested featurelist in rough order of importance:

  • proxing & caching of scoped packages
  • publishing scoped packages locally
  • configurable whitelist for scopes which can be published to (eg. only local publish to @companyname)

I'm going to take a stab at the first two for now.

Remove one particular version

It would be useful to remove a proxied version. For example, if a new version contains a bug that a previous version didn't have. Currently, I have to go into the registry, rm the tar and restart nopar.

nopar fails to restart after changing hostname and/or port

Howdy,

I am attempting to set up a nopar registry on a remote server. I can install successfully with the npm install -g nopar command, and when I run nopar the server starts up properly. When I change the hostname and/or the port number in the setting, nopar displays Hostname/port changed. You probably have to restart NOPAR.

However, when I exit using ctrl+c and run nopar again, nopar fails to start, and I receive the following error:

root@test:~# nopar
info: Registry Path: /usr/local/lib/node_modules/nopar/registry

events.js:72
        throw er; // Unhandled 'error' event
                 ^
Error: listen EADDRNOTAVAIL
    at errnoException (net.js:901:11)
    at Server._listen2 (net.js:1020:19)
    at listen (net.js:1061:10)
    at net.js:1135:9
    at asyncCallback (dns.js:68:16)
    at Object.onanswer [as oncomplete] (dns.js:121:9)

About my system:

  • Debian 7 Wheezy
  • Nodejs v0.10.23
  • npm 1.3.17

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.