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

shortcut: mwgrep

Wikimedia binaries: Difference between revisions

From Wikitech-static
Jump to navigation Jump to search
imported>BryanDavis
(→‎fatalmonitor: point to the correct logs)
imported>Krinkle
Line 3: Line 3:


== bin ==
== bin ==
=== <code>apache-graceful</code> ===
'''Note:''' this script is NOT in puppet.
: ''Performs the action '''only on the one server''' from which the command is ran''


=== <code>apache-graceful-all</code> ===
=== '''<code>apache-fast-test</code>''' ===
'''Note:''' this script is in /usr/local/bin/ on tin and [https://phabricator.wikimedia.org/diffusion/OPUP/browse/master/modules/apachesync/files/apache-fast-test;1e00afe71abf282ee70683a97b349f570dfedd8a in puppet].
This script comes from [[phab:diffusion/OPUP/browse/master/modules/apache/files/apache-fast-test;63423575ad02f7bc38e1b68c1235d4cc31b9f4bd|puppet]].
: ''This script operates on all servers in the following dsh groups: '''apaches'''
* Runs <code>apache-graceful</code> locally on all apaches.


=== <code>fatalmonitor</code> ===
=== <code>fatalmonitor</code> ===
* Runs a [[wikipedia:watch (Unix)|<code>watch</code>]] command on the [[Logs#fluorine:/a/mw-log/|hhvm logs]] with various exclusion and aggregation filters to monitor current php notices, warnings and errors on the cluster. This script lives on [[fluorine]].
* Runs a [[wikipedia:watch (Unix)|<code>watch</code>]] command on the [[Logs#fluorine:/a/mw-log/|hhvm logs]] with various exclusion and aggregation filters to monitor current php notices, warnings and errors on the cluster. This script lives on [[fluorine]].
=== <code>sync-apache</code> ===
: ''This script operates on all servers in the following dsh groups: '''apaches, image_scalers, snapshot, searchidx'''
: '''Note:''' The conf files are outside of <code>/a/''common''</code>, and as such are '''not''' synced by the <code>sync-common</code>-like scripts.
* syncs <code>/home/wikipedia/conf/httpd</code> to <code>/apache/conf</code>


=== {{anchor|sync-common}}<code>scap pull</code> ===
=== {{anchor|sync-common}}<code>scap pull</code> ===
Line 100: Line 90:
** ''etc.''
** ''etc.''


== Examples ==
== Purge ==
=== <code>sync-apache</code> example ===
Sometimes you may need to [[Purge URL|purge a URL]] from Varnish cache.
# On [[tin]]:
# (optionally) run:<br/><code>sync-apache-simulated</code><br/>This just has an "-n" added to the [[rsync]] commands. (<code>--dry-run | </code> show what would have been transferred)
# If that looks fine, actually sync:<br/><code>sync-apache</code>
# Connect to a single random "srv" server, confirm the expected change has arrived here, and restart [[Apache]] to check your change did not break things.
## (how to restart that apache?)
# If that also looks fine, restart all Apaches:<br/><code>apache-graceful-all</code>
 
After this you might want to [[Purge URL|purge a URL]] from [[Squid]] cache. Also see [[Squids#Purge a given external (non WMF) url]].


In most cases this is enough. However if the change involves more than a simple change to redirects, [[depooling]]/ repooling may be necessary. Make sure you find out whether this is needed ahead of time{{#ifexist: depooling ||&nbsp;(while at it, start the [[depooling]] page and link to it, we need documentation!)}}.
In most cases this is enough. However if the change involves more than a simple change to redirects, [[depooling]]/ repooling may be necessary. Make sure you find out whether this is needed ahead of time{{#ifexist: depooling ||&nbsp;(while at it, start the [[depooling]] page and link to it, we need documentation!)}}.

Revision as of 22:22, 2 December 2016

The following executable binaries are maintained in version control (operations/puppet:/files/misc/scripts) and copied/synced to servers (such as tin) by puppet into /usr/local/bin.

bin

apache-fast-test

This script comes from puppet.

fatalmonitor

  • Runs a watch command on the hhvm logs with various exclusion and aggregation filters to monitor current php notices, warnings and errors on the cluster. This script lives on fluorine.

scap pull

Note: this script is from mediawiki/tools/scap.

Performs the action only on the one server from which the command is ran
  • syncs /srv/mediawiki-staging from a deployment rsync server-> /srv/mediawiki on the local server
  • This action was formerly run as sync-common

scap sync-dir

Note: this script is from mediawiki/tools/scap.

This is an all-script!
  • for a single directory
  • checks PHP syntax
  • syncs /srv/mediawiki-staging/(some dir) -> /srv/mediawiki

scap sync-file

Note: this script is from mediawiki/tools/scap.

This is an all-script!
  • for a single file
  • checks PHP syntax
  • syncs /srv/mediawiki-staging/(some file) -> /srv/mediawiki

scap sync-wikiversions

Note: this script is from mediawiki/tools/scap.

This is an all-script!
  • syncs /srv/mediawiki-staging/wikiversions.{json,cdb} -> /srv/mediawiki

scap sync

'scap' logo
A diagram of wikimedia 'scap' deployment tool

Note: this script is from mediawiki/tools/scap. Generated documentation is published on doc.wikimedia.org

This is an all-script!
"sync-common-all-php"
  • lints PHP files in ./wmf-config, ./multiversion
  • Sync deploy directory (/srv/mediawiki-staging) on localhost with staging area (/srv/mediawiki)
  • for all mediawiki versions currently deployed (usually 2) it:
    • rebuilds localization caches of core and extensions
    • creates json files from localization caches for better rsync performance
  • runs scap pull on co-master servers to update /srv/mediawiki-staging
  • runs scap pull on rsync fanout servers to update /srv/mediawiki
  • runs scap pull on "all" servers to update /srv/mediawiki from nearest rsync slave
  • rebuilds localization caches on "all" servers from json files that were synced by scap pull
  • compiles wikiversions.json to wikiversions.cdb on localhost
  • runs scap sync-wikiversions
bd808@silver:~$ scap say
 ------------------------------------------------
/                                                \
|     S.C.A.P.: someone can always pontificate    |
\                                                /
 ------------------------------------------------
    \
     \
      \
           ___ ____
         ⎛   ⎛ ,----
          \  //==--'
     _//|,.·//==--'    ____________________________
    _OO≣=-  ︶ ᴹw ⎞_§ ______  ___\ ___\ ,\__ \/ __ \
   (∞)_, )  (     |  ______/__  \/ /__ / /_/ / /_/ /
     ¨--¨|| |- (  / ______\____/ \___/ \__^_/  .__/
         ««_/  «_/ jgs/bd808                /_/

mwgrep

Search for CSS and JavaScript code fragments in MediaWiki, User and Module namespaces pages on all Wikimedia projects (powered by Elasticsearch).

It's located in operations/puppet/modules/scap/files/mwgrep

All-script

An all-script is a script that operates on mediawiki-installation boxes via ssh. These scripts performs the action on all servers.

The specific servers include:

Purge

Sometimes you may need to purge a URL from Varnish cache.

In most cases this is enough. However if the change involves more than a simple change to redirects, depooling/ repooling may be necessary. Make sure you find out whether this is needed ahead of time.

See also