1

I'm playing around with Vagrant and Puppet, provisioning a development machine for a project based on Apache/PHP/Mongo.

I have all components setting up correctly (using modules from Puppet Forge), but for the life of me, I can't figure out how to make PHP talk to Mongo. phpinfo() shows that the Mongo driver is not installed - which only makes sense, as I have no clue how to go about installing it.

The puppet module I use to install PHP is the one from Lab42, available at http://github.com/lermit/puppet-php . The readme demonstrates how to toggle modules but not drivers (afaik, Mongo connectivity is established via a driver rather than a module).

Any help, tips, or links to a .pp file where this was actually done would be most welcome. Thank you!

Update:

Figured out this magic line: php::pecl::module { "mongo": }

To basically add Mongo support via PECL. But when Puppet tries to run it, I get this:

err: /Stage[main]/Project/Php::Pecl::Module[mongo]/Package[php-mongo]/ensure: 
change from purged to present failed: 
Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install php5-mongo' 
returned 100: Reading package lists...
Building dependency tree...         
Reading state information...        
E: Couldn't find package php5-mongo 

So, a couple of things I don't understand about this:

  1. If I asked Puppet to install the module via PECL, why's it doing it via apt-get?
  2. Why can't it find that package? What repo should I add to make it work?

Thanks again.

2 Answers 2

0

I'm sure that the answer to both questions is in the puppet module that you are using.

There certainly is great advantage in using modules that others have developed, because you can gain from the knowledge that they have embedded in the modules, but I would recommend that you:

First, figure out how to do the installation manually (i.e., without puppet)

Second, create a simple Puppet module that automates that

Third, try using the puppet modules you find, esp. on puppetforge: https://forge.puppetlabs.com/ to see if they work better or offer additional features.

There are lots of good resources on Vagrant and Puppet, but one of my favorite is Deploying Rails http://pragprog.com/book/cbdepra/deploying-rails - obviously focused on Ruby on Rails, but it builds up a Vagrant/Puppet/VirtualBox testing environment that sounds a lot like yours, from scratch.

2

For me the answer was parameter use_package :

php::pecl::module { "mongo": use_package => 'no', }

Now it works like a charm!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .