MediaWiki-Vagrant/ru





MediaWiki-Vagrant — это портативная среда разработки MediaWiki. Она состоит из набора скриптов конфигурации для Vagrant и VirtualBox, которые автоматизируют создание виртуальной машины, на которой запускается движок MediaWiki. Поскольку конфигурация ориентирована на легкую разработку, а не на безопасность, MediaWiki-Vagrant не рекомендуется для общедоступных вики.

Виртуальная машина, создаваемая MediaWiki-Vagrant, позволяет легко узнать, изменить и улучшить код MediaWiki: полезная информация об отладке отображается по умолчанию, а различные инструменты разработчика настроены специально для проверки и взаимодействия с кодом MediaWiki, включая мощный отладчик и интерактивный интерпретатор. А самое лучшее, что поскольку конфигурация автоматизирована и содержится в виртуальной среде, ошибки легко отменять.



Системные требования

 * CPU
 * 64-bit x86 processor


 * OS
 * Linux, macOS, or Windows


 * Память
 * At least 4 GiB RAM total on your system, preferably 8 GiB or more, in order to run both the host operating system and the VM. Do not attempt to run on a system with only 2 GiB RAM, it will eventually fail.


 * Диск
 * For complex installations, you must have 10–12 GB free on the primary drive ( partition for Linux,   drive for Windows). Note in particular that the VM disk images will be stored under your home directory by default.


 * Network
 * Active network connection with sufficient bandwidth to download Debian Linux updates and the MediaWiki source code.


 * Time for setup
 * 20 minutes to 2 hours, depending on conditions and if you have any troubles



Быстрый старт
(Если вы устанавливаете MediaWiki-Vagrant через USB-дистрибутив, выполните действия, описанные в файле README, а не первые пять шагов.)


 * 1) Скачайте Git
 * 2) (Linux only) Install NFS if it is not already installed.
 * 3) * In Ubuntu, use.
 * 4) * Fedora usually comes with NFS installed; if not, run.
 * 5) Скачайте VirtualBox
 * 6) Скачайте последнюю версию Vagrant. Note that Vagrant v2.3.7 is the last version licensed under a free license.
 * 7) Clone code into your current directory (don't clone into a folder in WSL)
 * 8) Enter vagrant directory to run   commands in:
 * 9) Run setup script to setup vagrant before starting the machine:
 * Linux/macOS:
 * Windows:
 * При появлении запроса введите ваш логин в Gerrit (рекомендуется) или просто нажмите Enter.
 * Если вы хотите использовать релизную ветку вместо последней версии, вы можете указать это при помощи
 * 1) Start the virtual machine:
 * Doing this for the first time might ask for your password as setting up directory sharing via NFS requires sysadmin rights. You can avoid that by setting the appropriate sudo permissions, as described here.
 * Pay attention to the console output to make sure that there are no errors. If you bump into errors, the #Troubleshooting startup section may be helpful.
 * 1) Перейдите на $url или выполните команду   (только для Linux) или откройте свой экземпляр MediaWiki. Вы можете войти с учётной записью  Admin  и паролем  vagrant .
 * 2) Включите дополнительные возможности MediaWiki и расширения.
 * To see a list of features (vagrant roles) you can enable, run:
 * To enable a feature, for example the, run:
 * To apply the roles you've enabled to your wiki, run:
 * 1) Перейдите на $url или выполните команду   (только для Linux) или откройте свой экземпляр MediaWiki. Вы можете войти с учётной записью  Admin  и паролем  vagrant .
 * 2) Включите дополнительные возможности MediaWiki и расширения.
 * To see a list of features (vagrant roles) you can enable, run:
 * To enable a feature, for example the, run:
 * To apply the roles you've enabled to your wiki, run:
 * To apply the roles you've enabled to your wiki, run:
 * To apply the roles you've enabled to your wiki, run:

Windows Subsystem for Linux (WSL)
If you are using the WSL Linux-compatible shell on Windows: run commands with  instead of. Run  instead of , which does not work in the Linux bash shell.

The account running Vagrant will probably need the "Create Symbolic Links" permission (the easy way to achieve that is running as administrator).



