Puppet Blog

Back to Index

Google Summer of Code Project: Deploy Multiple MediaWiki Instances with a Puppet Module

Posted on
By
Martin Dluhos
in
Blog, Community, Modules, Open Source
Responses
1 Comment »

My name is Martin Dluhos and I come from the Czech Republic. I would like to take a moment to introduce my Google Summer of Code project on which I have been working at Puppet Labs for the last few weeks. My task for this summer is to create a Puppet module which makes it easy for system administrators to deploy a Mediawiki installation. MediaWiki has been a very popular knowledge sharing platform for various organizations as well as individuals, so I believe that a MediaWiki Puppet module will be useful to many users.

The Puppet module is designed to provide multi-tenancy. This allows the system administrator to configure the web server to serve multiple MediaWiki instances, each with its own configuration and database, using a single MediaWiki installation. The multi-tenancy option gives the user more flexibility by reducing the overhead of deploying a new MediaWiki instance while preserving strict separation between individual instances. The target platforms for this module are Debian Squeeze and Wheezy, Ubuntu Precise, and Red Hat Enterprise Linux 6, which are the most widely used distributions to run server applications such as MediaWiki. The module, however, has been designed in such a way that makes extending it for compatibility with other distributions relatively straightforward.

Following the well-established DRY principle, I have decided to take advantage of existing high-quality Puppet modules to handle installing and configuring MediaWiki’s dependencies in my implementation of the module. These include the apache and mysql modules by Puppet Labs as well as the memcached module by saz. So far I have written the first version of the module for Ubuntu Precise and Debian Wheezy. In order to achieve simplicity and flexibility, I have decided to separate MediaWiki installation from MediaWiki instance creation.

I’m still working on ensuring that the module rigorously tested before its initial release. Expect to see a Module of the Week blog post when this module hits the Puppet Forge, describing in detail what the capabilities of the module are and how to use it. For now, here is an example declaration to get a MediaWiki instance up and running.

To use the module, one will first ensure MediaWiki and all of its dependencies are installed by instantiating the mediawiki class:

   class { 'mediawiki':
      admin_email           => 'admin@puppetlabs.com',
      db_root_password      => 'really_really_long_password',
      max_memory            => '1024'
    }

and then create an individual wiki instance in the following way:

    mediawiki::instance { 'my_wiki1':
      db_password => 'super_long_password',
      db_name     => 'wiki1',
      db_user     => 'wiki1_user'
      port        => '80',
      status      => 'present'
    }

Additionally, I isolated all distribution-specific variables into a separate params class to allow for easy extensibility of the module to other distributions.

I have been struggling a little bit with a lack of documentation for how to write a proper Puppet module, which is partially a result of the absence of standardization of what a Puppet module should look like. Puppet Labs, however, is aware of this problem and has been working on improving the documentation for developers. Branan Purvine-Riley, a fellow intern, recently published a post on the Puppet Blog explaining how to go about testing a module with rspec. I am currently at the stage of finalizing tests to verify the correctness of the module for various combinations of Ruby and Puppet versions, so describing the testing process definitely came in handy. Once the module is rigorously tested, I will officially publish it at Puppet Forge for the Puppet community.

If you are interested in learning about the module implementation in more detail, you can follow my progress on GitHub. I am happy to answer questions about the module and welcome any suggestions for its improvement.

Learn More:

1 Comment

Leave a Response