thoughtworks / voto-como-vamos-2

New Voto Como Vamos platform
6 stars 1 forks source link

Puppet dependency issues #2

Closed cv closed 11 years ago

cv commented 11 years ago

Figure out why vagrant up doesn't work the first time around (have to run vagrant provision 2 or 3 times for it all to fall into place).

Probably a dependency issue between apache, passenger and rbenv.

cv commented 11 years ago

@jeffersongirao or @maxlinc, could you help out with this? Should I start reading up some more on puppet stages?

Fedalto commented 11 years ago

Hey guys,

I was looking into it, so keep me in the loop.

I think that the problem is with installing the packages.

The error I got here is:

err: /Stage[main]/Postgresql::Client/Package[postgresql-client]/ensure: change from purged to present failed: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install postgresql-client-9.1' returned 100: Reading package lists...
Building dependency tree...
Reading state information...
The following extra packages will be installed:
  libpq5 postgresql-client-common
Suggested packages:
  postgresql-9.1 postgresql-doc-9.1
The following NEW packages will be installed:
  libpq5 postgresql-client-9.1 postgresql-client-common
0 upgraded, 3 newly installed, 0 to remove and 66 not upgraded.
Need to get 1083 kB of archives.
After this operation, 3538 kB of additional disk space will be used.
Err http://us.archive.ubuntu.com/ubuntu/ precise-updates/main libpq5 amd64 9.1.5-0ubuntu12.04
  404  Not Found [IP: 91.189.91.14 80]
Err http://security.ubuntu.com/ubuntu/ precise-security/main libpq5 amd64 9.1.5-0ubuntu12.04
  404  Not Found [IP: 91.189.91.13 80]
Get:1 http://us.archive.ubuntu.com/ubuntu/ precise/main postgresql-client-common all 129 [25.4 kB]
Err http://us.archive.ubuntu.com/ubuntu/ precise-updates/main postgresql-client-9.1 amd64 9.1.5-0ubuntu12.04
  404  Not Found [IP: 91.189.91.14 80]
Err http://security.ubuntu.com/ubuntu/ precise-security/main postgresql-client-9.1 amd64 9.1.5-0ubuntu12.04
  404  Not Found [IP: 91.189.91.13 80]
Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/p/postgresql-9.1/libpq5_9.1.5-0ubuntu12.04_amd64.deb  404  Not Found [IP: 91.189.91.13 80]
Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/p/postgresql-9.1/postgresql-client-9.1_9.1.5-0ubuntu12.04_amd64.deb  404  Not Found [IP: 91.189.91.13 80]
Fetched 25.4 kB in 4s (5374 B/s)
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

I ssh to the box and tried to run the apt-get install postgresql-client-9.1 with the same errors.

The solution is just run a apt-get update before everything.

I'm still learning puppet, so I would like some help to get that in place.

kaofelix commented 11 years ago

I think you just need an exec resource and make it run before installing dependencies.

exec {"apt-get update": before => Whatever["installs the deps"] }

If I remember the syntax right.

Kao Félix

bltavares commented 11 years ago

I will try out something here and will let you know @Fedalto

cv commented 11 years ago

I wouldn't like to apt-get update every time, though. @bltavares had a way to avoid that, and looking around stackoverflow I bumped into this:

exec { 'apt-get update':
    command => "/usr/bin/apt-get update",
    onlyif => "/bin/bash -c 'exit $(( $(( $(date +%s) - $(stat -c %Y /var/lib/apt/lists/$( ls /var/lib/apt/lists/ -tr1|tail -1 )) )) <= 604800 ))'"
}

(link: http://stackoverflow.com/questions/10845864/puppet-trick-run-apt-get-update-before-installing-other-packages)

What do you guys think? Too much magic?

bltavares commented 11 years ago

@cv Would it be hooked up to Postgres or on the main?

bltavares commented 11 years ago

BTW @Fedalto, what is the base box you are using? Mine could be a bad example to try out because I updated it recently.

cv commented 11 years ago

@bltavares doesn't make sense to hook it up to the postgres packages, since the entire apt catalog is out of date on that box.

@Fedalto @bltavares I'd rather not use a re-packaged box. Let's use the official box from http://vagrantbox.es, so they can be reused in other projects too ;)

cv commented 11 years ago

Let's talk about this apt-get issue separately from the dependency issue this issue is about. I created another issue for it, #16

Fedalto commented 11 years ago

@bltavares I'm using a fresh precise64.box. I'm expecting to get the box and with a vagrant up in the first time everything should be working.

And btw, postgres is not the only package that fails to install. I just put it as an example as it was the first that gave an error. All packages that we tried to install gives that error, postgresql-contrib, libxslt1-dev, libpq-dev, apache2-prefork-dev and others.

And I don't think it is safe to hook the update on the postgres package as we can not ensure it will be the first to run.

bltavares commented 11 years ago

@cv could you try those changes on your box? I tested using vagrant destroy -f && vagrant up and it is ok for me using @Fedalto 's box

Fedalto commented 11 years ago

Just making clear that the Fedalto's box is actually the precise64 that vagrant offers in http://files.vagrantup.com/precise64.box

maxlinc commented 11 years ago

Code Jams are Tuesday? I'd like to help out but don't know when to show up. I can probably help with this issue but I'd like some pairing time before jumping in with WFH.

BTW - Why not add the Code Jam to the TWBr Events calendar now that it exists? That would make it easier for new hires or lurkers like me to find it and join in occasionally.

On Sun, Mar 3, 2013 at 4:10 PM, Leonardo Fedalto notifications@github.comwrote:

Just making clear that the Fedalto's box is actually the precise64 that vagrant offers in http://files.vagrantup.com/precise64.box

— Reply to this email directly or view it on GitHubhttps://github.com/thoughtworks/voto-como-vamos-2/issues/2#issuecomment-14352675 .

bltavares commented 11 years ago

Tested on another box and it is ok. Closing this issue for now.

@maxlinc I would like to pair with you to improve the manifests. We can set up the event on the calendar.

junior-ales commented 11 years ago

@maxlinc Yes codejams are every Tuesday at 7PM on CTG JOIN US THERE!

About the calendar last week we discuss exactly about that, probably will be there this week.

cv commented 11 years ago

Just tested it against the official Precise 64 box and it works perfectly. Thanks @bltavares! :+1:

maxlinc commented 11 years ago

I almost forgot when it was. It wasn't on my calendar :p

On Sun, Mar 3, 2013 at 6:10 PM, Junior Ales notifications@github.comwrote:

@maxlinc https://github.com/maxlinc Yes codejams are every Tuesday at 7PM on CTG JOIN US THERE!

About the calendar last week we discuss exactly about that, probably will be there this week.

— Reply to this email directly or view it on GitHubhttps://github.com/thoughtworks/voto-como-vamos-2/issues/2#issuecomment-14355432 .