r50382 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r50381‎ | r50382 | r50383 >
Date:20:19, 9 May 2009
Author:mark
Status:deferred
Tags:
Comment:
wikimedia-task-appserver (1.34) hardy; urgency=low

* Include local version of sync/sanity check scripts
* Remove old amane NFS mounts
* No longer depend on wikimedia-nis-client
Modified paths:
  • /trunk/debs/wikimedia-task-appserver/apache-sanity-check (added) (history)
  • /trunk/debs/wikimedia-task-appserver/apache-start (added) (history)
  • /trunk/debs/wikimedia-task-appserver/check-time (added) (history)
  • /trunk/debs/wikimedia-task-appserver/debian/changelog (modified) (history)
  • /trunk/debs/wikimedia-task-appserver/debian/control (modified) (history)
  • /trunk/debs/wikimedia-task-appserver/debian/postinst (modified) (history)
  • /trunk/debs/wikimedia-task-appserver/debian/postrm (modified) (history)
  • /trunk/debs/wikimedia-task-appserver/debian/preinst (modified) (history)
  • /trunk/debs/wikimedia-task-appserver/debian/rules (modified) (history)
  • /trunk/debs/wikimedia-task-appserver/sync-common (added) (history)

Diff [purge]

Index: trunk/debs/wikimedia-task-appserver/apache-sanity-check
@@ -0,0 +1,57 @@
 2+#!/bin/bash
 3+#
 4+# This is an aggregated version of /home/w/bin/apache-sanity-check,
 5+# which does not depend on mounted NFS /home.
 6+
 7+set -ex
 8+
 9+export PATH=/bin:/usr/bin:/sbin:/usr/sbin
 10+
 11+# FIXME: move this to PyBal runcommand check, and/or replace with Puppet logic.
 12+VIP="10\\.2\\.1\\.\(1\|21\)"
 13+if ! /sbin/ip addr | grep -q "$VIP.*lo"; then
 14+ echo "System failed sanity check: VIP not configured on lo"
 15+ exit 1
 16+fi
 17+
 18+check-time
 19+
 20+# Check for presence of shell commands used by MW
 21+# We use fixed paths instead of a $PATH search, because that's how they're specified in CommonSettings.php
 22+shell_cmds="/usr/bin/djvudump /usr/bin/tidy"
 23+for cmd in $shell_cmds; do
 24+ if [ ! -x $cmd ]; then
 25+ echo "$cmd missing"
 26+ exit 1
 27+ fi
 28+done
 29+
 30+# Test for LaTeX packages
 31+tmpdir=/tmp/sanity-check-latex.`date +%s`
 32+mkdir $tmpdir
 33+if ! cd $tmpdir; then
 34+ rm -rf $tmpdir
 35+ echo "Unable to change to directory /tmp/sanity-check-latex"
 36+ exit 1
 37+fi
 38+echo '
 39+\nonstopmode
 40+\documentclass[12pt]{article}
 41+\usepackage{amsmath}
 42+\usepackage{amsfonts}
 43+\usepackage{amssymb}
 44+\usepackage[dvips,usenames]{color}
 45+\pagestyle{empty}
 46+\begin{document}
 47+\end{document}
 48+' > test.tex
 49+latex test.tex > /dev/null
 50+exit_status=$?
 51+if [ $exit_status -ne 0 ]; then
 52+ echo "LaTeX returned exit status $exit_status, may be missing packages"
 53+ echo "See logs in $tmpdir"
 54+ exit 1
 55+fi
 56+rm -rf $tmpdir
 57+
 58+exit 0
Index: trunk/debs/wikimedia-task-appserver/debian/control
@@ -7,7 +7,7 @@
88
99 Package: wikimedia-task-appserver
1010 Architecture: all
11 -Depends: wikimedia-nis-client, wikimedia-lvs-realserver, apache2-mpm-prefork, librsvg2-bin, dvipng, tetex-bin, tetex-extra, gsfonts, ocaml, ploticus, php5-mysql, php5-curl, php5-xmlrpc, php5-cli, php5-apc, php5-wikidiff2, php5-fss, libapache2-mod-php5, file, djvulibre-bin, tidy (>= 20070821), libtidy-0.99-0 (>= 20070821), php-pear
 11+Depends: wikimedia-lvs-realserver, apache2-mpm-prefork, librsvg2-bin, dvipng, tetex-bin, tetex-extra, gsfonts, ocaml, ploticus, php5-mysql, php5-curl, php5-xmlrpc, php5-cli, php5-apc, php5-wikidiff2, php5-fss, libapache2-mod-php5, file, djvulibre-bin, tidy (>= 20070821), libtidy-0.99-0 (>= 20070821), php-pear, rsync
