[chef] Re: Re: Re: How to configure apt to not hit the repo every time?


Chronological Thread 
  • From: Max Stepanov < >
  • To:
  • Subject: [chef] Re: Re: Re: How to configure apt to not hit the repo every time?
  • Date: Sat, 18 May 2013 21:40:19 +0300

It was fixed just recently.

It is now relying on build-essential mechanism

--
Max Stepanov


On Sat, May 18, 2013 at 8:00 PM, Darron Froese < " target="_blank"> > wrote:
Or - use apt-cacher ng to proxy all apt calls and make it super fast:

https://gist.github.com/fnichol/1747868

I will often spin up a small Vagrant box and push all of my apt
requests through it - especially when I'm building from scratch over
and over.

Works pretty well

Apparently if you're using the apt cookbook - you can set a cacher ip
address and have it pull from there pretty easily:

https://github.com/opscode-cookbooks/apt/blob/master/recipes/cacher-client.rb

I haven't tried that yet - was doing it manually before.



On Sat, May 18, 2013 at 9:02 AM, Sam Darwin < "> > wrote:
> To answer a more general and generic question, which is not specific
> to Vagrant or Berkshelf: "how do I prevent apt-get update from running
> too often?",  use this code in the recipe, in place of the line
> calling "apt-get update":
>
> if node['platform_family'] == "debian"
> if node['platform_version'].to_f >= 12
> x = execute "apt-get update" do
>       action :nothing
>       not_if do
>         ::File.exists?('/var/lib/apt/periodic/update-success-stamp') &&
>         ::File.mtime('/var/lib/apt/periodic/update-success-stamp') >
> Time.now - 86400*7
>       end
>   end
> else
> x =  execute "apt-get update" do
>       action :nothing
>       command "touch /tmp/apt-get-update ; /usr/bin/apt-get update"
>       not_if do
>         ::File.exists?('/tmp/apt-get-update') &&
>         ::File.mtime('/tmp/apt-get-update') > Time.now - 86400*7
>       end
>   end
> end
> x.run_action(:run)
> end
>
>
>
> On Sat, May 18, 2013 at 2:27 PM, millisami r < "> > wrote:
>> Hi, I'm developing a cookbook using Berkshelf and Vagrant latest.
>>
>> There is a place in the recipe that runs apt-get update frequently and other
>> dependent cookbooks too like the following:
>>
>> [2013-05-18T11:21:48+00:00] INFO: Processing execute[apt-get update] action
>> run (mysql::ruby line 23)
>>
>> Its fine on the production node, but in the vagrant provision way, every
>> time I run, it will hit the apt-get update which is a bit slow coz it hits
>> via the internet.
>>
>> How can I configure Vagrant to just hit only once in a single vagrant
>> provision command?
>> Or do I have to do change something else?
>>
>> @millisami
>> ~Sachin Sagar Rai
>> Ruby on Rails Developer
>> http://tfm.com.np
>> http://nepalonrails.com




Archive powered by MHonArc 2.6.16.

§