langri-sha / npm_lazy Goto Github PK
View Code? Open in Web Editor NEWA Docker container to speed up your NPM deploys http://mixu.net/npm_lazy/
License: Creative Commons Zero v1.0 Universal
A Docker container to speed up your NPM deploys http://mixu.net/npm_lazy/
License: Creative Commons Zero v1.0 Universal
Add a detailed README outlining common use cases for the container (exposing it locally, linking it with others), with quick examples on how to run these on a Docker host.
I'm getting this in my Docker for Mac 17.06.0-ce environment I just reset. I was able to run the same npmlazy image fine before reset, and it works fine on my other docker servers. Any ideas?
$ docker run -ti langrisha/npm-lazy:1.11.0
module.js:327
throw err;
^
Error: Cannot find module 'util-deprecate'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/usr/src/app/node_modules/underscore.string/sprintf.js:1:79)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
Found a few hits related to node/npm weirdness but npm cache clean && npm cache clear && npm outdated --depth=0
and npm install
doesn't help.
npm version: 2.13.2
node ./lib/preinstall_npmcheck.js
Sails.js Installation: Checking npm-version successful
npm WARN deprecated [email protected]: use uuid module instead
npm WARN deprecated [email protected]: 'native-or-bluebird' is deprecated. Please use 'any-promise' instead.
npm WARN deprecated [email protected]: DEPRECATED. See readme: https://github.com/gruntjs/grunt-lib-contrib
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN deprecated [email protected]: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm ERR! fetch failed http://192.168.18.24:8083/@sailshq/lodash/-/lodash-3.10.2.tgz
npm WARN retry will retry, error on last attempt: Error: fetch failed with status code 404
npm ERR! fetch failed http://192.168.18.24:8083/@mapbox/geojsonhint/-/geojsonhint-1.2.1.tgz
npm WARN retry will retry, error on last attempt: Error: fetch failed with status code 404
npm ERR! fetch failed http://192.168.18.24:8083/@mapbox/geojsonhint/-/geojsonhint-1.2.1.tgz
npm WARN retry will retry, error on last attempt: Error: fetch failed with status code 404
npm ERR! fetch failed http://192.168.18.24:8083/@sailshq/lodash/-/lodash-3.10.2.tgz
npm WARN retry will retry, error on last attempt: Error: fetch failed with status code 404
npm ERR! fetch failed http://192.168.18.24:8083/@mapbox/geojsonhint/-/geojsonhint-1.2.1.tgz
npm ERR! fetch failed http://192.168.18.24:8083/@sailshq/lodash/-/lodash-3.10.2.tgz
npm ERR! Linux 3.13.0-93-generic
npm ERR! argv "/usr/bin/iojs" "/usr/bin/npm" "install" "[email protected]"
npm ERR! node v2.5.0
npm ERR! npm v2.13.2
npm ERR! fetch failed with status code 404
Will be nicer if expose a port ๐
Been having problems with npmlazy --external-url=...
and occasional errors like below, maybe since trying swarm or it's specific to docker 1.10 / 1.11. Or maybe it started with a recent npm change.
Anyway, I noticed that docker exec -ti mynpmlazy npm list
shows it's still running 1.7.0
.
If I docker exec -ti npm update
then docker restart mynpmlazy
it upgrades to 1.9.0
and seems to behave better (until the container is next recreated).
I can make my own image. But maybe you could update the minimum version in https://github.com/langri-sha/npm_lazy/blob/master/package.json and resubmit to docker hub? Maybe simply rebuilding the image will pull the latest npmlazy. Thanks.
npm ERR! Linux 3.16.0-4-amd64
npm ERR! argv "node" "/usr/bin/npm" "install"
npm ERR! node v0.10.42
npm ERR! npm v3.8.7
npm ERR! code ECONNRESET
npm ERR! network socket hang up
npm ERR! network This is most likely not a problem with npm itself
npm ERR! network and is related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
Update README, with respect to the helper script added with #6
Some of the runnable samples provided in the documentation are incorrect.
Sorry I don't have a repro but I think my npmlazy container locks up in some scenarios like when the docker server runs out of memory and it tries to kill the container.
I think the problem is that npmlazy is running as pid 1 -- you should always use a init system or tini instead. E.g. see:
I'm working around this by using this Dockerfile:
mynpmlazy/Dockerfile
ARG NPMLAZY_VERSION
FROM langrisha/npm-lazy:${NPMLAZY_VERSION}
ENV TINI_VERSION v0.17.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
RUN chmod +x /tini
ENTRYPOINT ["/tini", "-v", "-e", "143", "--", "node", "index.js"]
And start my npmlazy container using something like this in my docker-compose.yml:
# https://registry.hub.docker.com/u/langrisha/npm-lazy/
# To use add: ENV npm_config_registry http://${DOCKER_BUILD_CACHE_HOST}:8181
npmlazy:
restart: always
image: mynpmlazy
build:
context: mynpmlazy/.
args:
- NPMLAZY_VERSION=1.11.0
mem_limit: 500m
memswap_limit: 500m
volumes:
- /root/.npm_lazy
command: --show-config --port=80 --external-url=http://${DOCKER_BUILD_CACHE_HOST}:8181
I pushed a commit earlier today that allows the use of environment variables.
I thought you may be interested in cherry-picking if you found it useful?
export NPM_LAZY_PORT=80
export NPM_LAZY_EXTERNAL_URL=http://localhost
node index.js
Introduce tests to cover the helper scripts against future changes to mixu/npm_lazy/config.js and also to verify some of the samples outlined in the documentation.
In the following usage:
sudo docker run -p 8000:8080 -v /root/.npm_lazy:/root/.npm_lazy langrisha/npm-lazy remote-url http://registry.npmjs.org --show-config
{ loggingOpts:
{ logToConsole: true,
logToFile: false,
filename: '/root/npm_lazy.log' },
cacheDirectory: '/root/.npm_lazy',
cacheAge: 0,
httpTimeout: 10000,
maxRetries: 5,
rejectUnauthorized: true,
externalUrl: 'http://localhost:8080',
remoteUrl: [ 'http://registry.npmjs.org' ],
port: 8080,
host: '0.0.0.0',
proxy: { https: undefined, http: undefined } }
url.js:107
throw new TypeError("Parameter 'url' must be a string, not " + typeof url)
^
TypeError: Parameter 'url' must be a string, not object
at Url.parse (url.js:107:11)
at Object.urlParse [as parse] (url.js:101:5)
at Function.Package.configure (/app/node_modules/npm_lazy/lib/package.js:25:26)
at start (/app/node_modules/npm_lazy/server.js:64:11)
at Object.<anonymous> (/app/index.js:29:1)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
Would be nice if this Dockerfile its hub.docker.com repo were updated to the last npm_lazy release 1.14.0.
https://github.com/mixu/npm_lazy/releases
Thanks!
Add a helper script, with support for npm_lazy
configuration options, which can dynamically compile the server configuration before statrtup.
I have been changed the external URL but when install dependencies I get this message:
Terminal output:
npm ERR! fetch failed http://localhost:8080/assemble/-/assemble-0.4.42.tgz
npm WARN retry will retry, error on last attempt: Error: fetch failed with status code 502
npm ERR! fetch failed http://localhost:8080/assemble/-/assemble-0.4.42.tgz
npm WARN retry will retry, error on last attempt: Error: fetch failed with status code 502
My external URL:
externalUrl: 'http://10.200.1.128:8081',
Any idea how fix it? Thanks!
Update ENTRYPOINT
to bypass npm start
and invoke the server script directly, allowing arguments to be passed through.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.