fgrehm / vagrant-cachier

Caffeine reducer
http://fgrehm.viewdocs.io/vagrant-cachier
MIT License
1.08k stars 111 forks source link

Add configuration for Apt proxy #19

Closed tmatilai closed 11 years ago

tmatilai commented 11 years ago

This PR adds support for configuring proxies for Apt. Even with the apt bucked enabled it makes sometimes sense. For example all developers can use a single apt-cacher-ng instance in a corporate network.

If you think this is a good idea I can add some documentation to the readme (although I'm very crappy writing anything =)). But if you feel this is out of the scope for this plugin no problem. I can make a separate plugin and won't rage quit using this plugin. ;)

patcon commented 11 years ago

I really really like this, but it does seem outside the scope. Anyone else have any thoughts?

tmatilai commented 11 years ago

Hi Patrick, I also have mixed feelings. Maybe this really should be another plugin. For sure it doesn't sound like a perfect fit for "vagrant-cachier" name. @fgrehm any opinions? =)

fgrehm commented 11 years ago

hey guys, sorry but I'm extremely busy this week, unfortunately I'll only have time for OSS stuff by the end of next one =/

just so u know, while I have mixed feelings about this, I think it might make sense to have it on the plugin. I know it's a completely different approach from the rest of the stuff we have around but my vision for this plugin is pretty much like "all your cache belong to us" :P

I definitely need to think more about it and play with apt-cacher-ng before merging it in, but I want to throw back some questions to you guys:

* I'm not a yum / pacman expert but do they support this kind of stuff

as well? * if they do, would we be able to reuse some of the code we have on this PR? * would it be a problem if the proxy AND the cache bucket are enabled or should we make them mutually exclusive?

BTW, @tmatilai :thumbsup: for adding the feature with specs ;)

Fábio Rehm

On Mon, Jun 24, 2013 at 11:19 AM, Teemu Matilainen <notifications@github.com

wrote:

Hi Patrick, I also have mixed feelings. Maybe this really should be another plugin. For sure it doesn't sound like a perfect fit for "vagrant-cachier" name. @fgrehm https://github.com/fgrehm any opinions? =)

— Reply to this email directly or view it on GitHubhttps://github.com/fgrehm/vagrant-cachier/pull/19#issuecomment-19909629 .

patcon commented 11 years ago

I still feel that, in the spirit of staying unixy, this belongs in another plugin, but I won't push the point too far if others feel differently :)

But to explain the logic of separation as I see it, it seems that sharing folders for caching is a specific use-case and approach, and the other approach involves directs to an external caching server, which could become lots more:

If we add this, we'll be adding one little piece of that complement of options, and probably not wanting to go too much further. But really, this approach has lots of legs and should probably be built out quite extensively (in one plugin, maybe vagrant-proxy).

Anyhow, just my $0.02!

EDIT: Interesting links:

Seems apt-cacher-ng can be used for pacman and yum. Makes a single caching VM seem all-the-more tempting. Perhaps with a simple way to spin it up both locally and in the cloud. I see this as another reason to keep this functionality separate, as this extended feature-set surely wouldn't belong in vagrant-cachier, right?

tmatilai commented 11 years ago

Cool, thanks to both of you for your thoughts! I tend to agree with Patrick that a separate plugin might be a good idea. There is no conflict in using a shared apt cache directory and apt proxy at the same time (although it does not make much sense if the proxy server is running at the same computer), but I like the idea of more focused plugins that concentrate in doing one thing well.

So with the same idea I think that the already existing vagrant-proxy plugin is also a different beast. The use cases for a generic http proxy and for a caching proxy for package managers are quite different. Normal web proxies do not even cache big files (i.e. packages) by default.

Patrick, do you really think a Vagrant plugin would be a good way to spin up a cacher VM? Vagrant needs a working directory for .vagrant/ so it feels a bit like a chicken and egg dilemma to me. The plugin could be used for generating the setup but just as well it could be an example repository in Github. I do run an apt-cacher-ng in a Vagrant VM on my laptop and it's a really simple setup. But surely the requirements vary.

On the other hand, supporting different platforms and package managers sounds like a good idea.

patcon commented 11 years ago

@tmatilai I think you're right that vagrant-proxy might be a different beast. As for it being within the purview of a plugin to spin up a caching server, I can imagine a plugin that has a vagrant apt-cacher init command that generates a Vagrantfile for spinning up an apt-cacher-ng server, perhaps with vbox provider as default, but maybe with other provider skeletons when desired. Still undecided whether this is good form for a plugin, but would certainly make caching simpler for non-localhost providers...

Maybe the plugin could simply have an accompanying project that helps spin up a VM? Not sure.

Thoughts?

fgrehm commented 11 years ago

tks a lot for sharing your thoughts guys. you've convinced me that this is out of scope for this plugin and we can always merge things back if / when we change our minds :)

regarding a plugin to manage a apt-cache-ng VM server, do you really think there is a need to have a plugin for that? wouldn't it fit into a "Vagrantfile + shell provisioning script" combo like this?

tmatilai commented 11 years ago

Ola!

OK, I created a new plugin based on this PR: https://github.com/tmatilai/vagrant-proxyconf

Both of you are collaborators, so feel free to mess around. I thought I'll make the first release soon as the apt part seems to work (at least on my machine :)). We can continue planning there, and as @fgrehm said we can always merge things back here if we feel so.

I also stripped an example setup from my local apt-cacher-ng box: https://github.com/tmatilai/apt-cacher-box It seems to fail the first bootstrap at least with my plugin setup as it configures the local machine to use the proxy before it is started. I'll fix it at some point, but you can see that the whole thing is really simple. Should work fine for cloud providers too with minor modifications.

Closing this issue for now. Thanks a lot for all the discussion so far!

fgrehm commented 11 years ago

@tmatilai awesome! I'll try it out soon :) BTW, I've just added it to the Vagrant plugin list wiki page so that people can find it ;)

patcon commented 11 years ago

Nice! And thanks!