Поиск и устранение неисправностей
Если на ваши вопросы нет ответа здесь, то хорошим вариантом будет IRC, особенно канал.


 * Sometimes you can fix broken installations (e.g. one saying "No wiki found..." by running  which will rebuild the virtual machine without repeating the most time-consuming parts of the installation process.



Любой хост
vagrant up --provider=virtualbox
 * You can try installing the versions of VirtualBox and Vagrant that your Linux distribution provides. If you're running recent Debian or Ubuntu, try sudo apt-get install virtualbox vagrant to install the packages for VirtualBox and Vagrant.
 * If you get errors from vagrant up, instead install the most recent versions of VirtualBox and Vagrant.
 * If you run into error message like "Couldn't open file $CLONED_REPOSITORY/trusty-cloud", try the following command:
 * If you got any puppet errors you might need to init puppet submodules, on vagrant directory run git submodule update --init
 * Use http://127.0.0.1:8080/info.php to check that Apache/PHP is up and running.

You might want to compare the output of the initial run of vagrant up in your terminal with this sample. The initial setup may take a long time; if it seems to hang somewhere but there are no errors, just give it a while.

Например:
 * If you get warnings that your VirtualBox Guest Additions are the wrong version, you can try installing the vagrant-vbguest plugin which updates them automatically.
 * Vagrant rarely loses pairing with your VM. This thread discusses some ways to work around it (e.g. attaching old VM harddrive to the new profile)
 * Make sure that  repository is up to date:
 * Make sure that you have enabled virtualization in the BIOS. Sometimes this is under the Security settings.
 * Make sure your language encoding settings are UTF-8. If you get "invalid byte sequence in US-ASCII", try (re)setting your LANG and LC_ALL environment variables to something suitable.

Специфично для Windows
Чтобы включить обратно Hyper-V, верните его в auto вместо off Это может быть нестабильно.
 * 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 несовместим с Hyper-V от Microsoft. If you have Hyper-V enabled – which may be the default if you have installed Visual Studio – you'll get the above errors trying to boot up a VM in VirtualBox. Есть три возможности:
 * In command prompt, run bcdedit /set hypervisorlaunchtype off to turn off Hyper-V and reboot.
 * Отключите Hyper-V через 'Add/Remove Windows Features' в панели управления и перезагрузитесь. This will get VirtualBox working, but will prevent you from using any Hyper-V VMs you may have, such as Windows Phone emulators.
 * or, use the Hyper-V provider for Vagrant instead of VirtualBox.

Специфично для Mac

 * NFS errors To avoid NFS errors, while installing, ensure the firewall will accept connections: Apple > System Preferences > Security & Privacy > Firewall > Firewall Options. You will need to UNcheck "Block all incoming connections" and probably also UNcheck "Enable stealth mode" in order to accept the following: netbiosd, nfsd, rpc.lockd, rpc.rquotad, rpcbind, VBoxHeadless. Note, you may need to restart your computer and change the status to "Allow incoming connections" during a couple s. After installation, you may be able to re-check "Block all incoming connections and "Enable stealth mode" now that the firewall rules have been updated.
 * В качестве альтернативы, вы можете отключить NFS при помощи



Debian и Ubuntu
You need to set up your computer as an "NFS server", see e.g., Ubuntu instructions. On Debian, sudo apt-get install nfs-kernel-server will work; you may need to  as well. ''' Note that Debian's NFS server will not start without an entry in. ''' If  doesn't show "nfs" services running, this is likely what's going on. Adding your home directory as the last line in  and then /etc/init.d/nfs-kernel-server restart will usually be good enough to get you past this chicken-and-egg problem. Restarting the NFS daemon on the host helps. (See #5802.)
 * MediaWiki-Vagrant uses NFS to share some folders with the host machine (your computer).
 * The NFS shares used by MediaWiki-Vagrant cannot be run from an encrypted directory, as may be the case if you are running on Ubuntu and using an encrypted home directory. To run MediaWiki-Vagrant, you can either:
 * Move the MediaWiki-Vagrant directory to an unencrypted volume (e.g., ) before running
 * Alternatively, you can turn off NFS shares via
 * NFS setup seems to get stuck sometimes (initial  hangs at "Mounting NFS shared folders").
 * 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.
 * may tell you that "The executable 'bsdtar' Vagrant is trying to run was not found in the PATH variable." You can fix this on Ubuntu with.
 * On Ubuntu with Secure Boot enabled, you will have a difficult time installing VirtualBox. Your machine may give you guff when you run . If it does, you can rectify the situation by signing the associated kernel module. Step-by-step instructions can be found in this askubuntu post.

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



Базовое использование
Инструмент командной строки vagrant на машине-хосте предоставляет некоторые подкоманды для контроля вашей виртуальной машины. Вы уже пользовались одной из них: vagrant up, которая включила виртуальную машину. Как и большинство подкоманд vagrant, вам нужно запускать их из директории MediaWiki-Vagrant или одной из её дочерних. Когда вы запускаете её в первый раз, Vagrant получит образ системы и настроит необходимое программное обеспечение для запуска MediaWiki. Это может занять 1–2 часа времени CPU и настенных часов на широкополосном соединении, но это нужно всего один раз. Когда вы запустите vagrant up в будущем, он просто загрузит машину.

vagrant ssh запускает интерактивную оболочку входа (login shell) на виртуальной машине. Он авторизует вас как пользователя vagrant ; root-доступ возможен через sudo, который выполняется без пароля. Поскольку виртуальная машина целиком находится в песочнице внутри вашего компьютера, то она настроен для удобства, а не безопасности. Как правило, когда вы встречаете запрос пароля, этот пароль.

После авторизации вы должны увидеть цветной баннер MediaWiki и несколько напоминаний о полезных командах.

Команда phpsh запускает интерактивный PHP-интерпретатор с уже загруженным кодом MediaWiki. Вы можете ввести какой-либо код, нажать «Enter», и код будет моментально выполнен. Если вы начнёте строку с «=», её расчётное значение будет красиво отформатировано и выведено. Введите ? для быстрой справки или help start для дополнительных инструкций.

Папка  соответствует папке MediaWiki-Vagrant на вашей машине-хосте, и её содержимое общее. Код MediaWiki установлен в. Это позволяет вам использовать свою обычную среду редактирования на машине-хосте, чтобы редактировать MediaWiki-код, который запускается на вашей виртуальной машине.

Обновление
Используйте vagrant git-update, чтобы сохранять актуальность ваших git-репозиториев, внешних библиотек и схемы базы данных. Это команда эквивалентна запуску


 * 1) git pull в   и директориях всех расширений и тем отображения
 * 2) composer update, чтобы убедиться, что доступны последние версии библиотек, устанавливаемых через Composer
 * 3) и наконец.

