User:Valhallasw/Draft

This document describes the development process for Wikimedia's Phabricator instance. Phabricator is written in PHP, just like MediaWiki, which should help in getting started with development. In this document, we will first take a look at how Wikimedia is using Phabricator, and what to expect during development. Afterwards, there are a few notes on how to get started with the actual development.

Phabricator at Wikimedia
Wikimedia uses a Phabricator instance with minimal changes from upstream. The reason for this is the high development pace of the upstream developers – maintaining local patches is cumbersome. The exceptions to this are extensions, which live in a separate directory and thus do not need regular merges. Any other changes thus have to pass through upstream. This sounds like a major obstacle, but in practice, the upstream maintainers are very prompt in responding to suggestions.

Wikimedia Phabricator bug workflow
It is helpful to understand the life cycle of a bug before taking on one of the tasks. There are two projects: #phabricator for WMF-specific bugs and #phabricator.org for general Phabricator bugs. Software bugs and enhancement requests will typically fall in this second category.


 * 1) New bugs in #phabricator.org then move to a discussion stage to clarify the request.
 * 2) The request is then 'upstreamed' (copied to the phabricator.org bug tracker)
 * Only high-priority requests are marked with the #wikimedia tag.
 * 1) The upstream developers then respond with their assessment, and suggestions for how the feature should be implemented.
 * At this point one can start with the implementation.
 * 1) In some cases, the upstream developers will decide a feature does not fit into their plans. In this case, the bug is moved from #phabricator.org to #phabricator, and ends up back into the discussion stage: is this feature important enough to maintain local patches?
 * Once this has been decided, the patch will move to 'Ready to go', and one can start with the implementation.

Local changes
As mentioned in the previous section, we try to keep local patches to a minimum. There are limited resources available to maintain patches, and to merge them with changes from upstream. Any local patches therefore have to be discussed within the #phabricator project.

The current locally-maintained parts are:
 * The MediaWiki OAuth extension (in the process of being upstreamed).
 * Security extension (Wikimedia's specific development while upstream implements their solution for private projects).
 * Other Phabricator extensions needed by Wikimedia.

Site configuration
Most of the configuration is set through the web interface. Defaults (shared between phabricator.wikimedia.org and e.g. phab-01.wmflabs.org) are set using the puppet maniphest

Setting up
The easiest way to get set up is by using Vagrant. Following these steps should help you get started:


 * Get Git
 * Get NFS if it is not already installed. It is usually already installed in MacOS X. In Ubuntu, use.
 * Get the latest VirtualBox
 * [//www.vagrantup.com/downloads.html Get the latest Vagrant]
 * Run the following commands in a shell:


 * Wait until the VM is built. You can then visit your Phabricator instance at http://127.0.0.1:8080, and ssh to the VM on ssh://vagrant:vagrant@127.0.0.1:2222.


 * The Phabricator install is located in `/phabricator/instances/dev/phabricator` on the VM. To edit and submit a patch:

Congratulations, you have submitted your first patch!

Using a Labs VM
If you know how to spin up a VM on Labs, and have the rights to do so, you can create an instance with the `phabricator::labs` role. This should give you a basic setup with the same configuration as https://phab-01.wmflabs.org

 backlog; backlog -> nd [label="WMF specific"]; backlog -> ndorg [label="general"]; nd -> ndorg; ndorg -> nd; nd -> sDECINV nd -> rtg; rtg -> doing doing -> sSTAL ndorg -> sDECINV ndorg -> rtgorg rtgorg -> others rtgorg -> WMF [label="upstreamed"]

{rank=same nd ndorg} {rank=same rtg rtgorg} {rank=same doing others WMF} {rank=same sRES sSTAL sDECINV}

others -> nd WMF -> nd [label="declined\nupstream"] WMF -> sSTAL others -> sSTAL

sSTAL -> sRES;

newbug [label="New bug", shape=box] backlog [label="Backlog"] nd [label="#phabricator\nNeeds discussion"] ndorg [label="#phabricator.org\nNeeds discussion"] rtg [label="#phabricator\nReady to go"] rtgorg [label="#phabricator.org\nReady to go"] doing [label="#phabricator\nDoing"] others [label="#phabricator.org\nPersonal requests"] WMF [label="#phabricator.org\nWikimedia requests"] sDECINV [label="DECLINED\nINVALID", shape=diamond] sSTAL [label="STALLED\n(waiting for\ndeployment)", shape=diamond] sRES [label="RESOLVED\n(deployed)", shape=diamond]

}