1212 Description: Wikimedia application server
1313 This package depends on all packages needed to setup a standard
1414 application server.
Index: trunk/debs/wikimedia-task-appserver/debian/postinst
@@ -35,6 +35,19 @@
3636 }
3737 }
3838
 39+create_apache_user() {
 40+ # Create apache user/group with correct uid/gid
 41+ if ! getent group apache > /dev/null
 42+ then
 43+ addgroup --system --gid 48 apache
 44+ fi
 45+
 46+ if ! getent passwd apache > /dev/null
 47+ then
 48+ adduser --system --home /var/www --shell /sbin/nologin --no-create-home --uid 48 --gid 48 --disabled-password apache
 49+ fi
 50+}
 51+
3952 case "$1" in
4053 configure)
4154 # Add a line to /etc/motd describing the task of this server
@@ -57,18 +70,17 @@
5871 fi
5972 fi
6073
 74+ create_apache_user
 75+
6176 chown -R pybal-check:pybal-check /var/lib/pybal-check/.ssh
6277
63 - checkmount amane:/export/upload /mnt/upload3
64 - checkmount amane:/export/math /mnt/math
6578 checkmount ms1.wikimedia.org:/export/upload /mnt/upload5
6679
6780 CLUSTER=$(cat /etc/wikimedia-cluster)
6881 if [ $CLUSTER="pmtpa" ]
6982 then
70 - rsync -a /home/wikipedia/conf/httpd/ /usr/local/apache/conf
 83+ rsync -a 10.0.5.8::httpdconf/ /usr/local/apache/conf
7184
72 - PATH=$PATH:/home/wikipedia/bin
7385 sync-common
7486 apache-start
7587 else
Index: trunk/debs/wikimedia-task-appserver/debian/postrm
@@ -29,15 +29,19 @@
3030
3131 case "$1" in
3232 purge)
 33+ # Remove apache user
 34+ deluser apache || true
 35+ delgroup apache || true
 36+
3337 # Remove PyBal check user account
3438 deluser pybal-check
35 - rm -rf /var/lib/pybal-check
 39+ rm -rf /var/lib/pybal-check
3640
37 - dpkg-divert --package wikimedia-task-appserver --rename --remove /etc/apache2/apache2.conf
38 - dpkg-divert --package wikimedia-task-appserver --rename --remove /etc/php5/apache2/php.ini
39 - dpkg-divert --package wikimedia-task-appserver --rename --remove /usr/share/php5/php.ini-dist
40 - dpkg-divert --package wikimedia-task-appserver --rename --remove /etc/sudoers
41 - dpkg-divert --package wikimedia-task-appserver --rename --remove /etc/apache2/envvars
 41+ dpkg-divert --package wikimedia-task-appserver --rename --remove /etc/apache2/apache2.conf
 42+ dpkg-divert --package wikimedia-task-appserver --rename --remove /etc/php5/apache2/php.ini
 43+ dpkg-divert --package wikimedia-task-appserver --rename --remove /usr/share/php5/php.ini-dist
 44+ dpkg-divert --package wikimedia-task-appserver --rename --remove /etc/sudoers
 45+ dpkg-divert --package wikimedia-task-appserver --rename --remove /etc/apache2/envvars
4246 ;;
4347 remove)
4448 removemount /mnt/upload3
Index: trunk/debs/wikimedia-task-appserver/debian/preinst
@@ -14,7 +14,6 @@
1515 # for details, see http://www.debian.org/doc/debian-policy/ or
1616 # the debian-policy package
1717
18 -
1918 case "$1" in
2019 install)
2120 dpkg-divert --package wikimedia-task-appserver --add --rename \
@@ -27,6 +26,7 @@
2827 --divert /etc/sudoers.default /etc/sudoers
2928 dpkg-divert --package wikimedia-task-appserver --add --rename \
3029 --divert /etc/apache2/envvars.default /etc/apache2/envvars
 30+