Вам также следует периодически (или когда потребуется новая функциональность) обновлять сам MediaWiki-Vagrant, vagrant git-update это не включает. Запустите:

… в вашей корневой директории MediaWiki-Vagrant. Это возымеет эффект после запуска:

You can run that command immediately after you run git pull, or sometime after.

Log out of your virtual machine by typing logout or by pressing Ctrl. 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.)



Использование ролей
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.

Посмотрите короткий скринкаст, демонстрирующий, как использовать роли. Страница о ролях содержит больше информации о некоторых ролях.

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.

Смотрите раздел Создание ролей ниже, если вы заинтересованы в добавлении ролей в 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.

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



Как импортировать дамп Викиданных
The Vagrant command, which imports an XML file into MediaWiki, does not handle wikis other than the default one (see T183274). You need to run the  script inside the Vagrant box.

Здесь описана процедура импорта XML-дампов.


 * скачайте части . Например:


 * 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:


 * 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:



Speeding up MediaWiki on Windows
MediaWiki out-of-the-box will likely run slow (page loads take 5+ seconds). This is because the virtual machine uses a shared file system that retrieves the files very slowly. Enabling NFS on Windows by installing the Vagrant WinNFSd plugin with, enabling NFS shares with  , and restarting the machine with   should significantly speed up page load times. You should make sure that the plugin is installed every time you run the machine as well. You can further speed it up by enabling, however, be warned that your wiki may run into weird errors because some files may not be updated completely when using the cache.

You can also speed up Mediawiki by using. Make sure not to enable it at the same time as. Enable it with  and run   in an shell run as an administrator. If you don't run it as an administrator, you will be warned with an error when vagrant goes up and when you go to the wiki address, you will see a. When prompted, type in the username of your account (the name of your home user directory) and password (your Microsoft account password if your account is not a local account with a normal password).



Локальная копия ядра MediaWiki
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.

например, предположим, что вы клонируете репозитории MediaWiki в ~/projects/mediawiki/ :



Обновление склонированных репозиториев
Обновляйте склонированные репозитории так часто, как это возможно/необходимо.

Или для обновления всех склонированных репозиториев:



Перезапуск Vagrant
If you change configuration (e.g. vagrant_ram, your VM/MediaWiki website freezes, or you experience a problem, vagrant reload may resolve it. This will restart your guest.  Some roles also require reloading, which should happen automatically.



Когда включать роли
Включайте роли только после того, как вы успешно выполнили свой первый vagrant up.

Обратите внимание, что vagrant destroy не сбросит включённые роли. Убедитесь, что отключили все роли после выполнения vagrant destroy, затем выполните vagrant up. Теперь вы можете заново включить любые роли и запустить vagrant provision.



Vagrant за прокси
Если вы находитесь за прокси, Vagrant может бросить несколько ошибок. Вы можете установить vagrant-proxyconf. Это плагин, который позволяет вашей виртуальной машине использовать определённые прокси. Это руководство по быстрой установке. Подробную документацию смотрите здесь.

Установите плагин:

To configure proxy settings for all pieces of software on all vagrant VMs, add the following lines to your  (default  ).

Замените адреса на ip и номер порта вашего прокси-сервера. Используйте настройку config.proxy.no_proxy, чтобы перечислить все сайты/домены, для которых вы хотите обойти прокси-сервер. Например,

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.

Vagrant
You can debug MediaWiki-Vagrant itself (e.g. the errors that happen during ) with  :

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.

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

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/... )



Файлы журналов (логи)
Логи mediawiki находятся в /vagrant/logs. Файлы логов для Apache находятся в /var/log/apache2/, но похоже, что они не пишутся. Лог запроса MySQL может быть получен выполнением SET GLOBAL general_log = 'ON'; на клиенте и затем просмотром /var/lib/mysql/*.log.

<span id="Running_and_debugging_unit_tests">

Запуск и отладка юнит-тестов
Чтобы запустить (run) тесты для ВСЕХ расширений:

To run unit tests for a single extension:

Вы можете добавить 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#MediaWiki-Vagrant.

Отладка тестов phpunit немного сложнее. This method is a bit hacky, but can be used until debugging remote interpreter improves (e.g. in phpStorm 8 EAP). Этот обходной пусть позволяет вам запускать юнит-тесты MediaWiki из браузера.


 * Загрузите файл phpunit.phar в вашу корневую директорию vagrant.
 * 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

<span id="Running_browser_tests">

Запуск браузерных тестов
For JavaScript unit tests (QUnit), see.

For browser end-to-end tests (Selenium), see

<span id="Pushing_commits">

Отправка (push) коммитов
Если вы используете MediaWiki-Vagrant для разработки, то вы, вероятно, захотите отправить (запушить) некоторые коммиты в репозиторий ядра MediaWiki или расширения, используя git review. По умолчанию все удалённые репозитории указывают на URL'ы с. Чтобы избежать переопределения этого на каждом конкретном случае, выполните:

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

Вам также необходимо иметь свои ssh-ключи в.

Gerrit
To submit changes, use  to navigate to your extensions folder. Then follow the instructions on submitting a patch via gerrit.

Troubleshooting

 * Проверить версию и настройки PHP
 * http://127.0.0.1:8080/info.php


 * Отредактировать LocalSettings.php?
 * Сначала проверьте, что нет роли ( vagrant list-roles ), которая уже делает то, что вам нужно. Если нет, создайте файл в директории . Смотрите README и файл 00-debug.php-example.


 * 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.


 * Запустить интерпретатор PHP для MediaWiki
 * Подключитесь по ssh к vagrant и запустите . Вам может потребоваться запустить это с


 * Запустить интерпретатор SQL для MediaWiki
 * Подключитесь по ssh к vagrant и запустите . Вам может потребоваться запустить это с

''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.


 * Добавить собственный код Puppet?
 * 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. Вы можете создать файл, если он не существует.

Затем запустите, чтобы применить изменения используя 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.


 * <span id="Adjust_CPU"> 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 &lt;hostname>

View your new wiki at " http://&lt;hostname>/wiki/ "


 * Make the custom hostname point to homepage of my vagrant role instead of wiki homepage?
 * Создайте файл local.yaml в директории /vagrant/puppet/hieradata directory. В нём добавьте:

Выполнить.


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

<span id="Advanced_usage">

Расширенное использование
<span id="MediaWiki_settings">

Настройки MediaWiki
As an alternative to managing all MediaWiki settings in a single, large 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.

Например:

<pre style="background-color: #efefef; border: 0; display: inline-block; font-family: Consolas, monaco, monospace; margin: 0.4em 0 1em; padding: 0.2em 0.6em;"> 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.

<span id="Vagrant_flags">

Флаги Vagrant
выводит список всех текущих флагов Vagrant.

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

<span id="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
 * 1) Change the value for the ' ' key from   to the desired value (say,  )
 * 1) Re-provision with
 * 1) 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).

<span id="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

<span id="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)

<span id="Setting_up_an_instance_on_Cloud_VPS">

Установка инстанса в 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.

Баги
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 a bug report to Wikimedia Phabricator. Clearly describe the issue and include steps to reproduce, whenever possible.

Ссылки

 * Страница проекта на Ohloh
 * MediaWiki-Vagrant на GitHub
 * Трекер задач на Phabricator
 * Команды bash, необходимые для быстрого старта в Ubuntu
 * OS upgrade
 * OS upgrade