User:ATomasevich (WMF)/Docker basics

Links

 * Setting up your Docker environment
 * Installing git-review
 * Configuring git-review

Docker commands

 * : Start containers so you can run your local site. You will need to do this after stopping containers or after restarting your machine


 * : Stop containers

Pull an in-progress branch from Gerrit
We'll use https://gerrit.wikimedia.org/r/c/mediawiki/extensions/MachineVision/+/575350 as a sample.


 * 1) First, run  to get into the git repository of the correct extension (check the URL of the Gerrit patch for the extension name)
 * 2) Copy the number in the URL, e.g. 575350 for our sample patch, and run, e.g  . This will create a new branch on your local site with the in-progress code. You can do a hard refresh on your local site to see the updates.
 * 3) When you're done, you can go back to the master branch with

Updating an in-progress branch that you've previously pulled from Gerrit

 * 1) The easiest way to do this is to delete the existing branch that you have and pull it anew
 * 2) Run  to see a list of existing local branches so you can figure out the name of the existing branch you want to update. It'll be something like  . If you can't remember which branch goes with which Gerrit patch, you can find the branch name on the Gerrit patch page in the left sidebar under "topic"
 * 3) Once you figure out which branch it is, run  to delete it, e.g.
 * 4) Pull the patch again by copying the ID in the URL and running, e.g.

Troubleshooting
If you pull a branch then see an error on the page when you refresh, there are a few things that could be going on:


 * 1) An extension needs to be updated
 * 2) Mediawiki core needs to be updated
 * 3) The branch itself needs to be updated

If you see an extension name in the error, you can try updating that extension by following these instructions:


 * From the root of the Mediawiki repository, run  to get into the git repository of the extension you want to update
 * Make sure you're on the master branch. You can run  to see which branch you're on and   to go back to the master branch.
 * Run  to pull updates from Gerrit
 * Special tip for Wikibase: you need to pull changes from git submodules as well. To do so, from the Wikibase extension, run
 * If you run into issues after updating extension code, try running database updates via

Otherwise, you can try updating Mediawiki core:


 * 1) Start from the root of the Mediawiki repository
 * 2) Run   to pull updates from Gerrit
 * 3) Run   to run any database updates associated with the new code you just pulled
 * 4) You may see a message that you need to run   before the update script can run. If so, run , then run the update.php command again

If none of that works, it's possible that there's an error on the branch itself, or that the branch needs to be synced with the latest version of the master branch. Ping the author of the Gerrit patch and let them know that things aren't working.