summaryrefslogtreecommitdiffstats
path: root/acid
diff options
context:
space:
mode:
authorMalfurious <m@lfurio.us>2023-08-18 12:40:45 -0400
committerMalfurious <m@lfurio.us>2023-08-18 13:45:53 -0400
commitd5c380f477f2913effd632cf58aff287062bf593 (patch)
tree1d23688844df4e4c71a7ce74b1ae3bb79b7a0ba6 /acid
parent6d503fa18f0f68c893d45fea2dc018f78c1ab02b (diff)
downloadcychedelic-d5c380f477f2913effd632cf58aff287062bf593.tar.gz
cychedelic-d5c380f477f2913effd632cf58aff287062bf593.zip
acid: Make docker compose YML file configurable
Facilitate deployments using alternate docker-compose.yml files, or projects which simply use a different filename for the configuration. This setting populates the `docker compose -f` option. Signed-off-by: Malfurious <m@lfurio.us>
Diffstat (limited to 'acid')
-rw-r--r--acid/config.sh4
-rwxr-xr-xacid/cyche-build21
-rwxr-xr-xacid/cychedelic6
3 files changed, 16 insertions, 15 deletions
diff --git a/acid/config.sh b/acid/config.sh
index d3dcee6..ee6b5cc 100644
--- a/acid/config.sh
+++ b/acid/config.sh
@@ -26,6 +26,6 @@ CYCHE_SERVICES=(
# in the list. As just mentioned, it can be named anything, but "cychedelic"
# is conventional.
- # <name> <url> <ref-pattern>
- 'cychedelic https://your/cyche/source.git refs/remotes/origin/master'
+ # <name> <url> <ref-pattern> <compose-file>
+ 'cychedelic https://your/cyche/source.git refs/remotes/origin/master docker-compose.yml'
)
diff --git a/acid/cyche-build b/acid/cyche-build
index f37c22b..8363f60 100755
--- a/acid/cyche-build
+++ b/acid/cyche-build
@@ -1,8 +1,9 @@
#!/bin/bash -e
-# cyche-build <name> <hash> [--self]
+# cyche-build <name> <file> <hash> [--self]
#
-# (Re)build and deploy docker services using the files associated with <name>.
+# (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
@@ -24,7 +25,7 @@
cd "/services/$1"
-if [ "$3" == "--self" ]; then
+if [ "$4" == "--self" ]; then
prev=$(cat '.git/previous_slug')
[ -n "$prev" ] && prev="--project-name $prev"
@@ -32,20 +33,20 @@ if [ "$3" == "--self" ]; then
next="--project-name $slug"
fi
-docker compose $next pull
-docker compose $next build \
+docker compose $next --file "$2" pull
+docker compose $next --file "$2" build \
--force-rm \
--no-cache \
--pull
-docker compose $next up \
+docker compose $next --file "$2" up \
--detach \
--remove-orphans \
--force-recreate
-echo "$2" >.git/previous_hash
+echo "$3" >.git/previous_hash
-if [ "$3" == "--self" ]; then
+if [ "$4" == "--self" ]; then
echo "$slug" >.git/previous_slug
- docker compose down
- docker compose $prev down
+ docker compose --file "$2" down
+ docker compose $prev --file "$2" down
fi
diff --git a/acid/cychedelic b/acid/cychedelic
index 002fb98..4e26b99 100755
--- a/acid/cychedelic
+++ b/acid/cychedelic
@@ -21,11 +21,11 @@ update() {
selfopt="--self"
for line in "${CYCHE_SERVICES[@]}"; do
- hash=$(cyche-source $line)
+ read -r -a arr <<< "$line"
+ hash=$(cyche-source ${arr[@]:0:3})
if [ $? -ne 0 ] || [ "$1" == "$forceopt" ]; then
- read -r -a arr <<< "$line"
- cyche-build "${arr[0]}" "$hash" $selfopt
+ cyche-build "${arr[0]}" "${arr[3]}" "$hash" $selfopt
fi
forceopt="--force"