From 9d901c20920dde6c2cfaa9c55a62a591df33c91f Mon Sep 17 00:00:00 2001 From: Martijn Vermaat <martijn@vermaat.name> Date: Mon, 26 Sep 2011 13:34:21 +0000 Subject: [PATCH] Implement mod_wsgi daemon mode and zero-downtime upgrades git-svn-id: https://humgenprojects.lumc.nl/svn/mutalyzer/branches/refactor-mutalyzer-branch@367 eb6bd6ab-9ccd-42b9-aceb-e2899b4a52f1 --- README | 1 + extras/apache/mutalyzer.conf | 4 ++++ extras/post-upgrade.sh | 10 ++++++++-- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/README b/README index dc504fa3..1390caec 100644 --- a/README +++ b/README @@ -76,6 +76,7 @@ Todo list: cannot be multiple workers without synchronisation problems. Good read: http://news.ycombinator.com/item?id=3002861 Suggestion: http://celeryproject.org/ +- Have a normal 404 page. Code style guide: - Follow PEP 8 (code) and PEP 257 (docstrings). diff --git a/extras/apache/mutalyzer.conf b/extras/apache/mutalyzer.conf index 566b1ad5..67b8fd17 100644 --- a/extras/apache/mutalyzer.conf +++ b/extras/apache/mutalyzer.conf @@ -7,6 +7,10 @@ Alias /mutalyzer/base /var/www/mutalyzer/base AllowOverride None </Directory> +# Use daemon mode of mod_wsgi +WSGIDaemonProcess mutalyzer processes=2 threads=15 maximum-requests=10000 +WSGIProcessGroup mutalyzer + # Webservice WSGIScriptAlias /mutalyzer/services <MUTALYZER_BIN_WEBSERVICE> <Directory /mutalyzer/services> diff --git a/extras/post-upgrade.sh b/extras/post-upgrade.sh index 15e00672..37ae527a 100644 --- a/extras/post-upgrade.sh +++ b/extras/post-upgrade.sh @@ -21,6 +21,8 @@ COLOR_END='\033[0m' # The 'cd /' is a hack to prevent the mutalyzer package under the current # directory to be used. PACKAGE_ROOT=$(cd / && python -c 'import mutalyzer; print mutalyzer.package_root()') +BIN_WEBSITE=$(which mutalyzer-website.wsgi) +BIN_WEBSERVICE=$(which mutalyzer-webservice.wsgi) if [ ! -e /var/www/mutalyzer ]; then mkdir -p /var/www/mutalyzer @@ -40,8 +42,12 @@ for MIGRATION in extras/migrations/*.migration; do $MIGRATION migrate done -echo "Restarting Apache" -/etc/init.d/apache2 restart +echo -e "${COLOR_INFO}Assuming mod_wsgi daemon mode, not restarting Apache${COLOR_END}" +#/etc/init.d/apache2 restart + +echo "Touching WSGI entry to reload application" +touch $BIN_WEBSITE +touch $BIN_WEBSERVICE echo "Restarting Mutalyzer batch daemon" /etc/init.d/mutalyzer-batchd restart -- GitLab