Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to use sinopia in environment with no internet? #98

Closed
derkd opened this issue Aug 6, 2014 · 10 comments
Closed

Is it possible to use sinopia in environment with no internet? #98

derkd opened this issue Aug 6, 2014 · 10 comments

Comments

@derkd
Copy link

derkd commented Aug 6, 2014

I'm interested if it is possible to set up a private repo (sinopia) which has no connection to internet (policy)? Currently we pack our node_modules in a tar file and put them in SVN. Every build we unpack this tar. I tried to npm publish it to sinopia but it doesn't publish it's dependencies with it. Do I need to write a shell script which walks through the directories (of the dependencies) and search for a "node_modules" dir with a package.json and then do a npm publish every time?
I'm quite a newbie on all this...

@rlidwka
Copy link
Owner

rlidwka commented Aug 6, 2014

Yes, it is possible. If you remove all uplinks from config.yaml, sinopia won't even attempt to connect any internet servers, and will still work fine.

But you need to have all dependencies there somehow.

Easiest way would be to install sinopia to computer with internet connection, install them (so they would be cached), and then copying the entire installation to a computer with no internet connection. If you look inside storage, it's all just flat files you can move across different computers.

You also can publish each dependency manually, or use bundledDependencies feature of npm.

@derkd
Copy link
Author

derkd commented Aug 6, 2014

Thanks!

Op woensdag 6 augustus 2014 heeft Alex Kocharin notifications@github.com
het volgende geschreven:

Yes, it is possible. If you remove all uplinks

uplinks:

from config.yaml, sinopia won't even attempt to connect any internet
servers, and will still work fine.

But you need to have all dependencies there somehow.

Easiest way would be to install sinopia to computer with internet
connection, install them (so they would be cached), and then copying the
entire installation to a computer with no internet connection. If you look
inside storage, it's all just flat files you can move across different
computers.

You also can publish each dependency manually, or use bundledDependencies
feature of npm.

Reply to this email directly or view it on GitHub
#98 (comment).

@derkd
Copy link
Author

derkd commented Aug 8, 2014

Hi, I copied the full repo (which was on a mac) to a linux pc (with no internet connection). I removed the uplink (and the proxy) but for some dependencies I get a 500 internal server error:
looks like it is still trying to get it from the npm repo.

Error: ETIMEDOUT
at null._onTimeout (/XXX/XXX/XXX/sinopia/node_modules/request/request.js:713:15)
at Timer.listOnTimeout as ontimeout
http <-- 500, user: admin, req: 'GET /karma-chrome-launcher/-/karma-chrome-launcher-0.1.4.tgz', error: internal server error
http --> ERR, req: 'GET http://registry.npmjs.org/karma-htmlfile-reporter/-/karma-htmlfile-reporter-0.1.2.tgz', error: ETIMEDOUT
error --- unexpected error: ETIMEDOUT
Error: ETIMEDOUT
at null._onTimeout (/XXX/XXX/XXX/sinopia/node_modules/request/request.js:713:15)
at Timer.listOnTimeout as ontimeout
http <-- 500, user: admin, req: 'GET /karma-htmlfile-reporter/-/karma-htmlfile-reporter-0.1.2.tgz', error: internal server error
error --- unexpected error: socket hang up
Error: socket hang up
at createHangUpError (http.js:1472:15)
at Socket.socketCloseListener (http.js:1522:23)
at Socket.EventEmitter.emit (events.js:117:20)
at TCP.close (net.js:465:12)
error --- unexpected error: socket hang up
Error: socket hang up
at createHangUpError (http.js:1472:15)
at Socket.socketCloseListener (http.js:1522:23)
at Socket.EventEmitter.emit (events.js:117:20)
at TCP.close (net.js:465:12)

If I check the repo on my mac the particular dependency only has a package.json with a url to a tarball. I would expect that sinopia download the tarball already so it would be next to the package.json?!?

@rlidwka
Copy link
Owner

rlidwka commented Aug 8, 2014

It's probably because this particular tarball was never downloaded before, so it doesn't exist in the cache. You have to add it then somehow.

Maybe running "npm install" multiple times will help, sinopia could mark this version as unreachable and fall back to an earlier one. Not sure about this though.

But there is no way to "mirror" npm registry right now. We could write a tool I suppose.

@njenia
Copy link

njenia commented Oct 28, 2014

I wrote a small script to download all missing tarballs to the storage folder (it takes the latest dist file from the package.json).
You can find it here.
I seems to work but tell me if you find any problems.

@ralberts
Copy link

So glad for this thread! I was running into a similar problem as I will have no internet. Thanks @njenia as I will test out your script and the other suggestions in this thread.

@njenia
Copy link

njenia commented Feb 11, 2015

@ralberts The script is useful if you want all of the versions of relevant packages. But if you want to get a specific version of a package (and all of its dependencies) I found out that cleaning caches (of npm and sinopia) does the trick. It will get one tarball per each package, which is enough if you want only that specific version of a package.

@anitakrueger
Copy link

@rlidwka quick question if I may. I will have a VM with internet access running sinopia, but I don't want it to go out to the internet for packages, basically always using the local cache. I've removed all uplinks, but sinopia still goes out to registry.npmjs.org to download packages. Even if I make the uplink unusable (by making up a hostname that doesn't exist), sinopia will always fall back to contacting registry.npmjs.org for packages.
Is there a way to turn this off?

Thanks a lot

  • Anita

@rlidwka
Copy link
Owner

rlidwka commented Sep 13, 2015

@anitakrueger ,

Even if I make the uplink unusable (by making up a hostname that doesn't exist), sinopia will always fall back to contacting registry.npmjs.org for packages.

There is no such fallback.

But it is possible that sinopia already fetched the metadata for some of the packages and stored information like "foobar@1.2.3 is located in registry.npmjs.org" for the particular versions of those packages.

Please check storage directory for sinopia and remove any unwanted packages from there.

@rlidwka rlidwka closed this as completed Sep 13, 2015
@ghost
Copy link

ghost commented May 17, 2018

As a complement to @njenia 's app, I also wrote a small tool that rewrites the storage files so the repository latest becomes the latest locally cached version in the storage. This is for avoiding downloading new versions if you already got the ones you needed. Hope it helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants