Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Here's my problem. I want Varnish 3.0, but Lucid only has the 2.1 package available.

So using Chef, I need to make an install recipe that adds the varnish-cache.org repository to the apt sources and installs the varnish-3.0 package.

(I have the option of building it from source (right?), but if I do, I won't get the /etc/init.d scripts (right?)).

So I'm writing an apt_install.rb recipe which presumably adds the repository:

apt_repository "varnish-3.0" do
  uri "http://repo.varnish-cache.org/ubuntu/"
  repo_name "varnish-3.0"
  distribution "lucid"
  components ["varnish-3.0"]
  key "http://repo.varnish-cache.org/debian/GPG-key.txt"
  deb_src true
  action :add
end

And indeed this adds a varnish-3.0-source.list in /etc/apt/sources.list.d which says:

# Created by the Chef apt_repository LWRP
deb http://repo.varnish-cache.org/ubuntu/ lucid main

Then I have

package "varnish" do
  source "http://repo.varnish-cache.org/ubuntu/"
  action :install
end

which proceeds to install version 2.1 on my server, not 3.0.

If I specify a "version" in the package block, I get "version not found".

What am I missing here? It must be something simple.

share|improve this question
    
What if you set an explicit version of the package using version attribute? Could you please also post chef-client execution log somewhere? –  Alex Aug 8 '12 at 16:32
1  
Doing an apt-get update manually on the machine was revealing. The varnish repo doesn't have a "main" component, but does have the component "varnish-3.0". You can see that's what I used in the recipe above, but an earlier run using "main" had already been recorded in the sources.list.d file. ... Now "apt-get udpate" runs without errors. But that doesn't solve the problem ... –  Mojo Aug 8 '12 at 20:36
1  
This is the section of the Chef log related to installing the varnish repository and varnish 3.0 package: gist.github.com/3298601 –  Mojo Aug 8 '12 at 20:44
1  
Here's what I've discovered so far, not using chef, but doing manual apt-gets: If the repo line is appended to /etc/apt/sources.list then apt-get update includes the varnish repo and updates to 3.0.2-lucid. However with only a varnish-3.0-source.list file in /etc/apt/sources.list.d apt-get does not see any newer versions than 2.1. –  Mojo Aug 8 '12 at 21:16
2  
Looks like cookbooks/apt version 1.4.0 (latest from git) solved this problem. I'll post an answer tomorrow (when I can). –  Mojo Aug 8 '12 at 21:30

2 Answers 2

up vote 1 down vote accepted

My biggest problem was an old version of the apt cookbook. Even so, the Varnish distribution names are a little unusual. Here's my config:

apt_repository "varnish-3.0" do
  uri "http://repo.varnish-cache.org/ubuntu/"
  repo_name "varnish-3.0"
  distribution "lucid"
  components ["varnish-3.0"]
  key "varnish-cache.org.gpg-key.txt"
  deb_src true
  action :add
end

package "varnish" do
  source "http://repo.varnish-cache.org/ubuntu/"
  version "3.0.2-1~1lucid1"
  options "--force-yes"
  action :install
end

The repository key is included as a cookbook file.

When running this recipe on top of an existing Varnish 2.3 installation, the first chef-client run fails when trying to deal with apt's upgraded config file dialogs. In my instance the second chef-client runs cleaning and correctly.

share|improve this answer

I think that the method that the OP answered is the right way.

However, if that is not acceptable for one reason or another, the other thing that you could have done is to create your own .deb package from the source code.

Personally, rather than using every package managers different flavors of Crazy, I use Jordan Sissel's FPM. FPM makes it pretty trivially easy to make different flavors of package, and the documentation walks you through concrete examples, such as Use Case - Package something that uses 'make install'.

(Personal Note: This was an excellent use for Vagrant.)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.