From 8f80308e420d071d9797881baf07386cc441540a Mon Sep 17 00:00:00 2001 From: "a.lambert@unesco.org" Date: Tue, 29 Oct 2024 12:20:05 +0100 Subject: [PATCH] #28 the complete correct repo has to be here before we continue --- setup_prod.sh | 90 ++++++++++++++++++++++++++------------------------- 1 file changed, 46 insertions(+), 44 deletions(-) diff --git a/setup_prod.sh b/setup_prod.sh index 1a04785..f97bb84 100755 --- a/setup_prod.sh +++ b/setup_prod.sh @@ -121,6 +121,50 @@ fi printf "start installation\n\n" + +# stop and remove old containers +printf " \n${YELLOW}stopping and removing old containers${NC}\n" +# stop running container(s) +docker ps -aq | xargs -r docker stop +# remove existing container(s) +docker ps -aq | xargs -r docker rm + +# Remove all volumes (to avoid cert generation issues) +printf " \n${YELLOW}removing all volumes${NC}\n" +docker volume ls -qf dangling=true | xargs -r docker volume rm + +# Remove all images +printf " \n${YELLOW}removing all images${NC}\n" +docker images -a -q | xargs -r docker rmi + +# and finally, cleanup Docker +printf " \n${YELLOW}finally cleanup Docker${NC}\n" +docker system prune -f + +# Clone the repository and its submodules +printf " \n${YELLOW}cloning oih-ui-docker to $installDir${NC}\n" +git clone --recurse-submodules git@github.com:iodepo/oih-ui-docker.git $installDir + +# Navigate to the project directory +cd $installDir + +# Fetch the latest changes and check out the 'release' branch +printf " \n${YELLOW}fetching and checking out the 'release' branch${NC}\n" +git fetch +git checkout release + +# Navigate to the 'frontend' directory, fetch the latest changes, and check out the 'feature/restyling' branch +printf " \n${YELLOW}navigating to 'frontend' directory and fetching and checking out the 'feature/restyling' branch${NC}\n" +cd $installDir/frontend +git fetch +git checkout feature/restyling + +# Return to the main directory and navigate to the 'api' directory, fetch the latest changes, and check out the 'feature/restyling' branch +printf " \n${YELLOW}navigating to 'api' directory and fetching and checking out the 'feature/restyling' branch${NC}\n" +cd $installDir/api +git fetch +git checkout feature/restyling + # Create the .env file in the project directory cd $installDir touch $installDir/.env @@ -135,6 +179,7 @@ else dockerComposeFile="docker-compose.workflow.yml" #copy the old file and add a date to the name + printf "make backup of ${YELLOW}letsencrypt_user_data.conf${NC}\n" cp $installDir/nginx/conf.d/letsencrypt_user_data.conf $installDir/nginx/conf.d/letsencrypt_user_data.conf_$(date +%Y%m%d%H%M%S) #add the correct lines for the SSL certificates @@ -145,6 +190,7 @@ else echo "LETSENCRYPT_workflow_HOST=('$workflowHost')" >> $installDir/nginx/conf.d/letsencrypt_user_data.conf #copy the old proxy file and add a date to the name + printf "make backup of ${YELLOW}proxy.conf${NC}\n" cp $installDir/nginx/conf.d/proxy.conf $installDir/nginx/conf.d/proxy.conf_$(date +%Y%m%d%H%M%S) #add the correct lines for the nginx proxy @@ -183,50 +229,6 @@ else fi -exit 0 - -# stop and remove old containers -printf " \n${YELLOW}stopping and removing old containers${NC}\n" -# stop running container(s) -docker ps -aq | xargs -r docker stop -# remove existing container(s) -docker ps -aq | xargs -r docker rm - -# Remove all volumes (to avoid cert generation issues) -printf " \n${YELLOW}removing all volumes${NC}\n" -docker volume ls -qf dangling=true | xargs -r docker volume rm - -# Remove all images -printf " \n${YELLOW}removing all images${NC}\n" -docker images -a -q | xargs -r docker rmi - -# and finally, cleanup Docker -printf " \n${YELLOW}finally cleanup Docker${NC}\n" -docker system prune -f - -# Clone the repository and its submodules -printf " \n${YELLOW}cloning oih-ui-docker to $installDir${NC}\n" -git clone --recurse-submodules git@github.com:iodepo/oih-ui-docker.git $installDir - -# Navigate to the project directory -cd $installDir - -# Fetch the latest changes and check out the 'release' branch -printf " \n${YELLOW}fetching and checking out the 'release' branch${NC}\n" -git fetch -git checkout release - -# Navigate to the 'frontend' directory, fetch the latest changes, and check out the 'feature/restyling' branch -printf " \n${YELLOW}navigating to 'frontend' directory and fetching and checking out the 'feature/restyling' branch${NC}\n" -cd $installDir/frontend -git fetch -git checkout feature/restyling - -# Return to the main directory and navigate to the 'api' directory, fetch the latest changes, and check out the 'feature/restyling' branch -printf " \n${YELLOW}navigating to 'api' directory and fetching and checking out the 'feature/restyling' branch${NC}\n" -cd $installDir/api -git fetch -git checkout feature/restyling # Copy Solr data to the target directory and change its permissions (change the root with the right one) printf " \n${YELLOW}copying Solr data to the target directory and changing its permissions${NC}\n"