HomePhabricator
Spin up a basic local Phabricator instance with Docker
From scratch, in about ten minutes (with API query example)

If you want to experiment with Phabricator and/or the Phabricator APIs, it can be convenient to have a local instance to play with.

A relatively simple way to do this is with the following docker-compose.yml, which uses a Bitnami Phabricator Docker image:

1version: '3.0'
2services:
3 mariadb:
4 image: 'bitnami/mariadb:latest'
5 environment:
6 - ALLOW_EMPTY_PASSWORD=yes
7 volumes:
8 - 'mariadb_data:/bitnami'
9 phabricator:
10 image: 'bitnami/phabricator:latest'
11 ports:
12 - '80:8080'
13 - '443:8443'
14 volumes:
15 - 'phabricator_data:/bitnami'
16 depends_on:
17 - mariadb
18 environment:
19 - PHABRICATOR_HOST=phabricator.local.com
20 - ALLOW_EMPTY_PASSWORD=yes
21 hostname: phabricator.local.com
22volumes:
23 mariadb_data:
24 driver: local
25 phabricator_data:
26 driver: local

( This isn't configured exactly the same as Wikimedia's Phabricator, but it may be close enough for experimentation purposes. A main objective for this example was to keep configuration to a minimum and the total time to roughly 10 minutes. )

Installation

  1. Ensure you have Docker and Docker Compose installed
  2. Create a directory called something like phabricator and place a docker-compose.yml in it with the text above ( for some reason 🤷‍♂️ copying the text above is easier if you click through to the paste file P13071 )
  3. In the phabricator directory run the docker-compose up command
  4. Wait a couple minutes for the Docker images specified in the docker-compose.yml file to be fetched and spun up

Loading

  1. Apparently Phabricator really wants its URL to have a subdomain, so for this to work locally you can edit your /etc/hosts file (i.e. sudo atom /etc/hosts) adding this line: 127.0.0.1 phabricator.local.com
  2. Now you should be able to load https://phabricator.local.com in a browser to see the login page of your local Phabricator instance
  3. You'll also have to instruct your browser that it's ok we don't have a valid certificate for the local instance:

( tap image below for animation showing how this is done with Firefox )

docker phab https.mov.gif (812×920 px, 531 KB)

Logging in

This Bitnami Phabricator image come with the following default account:
Username: user
Password: bitnami1

Making a Project, Workboard and Task

( tap image below for animation )

test project workboard and task.mov.gif (1×1 px, 2 MB)

Generating an API Token

If you want to play with Phabricator APIs from the command line, you'll need a token:

( tap image below for animation )

phab 3.mov.gif (1×1 px, 2 MB)

Typically you'd want to keep such a token private, but since this one is specific to your local Phabricator instance it's not going to be of much use to anyone else.

Querying the API from a terminal window

In the Make first Project / Workboard / Task step above, the first task T1 was created. A fairly basic Phabricator API endpoint, phid.lookup, can be used to retrieve some basic information about this task, such as its phid, status, full name, etc.

It can be called from a new terminal window on the host system using:

  • the url specified above ( http://phabricator.local.com )
  • the endpoint ( /api/phid.lookup )
  • the token created above ( api-yjnnbnmayjqf5z733qix2ebrri5k - yours will be different )
  • the id of the ticket created above ( T1 )

For example, from a new terminal window:

curl http://phabricator.local.com/api/phid.lookup -d "api.token=YOUR_API_TOKEN_HERE" -d "names[0]=T1" | python -m json.tool

Note: | python -m json.tool simply formats the json returned by the endpoint

( tap image below for animation )

phab api.mov.gif (1×1 px, 582 KB)

Querying the API from endpoint documentation pages

If you use your local instance's URL ( https://phabricator.local.com ) to load the API docs ( https://phabricator.local.com/conduit/ ), as long as you've logged in ( with the user / bitnami1 credentials mentioned above, for example ) you can experiment with calling API endpoints without having to mess with tokens. At the bottom of every API's documentation page there is a form which can be used to enter parameters and call the endpoint:

( tap image below for animation )

phab query 3.mov.gif (1×1 px, 3 MB)

Enjoy!

Hopefully this is useful if you ever want to mess around with Phabricator in a worry-free manner :)

Written by Mhurd on Nov 19 2020, 12:35 AM.
User
Projects
None
Subscribers
mmodell, zeljkofilipin
Tokens
"Love" token, awarded by mmodell."Yellow Medal" token, awarded by zeljkofilipin.

Event Timeline

It was really easy to get Phabricator running on my machine. Gifs with animations are great!

The more involved version is documented on mediawiki.org. That should get you something a lot closer to our production setup (and doesn't use docker, unfortunately). I'd like to eventually build a phabricator image for docker that is based on our production deployment but there hasn't been a lot of demand so it hasn't become a priority to work on that.