changeset 1596:45b0571b684d dockerise

Minor docs, fixes, test
author Chris Cannam
date Fri, 18 Aug 2017 20:27:40 +0100
parents 98384d0defa0
children eeacb8332051
files .hgignore deploy/config/cron.monthly/00-backup-files deploy/provision.d/120-docgen.sh deploy/provision.d/130-reposman.sh deploy/test/smoketest.sh
diffstat 5 files changed, 93 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Fri Aug 18 16:25:04 2017 +0100
+++ b/.hgignore	Fri Aug 18 20:27:40 2017 +0100
@@ -43,3 +43,4 @@
 *-console.log
 postgres-dumpall
 *.gen
+deploy/test/output
--- a/deploy/config/cron.monthly/00-backup-files	Fri Aug 18 16:25:04 2017 +0100
+++ b/deploy/config/cron.monthly/00-backup-files	Fri Aug 18 20:27:40 2017 +0100
@@ -1,9 +1,9 @@
 #!/bin/sh
+cd /
 for location in var/www etc/apache2 etc/cron.*; do
 	target="/var/files/backups/`echo $location | sed 's,/,_,g'`-`date +%Y%m%d%H%M`"
 	oldmask=`umask`
 	umask 0277
-	cd /
 	tar cjf "$target".tar.bz2 "$location"
 	umask "$oldmask"
 done
--- a/deploy/provision.d/120-docgen.sh	Fri Aug 18 16:25:04 2017 +0100
+++ b/deploy/provision.d/120-docgen.sh	Fri Aug 18 20:27:40 2017 +0100
@@ -2,9 +2,14 @@
 
 set -e
 
-# Copy docgen scripts to the place they actually live. This is
-# particularly badly managed, since the target location is actually
-# within the repo already
+# Copy docgen scripts, including the generated scripts with
+# interpolated API key etc, to the directory they will be run from.
+
+# These are run from cron jobs to do the (currently daily) update of
+# extracted documentation from Doxygen, Javadoc, and MATLAB, and to
+# enable displaying them with the redmine_embedded plugin. (The API
+# key is needed to automatically switch on the embedded module for a
+# project the first time its docs are extracted.)
 
 cd /var/www/code
 
--- a/deploy/provision.d/130-reposman.sh	Fri Aug 18 16:25:04 2017 +0100
+++ b/deploy/provision.d/130-reposman.sh	Fri Aug 18 20:27:40 2017 +0100
@@ -2,11 +2,22 @@
 
 set -e
 
-# Copy reposman scripts to the place they actually live. Like docgen,
-# this is particularly badly managed, since the target location is
-# actually within the repo already. At least in this case some of the
-# scripts have to be edited to insert the server's API key, so there
-# is a bit of logic there
+# Copy reposman (repository manager) scripts, including the generated
+# scripts with interpolated API key etc, to the directory they will be
+# run from.
+
+# There are two sets of scripts here:
+#
+# 1. The reposman script that plods through all the projects that have
+# repositories defined, creates those repositories on disc, and
+# registers their locations with the projects. This happens often,
+# currently every minute.
+#
+# 2. The external repo management script that plods through all the
+# projects that have external repositories defined, clones or updates
+# those external repos to their local locations, and if necessary
+# registers them with the projects. This happens less often, currently
+# every hour.
 
 cd /var/www/code
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/deploy/test/smoketest.sh	Fri Aug 18 20:27:40 2017 +0100
@@ -0,0 +1,67 @@
+#!/bin/bash
+
+# The big problem with this test script is that it needs the cron
+# scripts that generate some of this stuff to have been run at least
+# once
+
+usage() {
+    echo 1>&2
+    echo "Usage: $0 <uri-base>" 1>&2
+    echo 1>&2
+    echo "  e.g. $0 https://code.soundsoftware.ac.uk" 1>&2
+    echo "    or $0 http://localhost:8080" 1>&2
+    echo 1>&2
+    exit 2
+}
+
+uribase="$1"
+if [ -z "$uribase" ]; then
+    usage
+fi
+
+set -eu
+
+# A project that is known to exist, be public, and have embedded
+# documentation
+project=vamp-plugin-sdk
+
+tried=0
+succeeded=0
+
+mydir=$(dirname "$0")
+
+try() {
+    mkdir -p "$mydir/output"
+    origin=$(pwd)
+    cd "$mydir/output"
+    path="$1"
+    description="$2"
+    url="$uribase$path"
+    echo
+    echo "Trying \"$description\" [$url]..."
+    echo
+    if wget "$url" ; then
+        echo "+++ Succeeded"
+        tried=$(($tried + 1))
+        succeeded=$(($succeeded + 1))
+        cd "$origin"
+        return 0
+    else
+        echo "--- FAILED"
+        tried=$(($tried + 1))
+        cd "$origin"
+        return 1
+    fi
+}
+
+try "/" "Front page"
+try "/projects/$project" "Project page"
+try "/projects/$project/repository" "Repository page"
+try "/hg/$project" "Mercurial repo"
+try "/projects/$project/embedded" "Project documentation page (from docgen cron script)"
+try "/git/$project/info/refs" "Git repo mirror"
+
+echo
+echo "Passed $succeeded of $tried"
+echo
+