Setting up a local mirror?

Feb 28, 2012 at 10:13 PM

Hi, I'm new to nuget and trying to build up a system.

Nuget works, Nuget local server is also easy set up, thanks guys for this great piece of work :-)
I prefer your choice in not deleting any old packages as I won't include them in source control.
Bt nevertheless I want to have control on my own, so a own server is mandatory.

My prefered way would be like this:
1) Add your local nuget-server in VS, remove all other servers (also the main nuget)
2) If you search for packages your local server presents you the list of the real nuget-server where you may choose your packages)
3) If the package is already on your local server it will take it from there, if not it will download it (and all it's dependencies) first from nuget to local-server and then to your workstation.

So I would have a local mirror that is in my hands only mirroring things I've used in my projects.

Is this possible, or any other suggestions?

Thanks,

Cyber1000

Feb 28, 2012 at 10:24 PM

The package sources are queried in order. So, if you add a package source for your local server, and move it to the top of the list (above the default source), it will use packages from there first. You can also uncheck the default package source, but then you won't see it's packages, even when you search. Does that work for you?

Feb 29, 2012 at 8:16 PM

Hi thanks for the fast answer!

I think you didn't understand exactly what I tried to say, I saw I could move my local repo up and down the list giving it a priority.

I more thought of a kind of local proxy which provides all packages of one or more internet-nuget feeds to his clients. If the client decides to install, the local server fetches the packages on demand and stores them locally on the local server. If another client (or building machine) wants the package once again it won't need the internet. My advantage (in my eyes): The developer could search the full nuget-feed and after installing (which will download a package on the local server) he has no need to worry if an old build will be repoducable, cause the local server is in local admins hands.

Hope I was clear for now.

Thanks!

Mar 3, 2012 at 3:00 AM

NuGet doesn't have any feature like a local proxy;, however NuGet already caches packages locally. If the package is already cached on your machine it  doesn't download it again from the Internet. The cache is specific to the user, though, so other uses on your machine would still have to make the request to populate their own cache. And it only caches the packages you actually install; it doesn't cache the whole feed.

For a true local proxy you'd have to make something yourself, or see if someone else has made something like you want.

Developer
Mar 29, 2012 at 8:14 AM

It seems the local user cache is limited maximum 100 packages? src/Core/Repositories/MachineCache.cs

Is there any specific reason why this is hard-coded and not a configurable setting?

Developer
Mar 29, 2012 at 7:42 PM
It could be a setting. We just chose 100 as a reasonable default limit since the cache is mostly transparent to the user.

Sent from my Windows Phone

From: xavierdecoster
Sent: 3/29/2012 12:14 AM
To: David Fowler
Subject: Re: Setting up a local mirror? [nuget:346634]

From: xavierdecoster

It seems the local user cache is limited maximum 100 packages? src/Core/Repositories/MachineCache.cs

Is there any specific reason why this is hard-coded and not a configurable setting?

Mar 29, 2012 at 9:18 PM

Is there any reason why you want to change it to other values?

Developer
Mar 29, 2012 at 9:36 PM
dotnetjunky wrote:

Is there any reason why you want to change it to other values?

Spiking something that might be impacted by this setting, although it's not *that* big of a deal, I was just wondering if there would be a special reason for it to be hard-coded, other than having a reasonable default.

Developer
Apr 1, 2012 at 6:09 PM
xavierdecoster wrote:
dotnetjunky wrote:

Is there any reason why you want to change it to other values?

Spiking something that might be impacted by this setting, although it's not *that* big of a deal, I was just wondering if there would be a special reason for it to be hard-coded, other than having a reasonable default.

Here's why actually :)

http://nuget.codeplex.com/discussions/350804

Apr 3, 2012 at 10:56 AM
Edited May 3, 2012 at 10:16 AM
Hi, Dre there
 What if I want to save that package file, how can I do so?
drewmiller wrote:

The package sources are queried in order. So, if you add a package source for your local server, and move it to the top of the list (above the default source), it will use packages from there first. You can also uncheck the default package source, but then you won't see it's packages, even when you search. Does that work for you?