From 72ebcc5f9c604be8aa573ab8a754b491e686280d Mon Sep 17 00:00:00 2001 From: Richard Ipsum Date: Mon, 24 Feb 2014 16:19:28 +0000 Subject: Add distbuild config extension --- distbuild.configure | 130 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 distbuild.configure diff --git a/distbuild.configure b/distbuild.configure new file mode 100644 index 00000000..739a5d84 --- /dev/null +++ b/distbuild.configure @@ -0,0 +1,130 @@ +#!/bin/sh +# Copyright (C) 2013 Codethink Limited +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +set -eu + + +# If ARTIFACT_CACHE_SERVER isn't set, default to $TROVE_ID. +if [ "x$ARTIFACT_CACHE_SERVER" = x ] +then + ARTIFACT_CACHE_SERVER="$TROVE_ID" +fi + + +# Create the mount point for extra disk space. +install -d -o 0 -g 0 -m 0755 "$1/srv/distbuild" + + +# Configuration shared by all instances of Morph. For reasons of +# convenience, this sets the controller-initiator-address, so +# that when users invoke "morph", they don't need to manually +# specify it, or to manually add another configuration file to +# use. However, the setting may only be set for the distbuild +# initiator (which is what the user invokes), so in ALL other +# configuration files we unset it. +# +# We disable the disk space requirement checks on non-worker nodes. +# They don't make sense unless you're building locally. + +cat < "$1/etc/morph.conf" +[config] +log = /var/log/morph.log +cachedir = /srv/distbuild +tempdir = /srv/distbuild/tmp +trove-host = $TROVE_ID +controller-initiator-address = $CONTROLLERHOST +tempdir-min-space = 0 +cachedir-min-space = 0 +build-ref-prefix = $TROVE_ID +artifact-cache-server = http://${ARTIFACT_CACHE_SERVER}:8080/ +git-resolve-cache-server = http://${TROVE_ID}:8080/ +repo-alias = freedesktop=git://anongit.freedesktop.org/#ssh://git.freedesktop.org/, + github=git://github.com/%s#ssh://git@github.com/%s, + baserock=git://git.baserock.org/baserock/%s#ssh://git@git.baserock.org/baserock/%s, + gnome=git://git.gnome.org/%s#ssh://git.gnome.org/git/%s, + upstream=git://git.baserock.org/delta/%s#ssh://git@git.baserock.org/delta/%s, + codethink=ssh://git@git.codethink.co.uk/ct098/%s#ssh://git@git.codethink.co.uk/ct098/%s +EOF + + +# Configuration for a distbuild controller. This configuration +# file gets used by the systemd unit that runs the controller. +# The existence of this configuration file triggers the systemd +# unit, so we only create it on nodes that are meant to act as +# the controller. + +if [ "$DISTBUILD_CONTROLLER" = True ] +then + cat < "$1/etc/morph-controller.conf" +[config] +log = /var/log/morph-controller.log +writeable-cache-server = http://${ARTIFACT_CACHE_SERVER}:8081/ +worker = $WORKERS +controller-helper-address = 127.0.0.1 +EOF + + # Configuration for the controller's helper process. This + # gets used by the systemd unit that starts the helper. + +cat < "$1/etc/morph-controller-helper.conf" +[config] +log = /var/log/morph-controller-helper.log +parent-port = 5656 +parent-address = 127.0.0.1 +EOF + +fi + +# Configuration for a distbuild worker. This gets reference +# by the systemd unit that starts the worker. Again, the +# existence of morph-worker.conf triggers the systemd unit +# to starts the worker, so we only create it on systems +# that are meant to be a worker. + +if [ "$DISTBUILD_WORKER" = True ] +then + cat < "$1/etc/morph-worker.conf" +[config] +log = /var/log/morph-worker.log +controller-initiator-address = +EOF + + # This will be used for a systemd generator which + # nfs mounts the ccache from the trove + echo "$TROVE_ID" > "$1/etc/trove-host" + + # Configuration for the controller's helper process. This + # gets used by the systemd unit that starts the helper. + +cat < "$1/etc/morph-worker-helper.conf" +[config] +log = /var/log/morph-worker-helper.log +parent-address = 127.0.0.1 +EOF + + + # Configuration for the Morph cache server daemon. We + # only run the cache server on workers. + +cat < "$1/etc/morph-cache-server.conf" +[config] +port = 8080 +artifact-dir = /srv/distbuild/artifacts +direct-mode = True +fcgi-server = False +EOF + +fi -- cgit v1.2.1