How to build NodeJS support without an Internet connection?
Valentin V. Bartenev
vbart at nginx.com
Sun Dec 9 18:14:14 UTC 2018
On Sunday, 9 December 2018 16:41:56 MSK Ralph Seichter wrote:
> Hello developer team.
>
> I am the maintainer of the NGINX Unit ebuild for Gentoo Linux, and
> currently I am struggling with colliding requirements of Unit's and
> Gentoo's build strategies.
>
> As you may know, the Gentoo way is to build everything from the source
> code, with only very few exceptions. If, for example, the user desires
> Python support in Unit, my ebuild ensures that this requirement is met
> before Unit's release tarball is even unpacked.
>
> NodeJS support is a different beast, because the existing Unit build
> method relies on node-gyp and npm to download and install dependencies
> during the build process. This fails, because Gentoo builds are executed
> in a sandbox environment that prohibits both network access and files
> being written outside the sandbox. Hence, "npm install --global ..."
> won't do.
>
> Is there a way I can modify the existing Unit build to comply with these
> restrictions? Everything required for the build must either already
> exist, or it must be downloaded by Gentoo before Unit's compile phase.
> Also, all required artefacts are recorded with a checksum when an ebuild
> is added to the Gentoo tree, so no "download whatever is the most recent
> version of XYZ".
>
> Your help is appreciated.
Hi Ralph,
Thank you for your effort.
All the Node.js module dependencies are set in its package.json file:
http://hg.nginx.org/unit/file/tip/src/nodejs/unit-http/package.json
There's just one:
"dependencies": {
"node-addon-api": "1.2.0"
}
and I'm not sure that it's needed at all, especially for Gentoo.
I think you can just remove it.
See also this overlay for some ideas:
https://github.com/msva/mva-overlay/tree/master/www-servers/nginx-unit
wbr, Valentin V. Bartenev
More information about the nginx
mailing list