From 276f8b2ca85407dcc33c9ea363b86e4744bd2786 Mon Sep 17 00:00:00 2001 From: Arif Er Date: Fri, 24 Jun 2022 16:06:54 +0800 Subject: [PATCH 1/2] Add feature to remove service from unRAID cache The changes in this commit clears any prior history of project services in unRAID's cache. It ensures that changes made to the compose file gets properly updated when the project is spun up. --- source/compose.manager/scripts/compose.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/source/compose.manager/scripts/compose.sh b/source/compose.manager/scripts/compose.sh index fe59ba0..759e161 100755 --- a/source/compose.manager/scripts/compose.sh +++ b/source/compose.manager/scripts/compose.sh @@ -1,14 +1,21 @@ #!/bin/bash export HOME=/root +export DOCKER_JSON=/usr/local/emhttp/state/plugins/dynamix.docker.manager/docker.json case $1 in up) + docker compose -f "$2" -p "$3" ps -a | + awk '{if (NR!=1) {printf("%s.\"%s\"", sep, $1); sep=", "}}' | + xargs -0 -I {} jq 'del({})' $DOCKER_JSON > $DOCKER_JSON docker compose -f "$2" -p "$3" up -d 2>&1 ;; down) + docker compose -f "$2" -p "$3" ps -a | + awk '{if (NR!=1) {printf("%s.\"%s\"", sep, $1); sep=", "}}' | + xargs -0 -I {} jq 'del({})' $DOCKER_JSON > $DOCKER_JSON docker compose -f "$2" -p "$3" down 2>&1 ;; From eb8a09c9a1c31421da4b7876f426c68a79ba1614 Mon Sep 17 00:00:00 2001 From: Arif Er Date: Fri, 24 Jun 2022 16:53:19 +0800 Subject: [PATCH 2/2] Add feature to remove cached icons when spinning down project The changes in this commit ensures that cached icons are removed from the server so that changes made to the `net.unraid.docker.icon` are respected. --- source/compose.manager/scripts/compose.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/source/compose.manager/scripts/compose.sh b/source/compose.manager/scripts/compose.sh index 759e161..a055d4a 100755 --- a/source/compose.manager/scripts/compose.sh +++ b/source/compose.manager/scripts/compose.sh @@ -1,7 +1,10 @@ #!/bin/bash export HOME=/root -export DOCKER_JSON=/usr/local/emhttp/state/plugins/dynamix.docker.manager/docker.json +DOCKER_MANAGER=/usr/local/emhttp/state/plugins/dynamix.docker.manager +DOCKER_JSON=$DOCKER_MANAGER/docker.json +DOCKER_IMAGES=$DOCKER_MANAGER/images +UNRAID_IMAGES=/var/lib/docker/unraid/images case $1 in @@ -9,6 +12,9 @@ case $1 in docker compose -f "$2" -p "$3" ps -a | awk '{if (NR!=1) {printf("%s.\"%s\"", sep, $1); sep=", "}}' | xargs -0 -I {} jq 'del({})' $DOCKER_JSON > $DOCKER_JSON + docker compose -f "$2" -p "$3" ps -a | + awk '{if (NR!=1) {print $1}}' | + xargs -I {} find $DOCKER_IMAGES $UNRAID_IMAGES -name {}.png -delete docker compose -f "$2" -p "$3" up -d 2>&1 ;; @@ -16,6 +22,9 @@ case $1 in docker compose -f "$2" -p "$3" ps -a | awk '{if (NR!=1) {printf("%s.\"%s\"", sep, $1); sep=", "}}' | xargs -0 -I {} jq 'del({})' $DOCKER_JSON > $DOCKER_JSON + docker compose -f "$2" -p "$3" ps -a | + awk '{if (NR!=1) {print $1}}' | + xargs -I {} find $DOCKER_IMAGES $UNRAID_IMAGES -name {}.png -delete docker compose -f "$2" -p "$3" down 2>&1 ;;