You are browsing a read-only backup copy of Wikitech. The live site can be found at


From Wikitech-static
Revision as of 23:22, 8 February 2017 by imported>Halfak (→‎Beta (
Jump to navigation Jump to search

This page is a guide on how to deploy new version of ORES into the server.


So, your patches are merged into ores/revscoring/other dependencies. You need to increment the version number. Try to do that in a SemVer fashion. Like only upgrading the patch level (e.g. 0.5.8 -> 0.5.9). You need to do it in and (and probably some other place too, use grep to check where the current version is used)

Then you need to push new version into PyPI using:

python sdist bdist_wheel upload

If you got GPG/PGP you can try adding sign to the list above to also sign the wheel and the sdist

Update models

If you are doing breaking changes to revscoring probably old model files won't work, so you need to rebuild models. Do it using Makefile in editquality & wikiclass repos. If a model changes substantially (new features, new algorithm, etc), make sure to increment the model versions in the Makefile too.

Update wheels

First, clone

git clone

There is a file in ores-wikimedia-config called "requirements.txt". Update their version number and make wheels by making a virtualenv and installing everything in it:

virtualenv -p python3 tmp
source tmp/bin/activate
pip install wheel
pip wheel -w wheels/ -r requirements.txt

It's better to do this in an environment similar to the production cluster. ores-compute-01.ores.eqiad.wmflabs and ores-compute-02.ores.eqiad.wmflabs are designed to do that. Don't forget to install C dependencies beforehand. Be careful if any kind of error happened.

Once wheels are ready, there is a repo in gerrit called wheels (in research/ores/wheels) we keep wheels and nltk data in it. You need to git clone, update wheels and make a patch:

git clone ssh://

Then, you need to copy new versions to wheels folder, delete old ones and make a new patch:

cd wheels
git commit -m "New wheels for wiki-ai 1.2" -a
git review -R

Update ores-wikimedia-config

After +2ing and being merged, you should update ores-wikimedia-config

cd ores-wikimedia-config
git checkout -b wiki_ai_1.2
source tmp/bin/activate
pip freeze | grep -v setuptools > requirements-frozen.txt
cd submodules/wheels
git pull
cd ../..
git commit -m "Release wiki-ai 1.2"
git push -f origin wiki_ai_1.2

After that you need to make a PR in github and once it's merged it's good to go!

If you want to deploy to prod as well ( you need to backport your commits in gerrit too (ewww). The gerrit repos are:

git clone ssh://

For ores.



You need to login in deploy server to deploy new version using fabric or scap3

Labs (

First, you need to go to staging. Simply make your changes in ores-wikimedia-config and do "fab stage" (don't forget to log it in #wikimedia-labs by typing this: "!log ores-staging deploying #hash into staging".

Then check to see if everything is working alright and if it does, you are good to go to the labs setup. First you need to rebase "deploy" branch.

git checkout deploy
git rebase origin/master
git push -f origin deploy

Then deploy with "fab deploy_web" and then "fab deploy_celery". Once it's done, test to see if everything is working as expected.

Beta (

  1. ssh deployment-tin.eqiad.wmflabs and cd /srv/deployment/ores/deploy
  2. git pull and git submodule update --init
  3. Record the NEWHASH at the top of git log | head
  4. Deploy with scap deploy -v and check out if anything works as expected.
  5. Log it in #wikimedia-releng connect with a line like "!log deploying ores <NEWHASH>"

Production cluster (

You are doing a dangerous thing. Remember, breaking the site is extremely easy! Be careful in every step and try to have someone from the team and ops supervising you. Also remember, ORES is depending on a huge number of puppet configurations, check out if your change is compatible with puppet configs and change puppet configs if necessary.

Prep work

We'll double check the hash that is deployed in case we need to revert and then update the code to current master.

  1. ssh deployment.eqiad.wmnet. Then cd /srv/deployment/ores/deploy.
  2. Record the latest revision (OLDHASH) with git log (in case you needed to rollback)
  3. Update the deploy repository with git pull and git submodule update --init
  4. Record the new revision (NEWHASH) and prepare a message to send to #wikimedia-operations connect: "!log deploying ores <NEWHASH>"
Deploy to canary

Then you need to deploy it into a node to check if it works as expected. It's called canary node. Right now, it's scb1002.eqiad.wmnet.

  1. Run the deploy by commanding "scap deploy -v". Do not hit "y" yet!
  2. Log into scb1002.eqiad.wmnet and check the service internally by commanding curl$(date +%s)
    • It would be great if you test other aspects if you are changing them (e.g. test if it returns data if you are adding a new model).
Continue deployment to prod

If anything works as expected, we're ready to continue.

  1. Deploy it fully by answering "y" on the successful question in scap.
  2. Send the log message in #wikimedia-operations.
  3. ...
    • If something went wrong, rollback with scap deploy -v -r <OLDHASH>
    • If everything looks OK, say "Victory! ORES deploy looks good" (or something like that) in #wikimedia-operations