You are browsing a read-only backup copy of Wikitech. The primary site can be found at wikitech.wikimedia.org
Application servers: Difference between revisions
imported>Dzahn |
imported>Krinkle mNo edit summary |
||
Line 1: | Line 1: | ||
{{Navigation Wikimedia infrastructure|expand=mw}} | |||
{{See|See also '''[[Application servers/Runbook]]''' for how to perform common tasks, or diagnose issues.}} | |||
The '''Application servers''' (or '''app servers''') are the several hundred Apache servers that run the [[MediaWiki]] backend software (written in PHP). | The '''Application servers''' (or '''app servers''') are the several hundred Apache servers that run the [[MediaWiki]] backend software (written in PHP). | ||
{{TOC|align=right}} | {{TOC|align=right}} | ||
* | ==Service== | ||
* | Puppet roles: | ||
* <code>mediawiki::appserver</code>, <code>mediawiki::canary_appserver</code> | |||
* <code>mediawiki::appserver::api</code>, <code>mediawiki::appserver::canary_api</code> | |||
</ | * <code>mediawiki::maintenance</code> | ||
* | * <code>mediawiki::jobrunner</code> | ||
* | Relevant puppet classes: | ||
** | * <code>[https://gerrit.wikimedia.org/g/operations/puppet/+/HEAD/modules/profile/manifests/mediawiki/webserver.pp profile::mediawiki::webserver]</code>, this provisions Apache, and any other packages or resources needed by MediaWiki on app servers. | ||
** <code>[https://gerrit.wikimedia.org/g/operations/puppet/+/HEAD/modules/profile/manifests/mediawiki/httpd.pp profile::mediawiki::httpd]</code>, the Apache service. | |||
** | ** <code>[https://gerrit.wikimedia.org/r/plugins/gitiles/operations/puppet/+/HEAD/modules/mediawiki/manifests/web/prod_sites.pp meidawiki::web::prod_sites]</code>, the Apache configuration for all production websites (including wikipedia.org). | ||
** Additional Apache configurations are at [https://github.com/wikimedia/operations-puppet/tree/production/modules/mediawiki/files/apache/sites modules/mediawiki/files/apache/sites/]. Prior to 2012, Apache configuration were in a Subversion repository. | |||
** | |||
==Architecture== | |||
{{See|See [[MediaWiki at WMF#Infrastructure|MediaWiki at WMF § Infrastructure]] for the CDN and traffic layers outside app servers. <br> See also [[MediaWiki at WMF#MediaWiki_configuration|MediaWiki configuration]].}} | |||
[ | |||
The application servers are load-balanced via [[LVS]]. Connections between our CDN (HTTP cache proxies) and app servers are encrypted with TLS, which is terminated locally on the app server using a simple '''Nginx-''' install. Nginx then hands the request off to the local Apache. | |||
'''Apache''' there is in charge of handling redirects, rewrite rules, and determining the [[MediaWiki at WMF#Document root|document root]]. It then uses <code>php-fpm</code> to invoke the MediaWiki software. | |||
https:// | The Apache [https://httpd.apache.org/docs/2.4/mpm.html MPM] we use is [https://httpd.apache.org/docs/2.4/mod/worker.html mod_worker]</code>, which decides how <code>php-fpm</code> processes are spawned. | ||
</ | |||
==Logging== | ==Logging== | ||
Line 138: | Line 106: | ||
Host: en.wiktionary.org | Host: en.wiktionary.org | ||
User-agent: testthing | User-agent: testthing | ||
</pre> | </pre> | ||
== See also == | == See also == | ||
* [[Application servers/Runbook#DC Ops]] | |||
* [[Apache log format]] | * [[Apache log format]] | ||
* [[UID]] | * [[UID]] | ||
[[Category:Servers by usage| Apache]] | [[Category:Servers by usage| Apache]] | ||
[[Category:MediaWiki production| ]] |
Revision as of 20:30, 17 March 2020
The Application servers (or app servers) are the several hundred Apache servers that run the MediaWiki backend software (written in PHP).
Service
Puppet roles:
mediawiki::appserver
,mediawiki::canary_appserver
mediawiki::appserver::api
,mediawiki::appserver::canary_api
mediawiki::maintenance
mediawiki::jobrunner
Relevant puppet classes:
profile::mediawiki::webserver
, this provisions Apache, and any other packages or resources needed by MediaWiki on app servers.profile::mediawiki::httpd
, the Apache service.meidawiki::web::prod_sites
, the Apache configuration for all production websites (including wikipedia.org).- Additional Apache configurations are at modules/mediawiki/files/apache/sites/. Prior to 2012, Apache configuration were in a Subversion repository.
Architecture
See also MediaWiki configuration.
The application servers are load-balanced via LVS. Connections between our CDN (HTTP cache proxies) and app servers are encrypted with TLS, which is terminated locally on the app server using a simple Nginx- install. Nginx then hands the request off to the local Apache.
Apache there is in charge of handling redirects, rewrite rules, and determining the document root. It then uses php-fpm
to invoke the MediaWiki software.
The Apache MPM we use is mod_worker, which decides how php-fpm
processes are spawned.
Logging
Apache errors are logged to /srv/mw-log/apache2.log on mwlog1001.
Apache access logs are mostly disabled. Statistics are drawn from Varnish front ends instead.
Apache setup checklist
- Follow the Automated installation instructions for the base install
- Run the following on the server:
- apt-get update && apt-get dist-upgrade -y && apt-get install wikimedia-task-appserver && reboot && exit
- Wait for the server to come back online, ensure it starts apache correctly
- echo 'GET /' | nc localhost 80 or any of the number of tests listed below
- If the server is part of the memcached group, follow instructions on Memcached
- If the server is new, you will need to do the following:
- Login to the LVS server for apaches (lvs3 as of 2009-02-13) and add the new servers to /etc/pybal/apaches
- If the server is not new do the following:
- Ensure the server is now enabled in pybal on the LVS server in the file /etc/pybal/apaches
- You will need to add the server to DSH groups if new, or check if they are commented, if the server is not new:
- Add/Uncomment the host to /usr/local/dsh/node_groups/apaches and mediawiki-installation, as well as any other groups needed
- Reload nagios to accept the changes to the node groups:
- cd /home/wikipedia/conf/nagios && ./sync
- Verify that the server is tacking traffic and doing work
- ipvsadm -L | grep SERVERNAME
- traffic logs?
Test cases
Here are some test cases you can use to test the apache configuration after changing something.
GET /wiki/Foo HTTP/1.1 Host: en.wikipedia.org User-agent: testthing GET /wiki/Foo HTTP/1.1 Host: www.wikipedia.org User-agent: testthing GET /wiki/Main_Page HTTP/1.1 Host: www.wikipedia.com User-agent: testthing GET / HTTP/1.1 Host: wikipedia.com User-agent: testthing GET / HTTP/1.1 Host: wikibooks.org User-agent: testthing GET / HTTP/1.1 Host: wikiquote.org User-agent: testthing GET / HTTP/1.1 Host: dk.wikipedia.org User-agent: testthing GET / HTTP/1.1 Host: foo.wikipedia.org User-agent: testthing GET /wiki/Main_Page HTTP/1.1 Host: test.wikipedia.org User-agent: testthing GET /wiki/Foo HTTP/1.1 Host: en.wikipedia.org User-Agent: Exalead GET /wiki/Foo HTTP/1.1 Host: meta.wikimedia.org User-agent: testthing GET / HTTP/1.1 Host: en.wiktionary.org User-agent: testthing