From 34ddaf0b3b58fbdce9dbf112da58b5ad456a1f23 Mon Sep 17 00:00:00 2001 From: cagache Date: Thu, 28 Jun 2018 14:21:22 +0300 Subject: [PATCH 01/13] created scripts used to start/stop alfresco --- scripts/cleanImages.sh | 14 ++++++++++++++ scripts/startAlfresco.sh | 31 +++++++++++++++++++++++++++++++ scripts/stopDockerContainers.sh | 7 +++++++ 3 files changed, 52 insertions(+) create mode 100644 scripts/cleanImages.sh create mode 100644 scripts/startAlfresco.sh create mode 100644 scripts/stopDockerContainers.sh diff --git a/scripts/cleanImages.sh b/scripts/cleanImages.sh new file mode 100644 index 0000000000..0445fa2de6 --- /dev/null +++ b/scripts/cleanImages.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +imagesToBeDeleted=$1 +echo $imagesToBeDeleted +echo "List all images:" +docker images -a + +docker_images_list=$(docker images | grep $imagesToBeDeleted | awk '{print $3}' | uniq) +if [ "$docker_images_list" == "" ]; then + echo "No docker images on the agent" +else + echo "Clearing images: $docker_images_list" + docker rmi -f $docker_images_list +fi \ No newline at end of file diff --git a/scripts/startAlfresco.sh b/scripts/startAlfresco.sh new file mode 100644 index 0000000000..f3ed3d2008 --- /dev/null +++ b/scripts/startAlfresco.sh @@ -0,0 +1,31 @@ +#!/bin/bash +set -e # exit if commands fails +set -x # trace what gets exe + +docker info +docker-compose --version +echo "Starting Alfresco with AGS amps applied in Docker container" +docker-compose ps +docker-compose up -d + +WAIT_INTERVAL=1 +COUNTER=0 +TIMEOUT=300 +t0=`date +%s` + +echo "Waiting for alfresco to start" +until $(curl --output /dev/null --silent --head --fail http://localhost:8080/alfresco) || [ "$COUNTER" -eq "$TIMEOUT" ]; do + printf '.' + sleep $WAIT_INTERVAL + COUNTER=$(($COUNTER+$WAIT_INTERVAL)) +done + +if (("$COUNTER" < "$TIMEOUT")) ; then + t1=`date +%s` + delta=$((($t1 - $t0)/60)) + echo "Alfresco Started in $delta minutes" +else + echo "Waited $COUNTER seconds" + echo "Alfresco Could not start in time." + exit 1 +fi \ No newline at end of file diff --git a/scripts/stopDockerContainers.sh b/scripts/stopDockerContainers.sh new file mode 100644 index 0000000000..bbdaacc341 --- /dev/null +++ b/scripts/stopDockerContainers.sh @@ -0,0 +1,7 @@ +#!/bin/bash +set -e # exit if commands fails +set -x # trace what gets exe + +docker-compose ps +docker-compose kill +docker-compose rm -fv \ No newline at end of file From 4196c899c55d302c08b2c296a05e395d69773ad7 Mon Sep 17 00:00:00 2001 From: cagache Date: Thu, 28 Jun 2018 14:44:19 +0300 Subject: [PATCH 02/13] updated variable --- scripts/cleanImages.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/cleanImages.sh b/scripts/cleanImages.sh index 0445fa2de6..ecda5a8f29 100644 --- a/scripts/cleanImages.sh +++ b/scripts/cleanImages.sh @@ -1,11 +1,10 @@ #!/bin/bash -imagesToBeDeleted=$1 -echo $imagesToBeDeleted +echo $IMAGES_TO_BE_DELETED echo "List all images:" docker images -a -docker_images_list=$(docker images | grep $imagesToBeDeleted | awk '{print $3}' | uniq) +docker_images_list=$(docker images | grep $IMAGES_TO_BE_DELETED | awk '{print $3}' | uniq) if [ "$docker_images_list" == "" ]; then echo "No docker images on the agent" else From 85d1c7480707d6053d6dd96c799d8a6e1018d38c Mon Sep 17 00:00:00 2001 From: cagache Date: Thu, 28 Jun 2018 15:10:11 +0300 Subject: [PATCH 03/13] moved sh files to root --- scripts/cleanImages.sh => cleanImages.sh | 0 scripts/startAlfresco.sh => startAlfresco.sh | 0 scripts/stopDockerContainers.sh => stopDockerContainers.sh | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename scripts/cleanImages.sh => cleanImages.sh (100%) rename scripts/startAlfresco.sh => startAlfresco.sh (100%) rename scripts/stopDockerContainers.sh => stopDockerContainers.sh (100%) diff --git a/scripts/cleanImages.sh b/cleanImages.sh similarity index 100% rename from scripts/cleanImages.sh rename to cleanImages.sh diff --git a/scripts/startAlfresco.sh b/startAlfresco.sh similarity index 100% rename from scripts/startAlfresco.sh rename to startAlfresco.sh diff --git a/scripts/stopDockerContainers.sh b/stopDockerContainers.sh similarity index 100% rename from scripts/stopDockerContainers.sh rename to stopDockerContainers.sh From 1de7f363857d7fa74b7244c83c4c216c150e9f8f Mon Sep 17 00:00:00 2001 From: cagache Date: Thu, 28 Jun 2018 15:15:11 +0300 Subject: [PATCH 04/13] created scripts used to start/stop alfresco --- cleanImages.sh | 2 +- startAlfresco.sh | 2 +- stopDockerContainers.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cleanImages.sh b/cleanImages.sh index ecda5a8f29..32121dada9 100644 --- a/cleanImages.sh +++ b/cleanImages.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash echo $IMAGES_TO_BE_DELETED echo "List all images:" diff --git a/startAlfresco.sh b/startAlfresco.sh index f3ed3d2008..85dc63a9ff 100644 --- a/startAlfresco.sh +++ b/startAlfresco.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e # exit if commands fails set -x # trace what gets exe diff --git a/stopDockerContainers.sh b/stopDockerContainers.sh index bbdaacc341..bc5b56b2ff 100644 --- a/stopDockerContainers.sh +++ b/stopDockerContainers.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e # exit if commands fails set -x # trace what gets exe From 96687efe003744e7686f7e8b22227273adfab135 Mon Sep 17 00:00:00 2001 From: cagache Date: Thu, 28 Jun 2018 15:53:00 +0300 Subject: [PATCH 05/13] try to fix script to clean given docker images --- cleanImages.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cleanImages.sh b/cleanImages.sh index 32121dada9..6b814fefdd 100644 --- a/cleanImages.sh +++ b/cleanImages.sh @@ -1,10 +1,11 @@ -#!/usr/bin/env bash +#!/bin/bash +set -x echo $IMAGES_TO_BE_DELETED echo "List all images:" docker images -a -docker_images_list=$(docker images | grep $IMAGES_TO_BE_DELETED | awk '{print $3}' | uniq) +docker_images_list=$(docker images | grep '$IMAGES_TO_BE_DELETED' | awk '{print $3}' | uniq) if [ "$docker_images_list" == "" ]; then echo "No docker images on the agent" else From be7801767f8f97cd31b482ae562574f8c0b43f5b Mon Sep 17 00:00:00 2001 From: cagache Date: Thu, 28 Jun 2018 16:05:46 +0300 Subject: [PATCH 06/13] try to fix script to clean given docker images --- cleanImages.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cleanImages.sh b/cleanImages.sh index 6b814fefdd..a5d6ae663b 100644 --- a/cleanImages.sh +++ b/cleanImages.sh @@ -1,11 +1,12 @@ #!/bin/bash set -x -echo $IMAGES_TO_BE_DELETED +imagesToBeDeleted=$1 +echo $imagesToBeDeleted echo "List all images:" docker images -a -docker_images_list=$(docker images | grep '$IMAGES_TO_BE_DELETED' | awk '{print $3}' | uniq) +docker_images_list=$(docker images | grep '$imagesToBeDeleted' | awk '{print $3}' | uniq) if [ "$docker_images_list" == "" ]; then echo "No docker images on the agent" else From 1da97ca0663dd91be8b3cf2f9635e598f71c9bc4 Mon Sep 17 00:00:00 2001 From: cagache Date: Thu, 28 Jun 2018 16:12:06 +0300 Subject: [PATCH 07/13] try to fix script to clean given docker images --- cleanImages.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/cleanImages.sh b/cleanImages.sh index a5d6ae663b..248caa2054 100644 --- a/cleanImages.sh +++ b/cleanImages.sh @@ -1,7 +1,6 @@ #!/bin/bash set -x -imagesToBeDeleted=$1 echo $imagesToBeDeleted echo "List all images:" docker images -a From f787cba51a1944d6af28a9860a9718cfe14820f2 Mon Sep 17 00:00:00 2001 From: cagache Date: Thu, 28 Jun 2018 16:22:22 +0300 Subject: [PATCH 08/13] try to fix script to clean given docker images --- cleanImages.sh | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/cleanImages.sh b/cleanImages.sh index 248caa2054..9775170cc9 100644 --- a/cleanImages.sh +++ b/cleanImages.sh @@ -2,13 +2,3 @@ set -x echo $imagesToBeDeleted -echo "List all images:" -docker images -a - -docker_images_list=$(docker images | grep '$imagesToBeDeleted' | awk '{print $3}' | uniq) -if [ "$docker_images_list" == "" ]; then - echo "No docker images on the agent" -else - echo "Clearing images: $docker_images_list" - docker rmi -f $docker_images_list -fi \ No newline at end of file From 4efbeb5b9fc261ba95c3a407684bec2beb6e9336 Mon Sep 17 00:00:00 2001 From: cagache Date: Thu, 28 Jun 2018 16:24:46 +0300 Subject: [PATCH 09/13] try to fix script to clean given docker images --- cleanImages.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/cleanImages.sh b/cleanImages.sh index 9775170cc9..d759434a49 100644 --- a/cleanImages.sh +++ b/cleanImages.sh @@ -1,4 +1,14 @@ #!/bin/bash set -x -echo $imagesToBeDeleted +imagesToBeDeleted="alfresco-content-repository\|ags-repo-enterprise\|ags-share-enterprise\|alfresco-share" +echo "List all images:" +docker images -a + +docker_images_list=$(docker images | grep '$imagesToBeDeleted' | awk '{print $3}' | uniq) +if [ "$docker_images_list" == "" ]; then + echo "No docker images on the agent" +else + echo "Clearing images: $docker_images_list" + docker rmi -f $docker_images_list +fi From 20b48ef61b38d6ba6e87a25809363b162eedf942 Mon Sep 17 00:00:00 2001 From: cagache Date: Thu, 28 Jun 2018 16:39:53 +0300 Subject: [PATCH 10/13] try to fix script to clean given docker images --- cleanImages.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/cleanImages.sh b/cleanImages.sh index d759434a49..7d05ccbdd4 100644 --- a/cleanImages.sh +++ b/cleanImages.sh @@ -1,7 +1,6 @@ #!/bin/bash set -x -imagesToBeDeleted="alfresco-content-repository\|ags-repo-enterprise\|ags-share-enterprise\|alfresco-share" echo "List all images:" docker images -a From 4d9a51daca8800d8c38cee44f35f0a5c07ab758e Mon Sep 17 00:00:00 2001 From: cagache Date: Thu, 28 Jun 2018 16:42:13 +0300 Subject: [PATCH 11/13] try to fix script to clean given docker images --- cleanImages.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/cleanImages.sh b/cleanImages.sh index 7d05ccbdd4..e1d627b518 100644 --- a/cleanImages.sh +++ b/cleanImages.sh @@ -1,6 +1,7 @@ #!/bin/bash set -x +echo $imagesToBeDeleted echo "List all images:" docker images -a From 5de20477ee70cd0281c75e44028742ff93ff3b61 Mon Sep 17 00:00:00 2001 From: cagache Date: Thu, 28 Jun 2018 16:47:02 +0300 Subject: [PATCH 12/13] moved scripts to specific directory --- cleanImages.sh => scripts/cleanImages.sh | 0 startAlfresco.sh => scripts/startAlfresco.sh | 0 stopDockerContainers.sh => scripts/stopDockerContainers.sh | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename cleanImages.sh => scripts/cleanImages.sh (100%) rename startAlfresco.sh => scripts/startAlfresco.sh (100%) rename stopDockerContainers.sh => scripts/stopDockerContainers.sh (100%) diff --git a/cleanImages.sh b/scripts/cleanImages.sh similarity index 100% rename from cleanImages.sh rename to scripts/cleanImages.sh diff --git a/startAlfresco.sh b/scripts/startAlfresco.sh similarity index 100% rename from startAlfresco.sh rename to scripts/startAlfresco.sh diff --git a/stopDockerContainers.sh b/scripts/stopDockerContainers.sh similarity index 100% rename from stopDockerContainers.sh rename to scripts/stopDockerContainers.sh From 309a91edeaca8e370670766ee4bb015fe0693402 Mon Sep 17 00:00:00 2001 From: cagache Date: Thu, 28 Jun 2018 17:22:45 +0300 Subject: [PATCH 13/13] try to fix script to clean given docker images --- scripts/cleanImages.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/cleanImages.sh b/scripts/cleanImages.sh index e1d627b518..874723aa6f 100644 --- a/scripts/cleanImages.sh +++ b/scripts/cleanImages.sh @@ -5,7 +5,7 @@ echo $imagesToBeDeleted echo "List all images:" docker images -a -docker_images_list=$(docker images | grep '$imagesToBeDeleted' | awk '{print $3}' | uniq) +docker_images_list=$(docker images | grep $imagesToBeDeleted | awk '{print $3}' | uniq) if [ "$docker_images_list" == "" ]; then echo "No docker images on the agent" else