3131
3232 # Create user for the PyBal checks
3333 adduser --system --home /var/lib/pybal-check --group --disabled-password --shell /bin/sh pybal-check
Index: trunk/debs/wikimedia-task-appserver/debian/changelog
@@ -1,3 +1,11 @@
 2+wikimedia-task-appserver (1.34) hardy; urgency=low
 3+
 4+ * Include local version of sync/sanity check scripts
 5+ * Remove old amane NFS mounts
 6+ * No longer depend on wikimedia-nis-client
 7+
 8+ -- Mark Bergsma <mark@wikimedia.org> Sat, 25 Apr 2009 15:43:11 +0000
 9+
210 wikimedia-task-appserver (1.33) hardy; urgency=low
311
412 * Added /mnt/upload5 to the remove list, removed /mnt/upload4 from the
Index: trunk/debs/wikimedia-task-appserver/debian/rules
@@ -54,6 +54,10 @@
5555 install -m 0644 php.ini $(DESTDIR)/usr/share/php5/php.ini-dist
5656 install -m 0400 sudoers $(DESTDIR)/etc/
5757
 58+ # Install sync/check scripts
 59+ install -d -m 0755 $(DESTDIR)/usr/bin
 60+ install -m 0750 sync-common apache-sanity-check apache-start check-time $(DESTDIR)/usr/bin
 61+
5862 install -d -m 0750 $(DESTDIR)/var/lib/pybal-check/.ssh
5963 install -m 0640 authorized_keys $(DESTDIR)/var/lib/pybal-check/.ssh/authorized_keys
6064
Index: trunk/debs/wikimedia-task-appserver/sync-common
@@ -0,0 +1,25 @@
 2+#!/bin/sh
 3+#
 4+# This is an aggregated version of the scripts called by /home/w/bin/sync-common,
 5+# not depending on NFS /home.
 6+
 7+set -e
 8+umask 002
 9+
 10+export PATH=/bin:/usr/bin:/sbin:/usr/sbin
 11+
 12+# Set ownership
 13+find /apache/common/php-1.5 -group wikidev -not -perm -020 -perm -200 -exec chmod g+w '{}' ';'
 14+
 15+# Compile texvc
 16+echo -n Compiling texvc...
 17+[ -d /var/tmp/texvc ] || mkdir /var/tmp/texvc
 18+rsync -r --exclude=.svn/ 10.0.5.8::common/php-1.5/math/ /var/tmp/texvc
 19+cd /var/tmp/texvc
 20+make -f Makefile texvc >/dev/null 2>/dev/null && echo ok || echo failed
 21+cp /var/tmp/texvc/texvc /usr/local/bin/
 22+
 23+# rsync common
 24+echo -n Copying to `hostname -s`...
 25+rsync -a --delete 10.0.5.8::common/ /usr/local/apache/common-local
 26+echo Done.
Index: trunk/debs/wikimedia-task-appserver/check-time
@@ -0,0 +1,18 @@
 2+#!/usr/bin/perl -w
 3+
 4+$threshold = 0.5;
 5+$server = 'ntp.pmtpa.wmnet';
 6+
 7+$time = `/usr/sbin/ntpdate -q $server`;
 8+if ( $time =~ /offset ([0-9.-]*) sec/ ) {
 9+ $offset = $1;
 10+ if ( abs( $offset ) > $threshold ) {
 11+ print "Warning: clock offset is $offset seconds\n";
 12+ exit 1;
 13+ } else {
 14+ exit 0;
 15+ }
 16+} else {
 17+ print "Error: unable to contact NTP server\n";
 18+ exit 2;
 19+}
Index: trunk/debs/wikimedia-task-appserver/apache-start
@@ -0,0 +1,6 @@
 2+#!/bin/sh
 3+
 4+set -e
 5+
 6+cd /
 7+apache-sanity-check && sudo /usr/sbin/apache2ctl start

Status & tagging log