MediaWiki-Vagrant/cs





 'MediaWiki-Vagrant'  je přenosné vývojové prostředí MediaWiki. Skládá se ze sady konfiguračních skriptů pro Vagrant software a VirtualBox, které automatizují vytvoření virtuálního počítače, na kterém běží MediaWiki. Protože konfigurace je zaměřena spíše na snadný vývoj než na bezpečnost, MediaWiki-Vagrant se nedoporučuje pro veřejně přístupné wiki!

Virtuální stroj (dále v textu jako "VM"), který MediaWiki-Vagrant vytváří, usnadňuje získávání informací, úpravy a vylepšování kódu MediaWiki: ve výchozím nastavení se zobrazují užitečné informace o ladění a různé vývojářské nástroje jsou speciálně nastaveny pro kontrolu a interakci s kódem MediaWiki, včetně výkonného debuggeru a interaktivního tlumočníka. Je nejlepší ze všech, protože konfigurace je automatizovaná a obsažená ve virtuálním prostředí, chyby lze snadno vrátit zpět.

Systémové požadavky
Paměť: Celkem 4 GB RAM ve vašem systému, nejlépe 8 GB případně i více, aby bylo možné spustit hostitelský operační systém i VM. '''Nepokoušejte se spustit systém s pouhými 2 GB RAM, protože nakonec to vždy selže.
 * CPU: 64bitový procesor x86
 * OS: Linux nebo macOS nebo Windows
 * Disk: Na primární jednotce musí být volných několik gigabajtů (/home partition pro Linux, C: drive for Windows). Zejména mějte na paměti, že obsahy disků VM budou ve výchozím nastavení uloženy ve vašem domovském adresáři.
 * Síť: Aktivní síťové připojení s dostatečnou šířkou pásma pro stahování aktualizací systému Debian Linux a zdrojového kódu MediaWiki
 * Čas pro nastavení: 20 minut až 2 hodiny, v závislosti na podmínkách a případných potížích

Rychlý start
(Pokud instalujete MediaWiki-Vagrant z distribuce USB, postupujte podle kroků v README místo prvních pěti kroků.)


 * 1) S Git-em
 * 2) (Pouze Linux) Nainstalujte  NFS, pokud ještě není nainstalován. V Ubuntu použijte  . Fedora obvykle přichází s nainstalovaným NFS; pokud není spuštěn.
 * 3) S VirtualBox-em
 * 4) Získejte nejnovější Vagrant
 * 5) Získejte kód a vytvořte svůj stroj:
 * (Tím se klonuje do vašeho domovského adresáře uživatele.)
 * Až budete vyzváni, zadejte své uživatelské jméno Gerrit (doporučeno) nebo stačí stisknout Enter.
 * Pokud chcete místo nejnovější verze použít větev vydání, můžete ji nyní zadat pomocí
 * 1) Povolte další funkce MediaWiki, např .:
 * 2) Po dokončení konfigurace počítače Vagrant přejděte na adresu http://dev.wiki.local.wmftest.net:8080/ a vyhledejte instanci MediaWiki. Můžete se přihlásit pomocí uživatele Admin a hesla vagrant.
 * 1) Povolte další funkce MediaWiki, např .:
 * 2) Po dokončení konfigurace počítače Vagrant přejděte na adresu http://dev.wiki.local.wmftest.net:8080/ a vyhledejte instanci MediaWiki. Můžete se přihlásit pomocí uživatele Admin a hesla vagrant.
 * 1) Po dokončení konfigurace počítače Vagrant přejděte na adresu http://dev.wiki.local.wmftest.net:8080/ a vyhledejte instanci MediaWiki. Můžete se přihlásit pomocí uživatele Admin a hesla vagrant.
 * 1) Po dokončení konfigurace počítače Vagrant přejděte na adresu http://dev.wiki.local.wmftest.net:8080/ a vyhledejte instanci MediaWiki. Můžete se přihlásit pomocí uživatele Admin a hesla vagrant.

Pokud používáte Windows
Získejte Git for Windows a spusťte příkazy  v jeho shellu Git Bash. Namísto 2$ spusťte 3$ z shellu 4$.

Pokud používáte prostředí kompatibilní s WSL Linux na Windows 10: spusťte příkazy s  namísto. Spusťte  namísto , který v bash shellu Linuxu nefunguje.

Účet, ve kterém běží Vagrant, bude pravděpodobně potřebovat oprávnění „Vytvořit symbolické odkazy“ (snadný způsob, jak toho dosáhnout, je být spuštěn jako správce).

Odstraňování potíží při spuštění
Pokud zde vaše problémy nejsou zodpovězeny, je IRC dobrá volba, konkrétně kanál.

Jakýkoli hostitel
Možná budete chtít porovnat výstup prvního spuštění aplikace vagrant up ve vašem terminálu s tímto vzorkem. Počáteční nastavení může trvat dlouho; Pokud se zdá, že někde visí, ale nedochází k žádným chybám, chvíli počkejte. Například:
 * Můžete zkusit nainstalovat verze VirtualBox a Vagrant, které vaše distribuce Linuxu poskytuje. Pokud používáte nejnovější Debian nebo Ubuntu, zkuste sudo apt-get install virtualbox vagrant a nainstalujte balíčky pro VirtualBox a Vagrant.
 * Pokud se vám objeví chyby z vagrant up, nainstalujte nejnovější verze VirtualBox a Vagrant.
 * Pokud se zobrazí chybová zpráva typu nelze otevřít soubor „Couldn't open file $CLONED_REPOSITORY/trusty-cloud“, zkuste následující příkaz: vagrant up --provider=virtualbox
 * Pokud máte nějaké loutkové chyby, možná budete muset iniciovat loutkové submodulů, ve vagrantovém adresáři spusťte git submodule update --init
 * Pomocí http://127.0.0.1:8080/info.php zkontrolujte, zda je Apache / PHP funkční.
 * Pomocí http://127.0.0.1:8080/info.php zkontrolujte, zda je Apache / PHP funkční.
 * Pokud se zobrazí upozornění, že váš dodatek hosta VirtualBox je nesprávná verze, můžete zkusit nainstalovat plugin vagrant-vbguest, který se aktualizuje automaticky.
 * Vagrant zřídka ztrácí párování s vaším VM. This thread popisuje některé způsoby, jak to obejít (např. připojit starý pevný disk VM k novému profilu)
 * Ujistěte se, že úložiště  je aktuální:
 * Ujistěte se, že jste povolili virtualizaci v systému BIOS. Někdy je to v nastavení zabezpečení.
 * Ujistěte se, že vaše nastavení kódování jazyka je UTF-8. Pokud se zobrazí „invalid byte sequence in US-ASCII“, zkuste (znovu) nastavit proměnné prostředí LANG a LC_ALL na něco vhodnějšího.


 * Někdy můžete opravit nefunkční instalace např.: "Nebyla nalezena žádná wiki ..." spuštěním , který obnoví virtuální počítač bez opakování časově nejnáročnější části instalačního procesu.

Specifické pro Windows

 * If you are on Windows and you get "guest machine entered an invalid state" - "poweroff", try downloading a 4.3.15 build of VirtualBox (there is a known problem with 4.3.14 on Windows). If that does not help, make sure you enable Hardware Virtualization Technology (VT-x or AMD-V) in BIOS. Hardware Virtualization is required. It is not an optional performance enhancement. (Some laptops require you to remove the power cable and battery for 30 seconds )
 * VirtualBox není kompatibilní s Hyper-V společnosti Microsoft. Pokud máte povolenou technologii Hyper-V (což může být výchozí, pokud jste nainstalovali aplikaci Visual Studio), zobrazí se výše uvedené chyby při spouštění virtuálního počítače ve VirtualBoxu. Existují tři možnosti:
 * V příkazovém řádku spusťte bcdedit/set hypervisorlaunchtype off Tím vypnete Hyper-V a restartujete počítač. Chcete-li Hyper-V opět zapnout, přepněte jej zpět na auto místo na off
 * Zakažte Hyper-V pomocí ovládacího panelu "Přidat nebo odebrat funkce systému Windows" (Add/Remove Windows Features) a restartujte počítač. Virtuální modul bude fungovat, ale znemožní vám používat jakékoli virtuální počítače Hyper-V, například emulátory Windows Phone.
 * nebo použijte Hyper-V poskytovatel pro Vagrant namísto VirtualBoxu. Tohle může být nestabilní.

Specifické pro Mac

 * Chyby NFS Abyste se vyhnuli chybám NFS, během instalace, zajistěte aby firewall akceptoval připojení: Apple> Předvolby systému> Zabezpečení a soukromí> Firewall> Možnosti brány Firewall (Apple > System Preferences > Security & Privacy > Firewall > Firewall Options). Budete muset zrušit zaškrtnutí políčka „Blokovat všechna příchozí připojení“ (Block all incoming connections) a pravděpodobně také zrušit zaškrtnutí políčka „Povolit tajný režim“ (Enable stealth mode), abyste akceptovali následující: netbiosd, nfsd, rpc.lockd, rpc.rquotad, rpcbind, VBoxHeadless. Během pár  sekund budete možná muset restartovat počítač a změnit stav na „Povolit příchozí připojení“(Allow incoming connections). Po instalaci, jakmile jsou pravidla brány firewall aktualizovány budete pravděpodobně muset znovu zkontrolovat "Blokovat všechna příchozí připojení" (Block all incoming connections) a "Povolit tajný režim" (Enable stealth mode).
 * Alternativně můžete vypnout sdílení NFS pomocí

Debian a Ubuntu

 * MediaWiki-Vagrant používá systém síťových souborů NFS ke sdílení některých složek s hostitelským počítačem (vaším počítačem). Počítač musíte nastavit jako „server NFS“, viz např. Ubuntu pokyny Ubuntu instructions. Na Debianu bude fungovat sudo apt-get install nfs-kernel-server ; možná budete muset také . Server NFS Debianu se nespustí bez položky v  . Pokud   neukáže spuštěné služby „nfs“, je pravděpodobné, že se to děje. Přidání domovského adresáře jako posledního řádku do   a poté /etc/init.d/nfs-kernel-server restart bude stačit, abyste tento problém vyřešili.


 * Sdílení NFS, které používá MediaWiki-Vagrant, nelze spouštět z šifrovaného adresáře. Což může stát, pokud používáte Ubuntu a používáte šifrovaný domovský adresář. Chcete-li spustit MediaWiki-Vagrant, můžete buď:
 * Před spuštěním  přesuňte adresář MediaWiki-Vagrant na nezašifrovaný svazek (např.  ).
 * Alternativně můžete vypnout sdílení NFS pomocí
 * Nastavení NFS někdy uvízne (počáteční  visí na "Připojování sdílených složek NFS"). Restartování démona NFS na hostiteli pomáhá. (Viz # 5802.)


 * If you are getting port forwarding errors saying the ports are in use, you may need to open up virtualbox, entirely remove the virtual machine, and try again.

Fedora

 * If you get Network 10.11.12.13 is not available. after running, disable SELinux via   or fix your SELinux setup.
 * If you get The provider for this Vagrant-managed machine is reporting that it is not yet ready for SSH. after running, make sure to explicitly set the provider, for example via   followed by
 * If you get mount.nfs: mount to NFS server '10.11.12.13:download-directory/vagrant' failed: RPC Error: Unable to receive, run

Basic usage
The vagrant command-line tool on the host machine provides several subcommands for controlling your virtual machine. You've already used one: vagrant up, which turns on the virtual machine. Like most vagrant subcommands, you need to run it from the MediaWiki-Vagrant directory or one of its children. When you first run it, Vagrant will fetch a system image and set up requisite software for running MediaWiki. This can take 1–2 hours of CPU and wall clock time on a broadband connection, but it only needs to happen once. When you run vagrant up in the future, it will simply boot up the machine.

vagrant ssh starts an interactive login shell on the virtual machine. It'll log you in as the user vagrant ; root access is available to via sudo, which is passwordless. Because the virtual machine is entirely sandboxed within your computer, it is configured for convenience, not security. As a rule, whenever you encounter a password prompt, the password is.

When you log in, you should see a colorful MediaWiki banner and a few reminders of useful commands.

The command phpsh will start an interactive PHP interpreter with MediaWiki's codebase already loaded. You can type in some code, hit 'enter', and the code will be evaluated immediately. If you start a line with '=', its computed value will be pretty-printed. Type ? for quick help or help start for additional instructions.

The  folder corresponds to the MediaWiki-Vagrant folder on your host machine, and its contents is shared. MediaWiki's code is installed in. This allows you to use your normal editor environment on your host machine to edit the MediaWiki code that runs on your virtual machine.

Updating
Use vagrant git-update to keep your git repositories, external libraries, and database schema up to date. This command is equivalent to running
 * 1) git pull in   and all extension and skin directories
 * 2) composer update to ensure that the latest Composer-managed libraries are available
 * 3) finally the   script.

You should also occasionally (or when needed for a new feature) update MediaWiki-Vagrant itself, which vagrant git-update does not include. Run:

… in your MediaWiki-Vagrant root directory. This will take effect when you run:

… (immediately or later).

Log out of your virtual machine by typing logout or by pressing CTRL + D. Now that you're back in a standard command prompt, you can run vagrant halt to shut down the virtual machine and vagrant up to bring it back up. vagrant destroy will delete the virtual machine's files; this command is useful if you want to return your instance to a pristine state. (You'll need to follow up with vagrant up to provision a fresh instance.)

Using roles
MediaWiki-Vagrant sets up a basic MediaWiki instance by default, but it also knows how to configure a range of complementary software, including some popular MediaWiki extensions and their dependencies. These optional software stacks are collectively known as 'roles', and MediaWiki-Vagrant offers an easy and powerful command-line interface for managing them.

 $ vagrant roles list


 * 1) Display a list of available roles.

 $ vagrant roles enable role


 * 1) Turn on role for this machine.

 $ vagrant roles disable role


 * 1) Turn off role for this machine.

 $ vagrant provision


 * 1) After you are done enabling and/or disabling roles, run this to make the change take effect.

Watch a short screencast demonstrating how to use roles. Roles has more information about some roles.

If you add many roles, you may need to increase memory available to the Vagrant VM. In particular, setting up the "browsertests" role involves compiling the  ruby Gem which is a memory-hungry task; if it fails try freeing some memory in the VM or increasing its memory allocation.

See the section Authoring roles below if you're interested in adding roles to MediaWiki-Vagrant.

centralauth
There are some roles that require special attention, centralauth role does not run db migrations automatically via puppet and requires running those by hand. If you get errors on provisioning this role try to run this script on the extension and see the errors it outputs:

mwscript extensions/CentralAuth/maintenance/migrateAccount.php --username 'Admin' --auto

Once you get a more concrete error you probably need to know what migration you need to run from the ones here:

extensions/CentralAuth/db_patches

wikidata
A simple  would fail. Here is a complete set of commands to make the Wikidata role up and running.

$ vagrant up $ vagrant git-update $ vagrant ssh $ sudo apt-get update && sudo apt-get upgrade $ composer selfupdate --update-keys $ composer config --global process-timeout 9600 Log out from Vagrant, then you can happily run: $ vagrant roles enable wikidata $ vagrant provision

Note that the first provision may complain, thus looking like a failure. However, if you run a second provision, you will see that everything goes fine.

You may then point your browser to http://wikidata.wiki.local.wmftest.net:8080/. To create a new wikidata item load http://wikidata.wiki.local.wmftest.net:8080/wiki/Special:NewItem and to create a new property navigate to http://wikidata.wiki.local.wmftest.net:8080/wiki/Special:NewProperty

How to import a Wikidata dump
The Vagrant command, which  , does not handle wikis other than the default one (see phab:T183274). You need to run the  script inside the Vagrant box.

Here is the procedure to import XML dumps.

$ mkdir wikidata_dumps $ cd wikidata_dumps $ wget https://dumps.wikimedia.org/wikidatawiki/latest/wikidatawiki-latest-pages-articles10.xml-p5264684p6341661.bz2 $wgWBRepoSettings['allowEntityImport'] = true;
 * download the  chunks. For instance:
 * enable the import of Wikibase entities (see phab:T72898). Append the following line to your :
 * the following BASH script can help you monitor the process. You can paste it in a  file. Note that the highlighted line calls the actual import script:

$ vagrant ssh $ cd /vagrant $ sudo chmod +x import_wikidata.sh $ ./import_wikidata.sh   $ tail -f wd_import.log
 * log into the Vagrant box and run the script. Debug messages should show up there:
 * you can follow the progress log from outside the Vagrant box:

Local MediaWiki core copy
Sometimes you may want to start over from scratch by removing the entire vagrant directory or cleaning out the vagrant/mediawiki directory. In order to speed up the vagrant provisioning process, you may want to consider keeping a local, updated clone of the MediaWiki core that you copy into vagrant/mediawiki.

for example, assuming you are cloning MediaWiki repos into ~/projects/mediawiki/ :

Update cloned repos
Update the cloned repos as often as possible/necessary.

Or to update all cloned repos:

Vagrant reload
If you change configuration (e.g. vagrant_ram, your VM/MediaWiki web site freezes, or you experience a problem, vagrant reload may resolve it. This will restart your guest. Some roles also require a reload, which should happen automatically.

When to enable roles
Enable roles only once you've successfully run your first vagrant up.

Note that vagrant destroy will not reset the enabled roles. Be sure to disable all roles after running vagrant destroy, then run vagrant up. Then you can re-enable any roles and run vagrant provision.

Vagrant behind proxy
If you are behind a proxy, Vagrant might throw some errors. You can install vagrant-proxyconf. It’s a plugin that allows your virtual machine to use specified proxies. This is a quick set up guide. For a detailed documentation you may check here.

Install the plugin:

To configure proxy settings for all softwares on all vagrant VMs, add following lines to your  (default  ).

Replace the addresses with the ip and port number of your proxy server. Use the config.proxy.no_proxy option to list out all the sites/domains for which you might want to bypass proxy. For example,

Now when you run a vagrant up, there shouldn’t be any warnings.

To disable the plugin set config.proxy.enabled to false or empty string (""). You can also disable it for specific applications. For example,

MediaWiki-Vagrant prep
You may want to consider using a shell script such as mw-vagrant-prep to prepare a directory for a MediaWiki-Vagrant install.

Provisioning
You can debug the provisioning process by running

PHP
You can debug PHP with Xdebug. Debugging in PHP is different from other client-side debugging. Your IDE listens for incoming connections, and when you access the server with a browser, a special header instructs PHP to connect to your IDE. See MediaWiki-Vagrant/Advanced usage for further information.

HHVM
See Manual:How to debug#HHVM for debugging under HHVM.

Chrome

 * For Chrome users, you should get XDebug Helper, and optionally Clear Cache, HTTP headers, and Mod Headers. Configure clear cache to automatically reload after clearing, and set up keyboard shortcuts (e.g. Ctrl+R for clear&reload, Ctrl+Shift+D to switch XDebugger on/off)

Firefox

 * Firefox users should check out easy Xdebug.
 * Install and configure an xdebug-compatible IDE on your machine (Eclipse, PhpStorm, Emacs, etc)
 * In IDE, start listening for the incoming debug connection
 * In IDE, set break point at the spot that interests you
 * Enable XDebug in the browser and navigate to your vagrant installation ( http://127.0.0.1:8080/... )

Log files
The mediawiki logs can be found in /vagrant/logs. There are log files for Apache in /var/log/apache2/, but it seems they are not written to. There is a log file for HHVM in /var/log/hhvm/. The PHP notices, warnings, errors, uncaught exceptions are logged by HHVM to the syslog which you can see in /var/log/syslog. The MySQL query log can be obtained by issuing SET GLOBAL general_log = 'ON'; in a client and then looking at /var/lib/mysql/*.log.

Running and debugging unit tests
To run the tests for ALL extensions:

To run unit tests for a single extension:

You can append path/to/tests/to/run.

Some tests may require running as the proper user to create lock files and such, hence this command runs as the "user"  that handles web requests.

For building coverage reports, see Manual:PHP unit testing/Code coverage.

Debugging phpunit tests is a little more complex. This method is a bit hacky, but can be used until debugging remote interpreter improves (e.g. in phpStorm 8 EAP). This workaround lets you run MediaWiki unit tests from the browser.
 * Download phpunit.phar file to the root of your vagrant directory.
 * Create a php file  in the root of the   directory. Do not commit this file to the repository. Paste the following code into it:


 * In the above file, change argv parameter to the name of your test file
 * Apache maps the root of the mediawiki directory to . So navigate to http://127.0.0.1:8080/w/unittest.php to run this file
 * Follow #Debugging instructions to attach your debugger

Running browser tests
See.

This link is pointing to deprecated documentation, someone who knows more about testing MediaWiki should update:

Pushing commits
If you're using MediaWiki-Vagrant for development you'll probably want to push some commits to MediaWiki core or an extension's repository using git review. By default, all remotes point to the  URLs. To avoid overriding this on a case by case basis, run:

$ git config --global url."ssh:// @gerrit.wikimedia.org:29418/".insteadOf "https://gerrit.wikimedia.org/r/"

You also need to have your ssh keys in.

How do I...?

 * Check PHP version and settings
 * http://127.0.0.1:8080/info.php


 * Edit LocalSettings.php?
 * First, check that there is no role ( vagrant list-roles ) that already does what you need. If not, create a file in  directory. See README and 00-debug.php-example file.


 * Update MediaWiki code?
 * The easiest is to use  from the host.  Or, to just update the code without dependencies, you can use regular git ,  , etc. commands in   and   directories. You can run these commands on the virtual machine, but the file access will be faster on the host machine. MediaWiki-Vagrant pulls code from git master when you initially set up and/or add a role, but doesn't automatically update code after that.


 * Run MediaWiki PHP interpreter
 * ssh to vagrant and run . You might need to run it with


 * Run MediaWiki SQL interpreter
 * ssh to vagrant and run . You might need to run it with

''NN packages can be updated. NN updates are security updates.'' In vagrant ssh:
 * Update virtual machine software packages?
 * does not update system packages in the VM. When you connect with vagrant ssh the login message will inform that you:
 * to update all packages, enter
 * for "automatic installation of security (and other) upgrades", similar to Cloud VPS instances, enter
 * to update to the same packages that are on production WMF servers... TODO


 * Customize Vagrant
 * You should never need to change Vagrantfile directly. There are several aspects of vagrant you can customize:
 * Core settings (git user, ports, ram, ip, port forwarding) can be customized via .settings.yaml file. See  and   for instructions. So for example you may run   to enable port forwarding from host:1234 to guest:80.
 * Perform additional steps after Vagrantfile load by creating a file called Vagrantfile-extra.rb and placing it in the same folder as Vagrantfile - it will be automatically loaded. In case of conflict, values in the 'extra' file will supersede values in this file. See example in support/ directory.


 * Add custom Puppet code?
 * This is ideal if you want to work on your own MediaWiki site locally and let the MediaWiki-Vagrant install your dependencies for you. It's ideal if you have your own fork.  There is a distinction between a role and this use case. Roles are meant to be installed in any order and without breaking. If your fork needs different calls and get in trouble with roles, create your own class and call what you need, including roles.
 * To do so, place your custom puppet code in  with your own class, like so:

To apply your class, add it to the "classes" key in. You can create the file if it doesn't exist.

Then run  to apply the change via Puppet.


 * Update MediaWiki-Vagrant itself?
 * (For example, to use new roles.) In a terminal, change to the vagrant directory on the host computer and enter a regular git command such as . You will typically want to run   after updating to apply any new puppet changes to your virtual machine.


 * Run GUI applications on the virtual machine?
 * If you have an X server installed, SSH into the virtual machine using  to enable X forwarding. (Mac users should update to the latest version of XQuartz.)


 * As an alternative, you can run the virtual machine in GUI mode, which allows you to interact with the VM as though it had a physical display. To enable GUI mode, create a file called  in the root repository folder, with this as its content:


 * Save the file and run  followed by  . The virtual machine's display will appear in a window on your desktop.


 *  Adjust the resources allocated to the VM?
 * If you'd like to allocate more or less CPU / RAM to the VM, see  for instructions.

Alternatively, you can do it by creating Vagrantfile-extra.rb (see support/ dir for an example):


 * Change the editor used for git commit messages?

Go to Horizon, choose Web Proxies, and enter a DNS hostname, say View your new wiki at " http:// /wiki/ "
 * Setup a custom hostname?

Create a local.yaml file in the /vagrant/puppet/hieradata directory. In it, add: Run.
 * Make the custom hostname point to homepage of my vagrant role instead of wiki homepage?


 * Run a branch of MediaWiki other than master?
 * Set the "" key in .  You can create the file if it doesn't exist.


 * Run MediaWiki under HHVM rather than Zend PHP?
 * To convert all wikis in your MediaWiki-Vagrant instance to HHVM:

MediaWiki settings
As an alternative to managing all MediaWiki settings in a single, large LocalSettings.php file, consider grouping your configurations by component or theme, and creating a separate PHP file in  for each group. This makes it quite easy to keep your settings organized, to temporarily disable specific configurations, and to share settings with others. MediaWiki will automatically load any PHP files in  in lexical order. You can control the order in which your configurations are set by adopting the habit of adding a two-digit prefix to each file name.

For example:

 settings.d/   ├── 10-RunFirst.php ├── 20-SomeExtension.php └── 99-RunLast.php Note that the settings files in  are automatically created and destroyed in response to your Puppet configuration. Don't put your custom settings there, because Puppet will erase or override them. Keep your custom settings files in  instead.

Vagrant flags
vagrant config --list display a list of all current Vagrant flags.

After the initial, in your vagrant directory, you can then set one of the vagrant flags that appears in the config list, e.g.

Job queue
If you're testing something that needs to churn the job queue, you may need to increase the number of job runners. Currently this is not available through LocalSettings.php, but must be set in the config file for the job runner.


 * 1) Open
 * 2) Change the value for the ' ' key from   to the desired value (say,  )
 * 3) Re-provision with
 * 4) Beware this will be a difference from the git master in your code

See instructions above for adjusting CPU core count appropriately (highly recommended for CPU-bound task such as video transcoding).

Additional storage space
By default, there is relatively little free space on the root partition within the VM. If you plan to test uploading and processing of large image and video files, this may be insufficient.

Manual steps:
 * Shut down the VM
 * Open VirtualBox Manager
 * Select the VM and go into Settings
 * Under Storage, select "Controller: SATA" and click the "Add hard disk" icon.
 * Select the default disk image type.
 * Name the disk 'VagrantImageSpace' or similar, and give it enough space (say, 80GB) -- by default the file will start small and expand to actual usage, so give as much space as you might need
 * Close out the dialogs and restart the VM
 * Run  to get a shell inside the terminal
 * Run  to set up new partitions...
 * Type,  ,  , and hit (enter) twice for default size
 * Type  to save the partition table
 * Run  to create the filesystem
 * Run  to edit the mounts list
 * Add line at end:
 * save out
 * Run  to mount the filesystem
 * Run  to set the file permissions
 * Exit the shell
 * Reboot the VM

Authoring roles
The virtual machine created by MediaWiki-Vagrant resembles Wikimedia's production environment in key respects, and it uses the same tool—Puppet—that Wikimedia's technical operations team uses to manage production servers and Wikimedia Cloud VPS instances. Puppet is a configuration management tool that provides a domain-specific language for expressing software configurations in a declarative fashion. Files containing Puppet code are called 'manifests'. When Puppet runs, it interprets the manifests you feed it and configures the machine accordingly. A Vagrant role is a set of Puppet manifests.

MediaWiki-Vagrant's Puppet codebase contains abstractions that make it easy to automate the configuration of MediaWiki extensions and related software. If you are a developer working on a software project that relates to MediaWiki, you are encouraged to submit a patch with a Puppet role for your project. Adding a Vagrant role for your project makes it easy for other developers to check out your work. Using a managed virtual machine as a development sandbox for your project reduces the chance of "works-on-my-machine" errors that often result from geographically remote developers working in incompatible environments.

The easiest way to get started with custom roles is to look at how existing roles are implemented in. These roles depend on Puppet modules in  (usually,   translates to a call to  ) and use files and templates from the other   directories. The Puppet code is generally well-documented and contains examples that demonstrate its proper usage.

Some of the more useful puppet modules are:
 * mediawiki::extension: install and configure an extension (example)
 * mediawiki::import::text: create a documentation or test page on the wiki (example: declaration, page)
 * mediawiki::import::dump: import a wiki dump (example)
 * require_package: install a system package (example)
 * exec: execute a shell command (example)

Setting up an instance on Cloud VPS
You can use MediaWiki-Vagrant in Cloud VPS to install MediaWiki on a Wikimedia Cloud VPS instance and enable MediaWiki-Vagrant roles in it.

Bugs
If you spot a bug in MediaWiki-Vagrant, please report it. First, make sure the bug is not a known Vagrant or VirtualBox bug by searching the Vagrant issue tracker on GitHub and the VirtualBox bugtracker. If it is not, go ahead and submit the bug to Wikimedia Phabricator. Clearly describe the issue and include steps to reproduce, whenever possible.

Links

 * Project page on Ohloh
 * MediaWiki-Vagrant on GitHub
 * Issue tracker on Phabricator
 * HHVM/Vagrant steps necessary to enable the hhvm role on older MediaWiki-Vagrant installs
 * Bash commands needed for quick start on Ubuntu
 * Bash commands needed for quick start on Ubuntu