labs-vagrant was a project to bring easy setup of MediaWiki + related extensions, pioneered by mw:MediaWiki-Vagrant, to labs. By re-using the puppet files from MediaWiki-Vagrant, any role available in MediaWiki-Vagrant is now available (sortof) in labs too!
The functionality of this role has been replaced by Help:MediaWiki-Vagrant in Cloud VPS.
Setting up your instance with labs-vagrant
- Ensure your project has a security group that allows access on port 80, the default port for HTTP requests. The security group may be named "Web" or "web-server", or the "default" security group for your project may allow on port 80.
- Create your instance, choosing a security group that allows access on port 80. The latest MediaWiki-vagrant puppet code assumes recent Ubuntu packages, so choose Image type "ubuntu-14.04-trusty".
- Apply the role
role::labs::vagrant. You can do this by clicking on the "configure" next to your instance in the table of all instances.
- ssh to your instance, and wait for 30 minutes (or, to bypass the wait period, run sudo puppet agent -tv)
- Run an initial labs-vagrant provision
- Use labs-vagrant list-roles to see all the available MediaWiki specific roles
- Use labs-vagrant enable-role <role-name> and labs-vagrant disable-role role-name to enable or disable mediawiki specific roles
- Run labs-vagrant provision to "commit" the current set of enabled roles. This runs puppet, and configures the extensions, packages, etc required to enable the roles you have enabled. Note that you need to run an initial labs-vagrant provision even if you do not want to enable any roles – it sets up mediawiki and associated requirements.
- See Help:Proxy to make your instance accessible at http://somename.wmflabs.org
- Login to MediaWiki on your instance as user admin then use Special:ChangePassword to change the admin password to something other than the MediaWiki-Vagrant default.
- Note there are many default settings in MediaWiki-Vagrant that leave your wiki insecure, it is tuned to be a development environment.
labs-vagrant subcommands correspond directly to the
vagrant subcommands of the same name, so if you've used vagrant for development (highly recommended!), you will feel right at home.
labs-vagrant does not implement all the commands of
For a step by step walk through of setting up a new labs instance with this, check out bd808's guide!
How do I...?
Most of your questions should be answered by reading the How do I...? section on the MediaWiki-Vagrant page. Since 99% of the code is re-used, most of your questions should be answered there.
git pull (as yourself) in the
Update and edit MediaWiki files
It's probably easiest to become user vagrant. The subcommand
git-update intelligently upgrades most of the pieces of MediaWiki.
$ sudo su vagrant $ labs-vagrant git-update $ cd /vagrant/mediawiki $ # Make temporary local changes, etc. $ exit
Migrate from using
Just uncheck the
role::mediawiki-install::labs from the wikitech interface, and follow the instructions above. If the old mediawiki install still seems to persist, run
rm -rf /etc/apache2/sites-enabled/000-wikicontroller.conf should fix it.
vagrant up and
These commands do not exist with
labs-vagrant - since you are already ssh'd into a booted labs instance, neither up nor ssh make any sense.
Avoid permission problems
The latest code has fixed most permission issues.
If a command fails with "permission denied", first retry as the
$ sudo su vagrant $ # run problem command line $ exit
If that doesn't work, retry the command with sudo prepended
Get help with roles
`labs-vagrant help roles` does not work (phab:T98821); as a workaround, since the help comes from comments at the top of the source code, you can run `
head -3 /vagrant/puppet/modules/role/manifests/*.pp` to get an overview.
Create new vagrant roles
mediawiki-vagrant repository, either on diffusion or github. See mw:MediaWiki-Vagrant for more details.
Test my puppet changes to Mediawiki-Vagrant
The idea is for you to develop your patches in your local machine, push them to gerrit, pull them onto the labs machine and test it there. This ensures that you don't have to put your private keys on the labs instance.
- Submit a patchset to Mediawiki-Vagrant via Gerrit
- ssh to your labs instance, and cd to /vagrant
- Checkout your patch from gerrit (you can copy paste the relevant git checkout command from the gerrit page for your changeset)
Use local storage for vagrant home
- Apply the role
- Create a link /home/vagrant -> /srv/vagrantHome
sudo ln -s /srv/vagrantHome /home/vagrant
- Create the directory on the node
sudo mkdir /srv/vagrantHome && sudo chown vagrant /srv/vagrantHome
To use the storage for example for mysql you can move the folder /var/lib/mysql to mount mysql and create a symbolic link. Add this to
/etc/apparmor.d/tunables/alias (There are for sure better ways to move the mysql data directory, but it has not been tested how this works togther with the vagrant mysql roles)
Choose how big an instance to use
Consider that labs-vagrant runs several services by default, including puppet and a redis jobrunner. Puppet alone can consume 1 GB RAM and all your (network-based) IO. Especially if you plan to run heavy operations like unit testing big masses of code, to avoid swapdeath and/or OOM, choose the m1.medium or m1.large instances (4 and 8 GB RAM respectively).
Change the location of the database data
The default database directory is located at
/var partion has only 2GB of storage.
If you plan to import a lot of data to your vagrant instance you might want to change the location of the database.
I changed to location to /srv/mysql as follows:
$ sudo service mysql stop $ cp -R -p /var/lib/mysql /srv/mysql $ sudo vi /etc/mysql/my.cnf # replace #/var/lib/mysql#/srv/mysql/# appears only once in datadir $ sudo vi /etc/apparmor.d/usr.sbin.mysqld # replace #/var/lib/mysql#/srv/mysql/# appears twice $ sudo service apparmor reload $ sudo service mysql start
Running a wikifarm on a single labs-vagrant host
When using roles like centralauth and wikidata you will need to be able to access multiple wikis that are provisioned on a single Labs virtual machine. By default, labs-vagrant sets up its Apache2 configuration so that if you are running from a Labs instance named
mycoolproject.eqiad.wmflabs then Apache will route requests for
something-mycoolproject.wmflabs.org the same as MediaWiki-Vagrant would route
something.wiki.local.wmftest.net. All you need to do to get access to these wikis is to follow the instructions at Help:Proxy to setup a proxy for the
something-mycoolproject.wmflabs.org DNS hostname to your
If you want to change the base name of the wikifarm to something more meaningful for external users, you can customize the name by adding local hiera configuration data:
- Make a
/vagrant/puppet/hieradata/local.yamlfile containing a base name that will be common to all of the wikis in your farm:
-- mediawiki::multiwiki::base_domain: "-mycommonwikifarmname.wmflabs.org"
- Enable role(s) that provide additional wikis (e.g. centralauth, wikidata)
labs-vagrant provisionto update the /etc/apache2/site-confs/devwiki/00-default.conf
- Configure web proxies to route to your instance using hostnames like
mywikihere would be the same name that precedes
.wiki.local.wmftest.netwhen you are using MediaWiki-Vagrant on a laptop (e.g. "login", "centralauthtest", "wikidata", etc)