summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <lars.wirzenius@codethink.co.uk>2014-04-23 16:40:44 +0000
committerLars Wirzenius <lars.wirzenius@codethink.co.uk>2014-04-23 16:40:44 +0000
commiteafba37e2bfc3897e3e7f65f2ce087fbee358f43 (patch)
tree7acd5c8fea2ad7a00ba393799f0a155417edf07d
parent56b4fc537662d8d42f366b5cb5be0eada79d8d56 (diff)
parent88051a6ab096b20ab098434fd4d4c127efca910f (diff)
downloadtrove-setup-eafba37e2bfc3897e3e7f65f2ce087fbee358f43.tar.gz
Merge branch 'baserock/liw/new-lc-2'
Reviewed by Daniel and Richard on the mailing list, and further changes based on review feedback by Richard on IRC. Reviewed-by: Richard Maw Reviewed-by: Daniel Silverstone
-rw-r--r--Makefile3
-rwxr-xr-xbins/trove-early-setup4
-rw-r--r--etc/lorry.conf3
-rwxr-xr-xlibexecs/remove-lorry-controller-from-lorry-crontab22
-rw-r--r--share/lorry-controller.conf84
-rw-r--r--units/drop-lorry-controller-cronjob.service13
6 files changed, 83 insertions, 46 deletions
diff --git a/Makefile b/Makefile
index 453c01e..3a64344 100644
--- a/Makefile
+++ b/Makefile
@@ -13,8 +13,11 @@ install:
ln -s /home/lorry/bundles "${DESTDIR}/var/www/htdocs/bundles"
ln -s /home/lorry/tarballs "${DESTDIR}/var/www/htdocs/tarballs"
ln -s /home/lorry/lc-status.html "${DESTDIR}/var/www/htdocs/lc-status.html"
+ ln -s /usr/share/lorry-controller/static/ "${DESTDIR}/var/www/htdocs/lc-static"
mkdir -p "${DESTDIR}/usr/bin"
cp bins/* "${DESTDIR}/usr/bin/"
+ mkdir -p "${DESTDIR}/usr/libexec"
+ cp libexecs/* "${DESTDIR}/usr/libexec/"
mkdir -p "${DESTDIR}/usr/share/trove-setup"
cp -r share/* "${DESTDIR}/usr/share/trove-setup/"
diff --git a/bins/trove-early-setup b/bins/trove-early-setup
index 308a3e7..5ce2d7a 100755
--- a/bins/trove-early-setup
+++ b/bins/trove-early-setup
@@ -69,8 +69,6 @@ gitano-configured: /home/git/.gitano-setup
PREFIX=$$(echo "##PREFIX##" | sed -f /etc/trove-setup.sed); \
su -c "ssh localhost create $${PREFIX}/local-config/lorries" - git; \
su -c "git clone ssh://localhost/$${PREFIX}/local-config/lorries.git /tmp/lorries" - git; \
- su -c "mkdir /home/lorry/lorry-controller-area" - lorry; \
- su -c "git clone ssh://git@localhost/$${PREFIX}/local-config/lorries.git /home/lorry/lorry-controller-area/git" - lorry
su -c "sed -f /etc/trove-setup.sed < /usr/share/trove-setup/lorry-controller.conf > /tmp/lorries/lorry-controller.conf" - git
su -c "sed -f /etc/trove-setup.sed < /usr/share/trove-setup/README.lorry-controller > /tmp/lorries/README" - git
su -c "mkdir /tmp/lorries/open-source-lorries" - git
@@ -79,8 +77,6 @@ gitano-configured: /home/git/.gitano-setup
su -c "cp /usr/share/trove-setup/closed-source-lorries/README /tmp/lorries/closed-source-lorries/README" - git
su -c "cd /tmp/lorries; git add README lorry-controller.conf open-source-lorries/README closed-source-lorries/README; git commit -m 'Initial configuration'; git push origin master" - git
su -c "rm -rf /tmp/lorries" - git
- su -c "cd /home/lorry/lorry-controller-area/git; git remote update; git checkout master" - lorry
- su -c "echo '*/1 * * * * flock -x -n /home/lorry/lorry-controller-area/lockfile -c lorry-controller --work-area=/home/lorry/lorry-controller-area --log=syslog --log-level=info --html-file=/home/lorry/lc-status.html' | crontab -" - lorry
touch $@
.PHONY: lorry-configured
diff --git a/etc/lorry.conf b/etc/lorry.conf
index 65eaac8..16552cb 100644
--- a/etc/lorry.conf
+++ b/etc/lorry.conf
@@ -6,3 +6,6 @@ bundle-dest = /home/lorry/bundles
tarball = always
tarball-dest = /home/lorry/tarballs
working-area = /home/lorry/working-area
+verbose = yes
+log = /dev/stdout
+log-level = debug
diff --git a/libexecs/remove-lorry-controller-from-lorry-crontab b/libexecs/remove-lorry-controller-from-lorry-crontab
new file mode 100755
index 0000000..8fc6cf3
--- /dev/null
+++ b/libexecs/remove-lorry-controller-from-lorry-crontab
@@ -0,0 +1,22 @@
+#!/bin/sh
+#
+# Trove used to run a version of Lorry Controller that wasn't a
+# daemon, but instead was invoked once a minute from a crontab owned
+# by the lorry user. When we upgrade to a version of Lorry Controller
+# that does run as a daemon, we need to disable the cronjob. This
+# script does that.
+#
+# The lorry user crontab may contain other jobs, so we can't just
+# willy-nilly delete the whole crontab. Instead, we remove the
+# specific line. The line looks like this:
+#
+# */1 * * * * flock -x -n /home/lorry/lorry-controller-area/lockfile
+# -c lorry-controller --work-area=/home/lorry/lorry-controller-area
+# --log=syslog --log-level=info --html-file=/home/lorry/lc-status.html
+#
+# Except, of course, all on one line.
+
+
+crontab -l |
+grep -v -e '-c lorry-controller' |
+crontab -
diff --git a/share/lorry-controller.conf b/share/lorry-controller.conf
index 6004171..bdbbbd5 100644
--- a/share/lorry-controller.conf
+++ b/share/lorry-controller.conf
@@ -1,50 +1,50 @@
[
{
- "type": "trove",
- "uuid": "##PREFIX##/initial",
- "serial": 1,
- "trovehost": "git.baserock.org",
- "protocol": "ssh",
- "ls-interval": "4H",
- "interval": "2H",
- "create": "always",
- "destroy": "never",
- "stagger": true,
- "prefixmap": {
- "baserock": "baserock",
- "delta": "delta"
- },
- "ignore": [
- "baserock/lorries"
- ],
- "tarball": "always"
+ "type": "trove",
+ "uuid": "##PREFIX##/initial",
+ "serial": 1,
+ "trovehost": "##UPSTREAM_TROVE##",
+ "protocol": "ssh",
+ "ls-interval": "4H",
+ "interval": "2H",
+ "create": "always",
+ "destroy": "never",
+ "stagger": true,
+ "prefixmap": {
+ "baserock": "baserock",
+ "delta": "delta"
+ },
+ "ignore": [
+ "baserock/lorries"
+ ],
+ "tarball": "always"
},
{
- "type": "lorries",
- "uuid": "##PREFIX##/open-source-lorries",
- "serial": 1,
- "interval": "6H",
- "create": "always",
- "destroy": "never",
- "stagger": true,
- "prefix": "delta",
- "tarball": "always",
- "globs": [
- "open-source-lorries/*.lorry"
- ]
+ "type": "lorries",
+ "uuid": "##PREFIX##/open-source-lorries",
+ "serial": 1,
+ "interval": "6H",
+ "create": "always",
+ "destroy": "never",
+ "stagger": true,
+ "prefix": "delta",
+ "tarball": "always",
+ "globs": [
+ "open-source-lorries/*.lorry"
+ ]
},
{
- "type": "lorries",
- "uuid": "##PREFIX##/closed-source-lorries",
- "serial": 1,
- "interval": "6H",
- "create": "always",
- "destroy": "never",
- "stagger": true,
- "prefix": "delta",
- "tarball": "always",
- "globs": [
- "closed-source-lorries/*.lorry"
- ]
+ "type": "lorries",
+ "uuid": "##PREFIX##/closed-source-lorries",
+ "serial": 1,
+ "interval": "6H",
+ "create": "always",
+ "destroy": "never",
+ "stagger": true,
+ "prefix": "delta",
+ "tarball": "always",
+ "globs": [
+ "closed-source-lorries/*.lorry"
+ ]
}
]
diff --git a/units/drop-lorry-controller-cronjob.service b/units/drop-lorry-controller-cronjob.service
new file mode 100644
index 0000000..8cad21f
--- /dev/null
+++ b/units/drop-lorry-controller-cronjob.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Drop lorry-controller from lorry's crontab
+After=basic.target
+ConditionPathExists=!/etc/lorry-controller/lorry-controller-removed-from-crontab
+
+[Service]
+Type=oneshot
+Restart=no
+ExecStart=/usr/libexec/remove-lorry-controller-from-lorry-crontab
+ExecStartPost=/bin/touch /etc/lorry-controller/lorry-controller-removed-from-crontab
+User=lorry
+Group=lorry
+PermissionsStartOnly=true