summaryrefslogtreecommitdiffstats
path: root/acid/cyche-build
diff options
context:
space:
mode:
authorMalfurious <m@lfurio.us>2023-10-24 22:05:05 -0400
committerMalfurious <m@lfurio.us>2023-10-26 20:41:40 -0400
commitfe1abd055998e171b92d0e42df8063cab83a40ed (patch)
treef6c117db24b71a8cfbbe4cc5518b1cf5678f0ac4 /acid/cyche-build
parentf87fb62563b34e34505021ee3f25fe53cbc5beb1 (diff)
downloadcychedelic-fe1abd055998e171b92d0e42df8063cab83a40ed.tar.gz
cychedelic-fe1abd055998e171b92d0e42df8063cab83a40ed.zip
acid: Don't use 'cychedelic' in file names
As I add new components to the cychedelic system, it would be best to use more specific naming. 'cychedelic' is the name of the project, whereas 'acid' is the name of this program. Signed-off-by: Malfurious <m@lfurio.us>
Diffstat (limited to 'acid/cyche-build')
-rwxr-xr-xacid/cyche-build58
1 files changed, 0 insertions, 58 deletions
diff --git a/acid/cyche-build b/acid/cyche-build
deleted file mode 100755
index 6468276..0000000
--- a/acid/cyche-build
+++ /dev/null
@@ -1,58 +0,0 @@
-#!/bin/bash -e
-
-# cyche-build <name> <file> <hash> [--self]
-#
-# (Re)build and deploy the service <name> using the docker-compose configuration
-# in <file> (usually, docker-compose.yml).
-#
-# In the typical case, this is a straightforward process and `docker compose up`
-# can properly recreate/start containers for the guest service. However, when
-# rebuilding cychedelic itself, `--self` must be given, which modifies this
-# script to support self-upgrade of the running compose service.
-#
-# In `--self` mode, we prepare and start the cychedelic service under an
-# alternate project name each time, before taking down the existing (old)
-# services. This is necessary because running `docker compose up` terminates
-# old containers before starting new ones. Termination of the ACID service
-# interrupts the `compose up` process before it can start the replacements.
-# Normally, `docker compose down` is then not needed.
-#
-# We take <hash> (from cyche-source) so we may commit it to the cache iff the
-# deployment is successful.
-#
-# This file exits early on any failure (non-zero). On a successful run in
-# `--self` mode, this file does not exit (we are killed by `compose down`).
-
-cd "/services/$1"
-
-# For <file>, no absolute paths and no '../'
-if ! echo "$2" | grep -Evq '\.\.|^/'; then
- echo "Bad file path: $2"
- exit 1
-fi
-
-if [ "$4" == "--self" ]; then
- prev=$(cat '.git/previous_slug')
- [ -z "$prev" ] && prev="$1"
- name=$(echo -n "$1-"; tr -dc a-z </dev/urandom | head -c 12)
-else
- name="$1"
-fi
-
-docker compose --project-name "$name" --file "$2" pull
-docker compose --project-name "$name" --file "$2" build \
- --force-rm \
- --no-cache \
- --pull
-docker compose --project-name "$name" --file "$2" up \
- --detach \
- --remove-orphans \
- --force-recreate
-
-echo "$3" >.git/previous_hash
-
-if [ "$4" == "--self" ]; then
- echo "$name" >.git/previous_slug
- docker compose --project-name "$1" down
- docker compose --project-name "$prev" down
-fi