summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Coldrick <adam.coldrick@codethink.co.uk>2015-03-03 11:01:32 +0000
committerAdam Coldrick <adam.coldrick@codethink.co.uk>2015-04-10 13:52:26 +0000
commitce74ccdddae469cd6b9ebe88f35c402310cacce1 (patch)
tree00e84c4489c1e571904ea7e470c499f2c9971c35
parent6ad1ecf530e34612a59e548eb08a58b7e92e05b3 (diff)
downloadmorph-ce74ccdddae469cd6b9ebe88f35c402310cacce1.tar.gz
yarns: Make the distbuild yarn expose the worker's artifact cache over HTTP
OSTree can easily pull over HTTP. All that is necessary is to expose the repo directory. This commit adds a simple HTTP server to do this in the test suite. Actual implementations should use something better, like lighttpd. Also add some logging of the cache servers in this yarn to help debug.
-rwxr-xr-xostree-repo-server15
-rw-r--r--yarns/implementations.yarn16
-rw-r--r--yarns/morph.shell-lib1
3 files changed, 29 insertions, 3 deletions
diff --git a/ostree-repo-server b/ostree-repo-server
new file mode 100755
index 00000000..e6dc4a56
--- /dev/null
+++ b/ostree-repo-server
@@ -0,0 +1,15 @@
+#!/usr/bin/python
+
+from BaseHTTPServer import HTTPServer
+from SimpleHTTPServer import SimpleHTTPRequestHandler
+from SocketServer import ThreadingMixIn
+
+class ThreadedHTTPServer(ThreadingMixIn, HTTPServer):
+ """Handle requests in a separate thread"""
+
+handler = SimpleHTTPRequestHandler
+handler.protocol_version="HTTP/1.0"
+server_address = ('', 12324)
+
+httpd = ThreadedHTTPServer(server_address, handler)
+httpd.serve_forever()
diff --git a/yarns/implementations.yarn b/yarns/implementations.yarn
index faae44a8..6bdc3ed2 100644
--- a/yarns/implementations.yarn
+++ b/yarns/implementations.yarn
@@ -1061,13 +1061,14 @@ Distbuild
read_cache_server_pid_file="$DATADIR/read-cache-server-pid"
start_cache_server "$read_cache_server_port_file" \
"$read_cache_server_pid_file" \
- "$artifact_dir"
+ "$artifact_dir" "$DATADIR/communal-cache.log"
write_cache_server_port_file="$DATADIR/write-cache-server-port"
write_cache_server_pid_file="$DATADIR/write-cache-server-pid"
start_cache_server "$write_cache_server_port_file" \
"$write_cache_server_pid_file" \
- "$artifact_dir" --enable-writes
+ "$artifact_dir" "$DATADIR/writeable-cache.log" \
+ --enable-writes
IMPLEMENTS FINALLY the communal cache server is terminated
stop_daemon "$DATADIR/read-cache-server-pid"
@@ -1082,7 +1083,7 @@ Distbuild
worker_cache_pid_file="$DATADIR/worker-cache-server-pid"
start_cache_server "$worker_cache_port_file" \
"$worker_cache_pid_file" \
- "$worker_artifacts"
+ "$worker_artifacts" "$DATADIR/worker-cache.log"
# start worker daemon
worker_daemon_port_file="$DATADIR/worker-daemon-port"
@@ -1104,6 +1105,14 @@ Distbuild
rm "$worker_daemon_port_file"
echo "$worker_daemon_port" >"$worker_daemon_port_file"
+ # serve artifact cache over http
+ worker_repo_pid_file="$DATADIR/worker-repo-pid"
+ mkdir "$worker_artifacts/repo"
+ cd "$worker_artifacts/repo"
+ start-stop-daemon --start --pidfile="$worker_repo_pid_file" \
+ --background --make-pidfile --verbose \
+ --startas="$SRCDIR/ostree-repo-server"
+
# start worker helper
helper_pid_file="$DATADIR/worker-daemon-helper-pid"
start-stop-daemon --start --pidfile="$helper_pid_file" \
@@ -1125,6 +1134,7 @@ Distbuild
stop_daemon "$DATADIR/worker-cache-server-pid"
stop_daemon "$DATADIR/worker-daemon-pid"
stop_daemon "$DATADIR/worker-daemon-helper-pid"
+ stop_daemon "$DATADIR/worker-repo-pid"
IMPLEMENTS GIVEN a distbuild controller
worker_cache_port_file="$DATADIR/worker-cache-server-port"
diff --git a/yarns/morph.shell-lib b/yarns/morph.shell-lib
index e7011091..4f345a4a 100644
--- a/yarns/morph.shell-lib
+++ b/yarns/morph.shell-lib
@@ -194,6 +194,7 @@ start_cache_server(){
--background --make-pidfile --verbose \
--startas="$SRCDIR/morph-cache-server" -- \
--port-file="$1" --no-fcgi \
+ --log="$4" \
--repo-dir="$DATADIR/gits" --direct-mode \
--bundle-dir="$DATADIR/bundles" \
--artifact-dir="$3" "$@"