From ec1e5b33b2a5459dfea1aa81976ab9abdb5ee0f0 Mon Sep 17 00:00:00 2001 From: Etienne Pallier Date: Mon, 16 Oct 2023 11:15:52 +0200 Subject: [PATCH] bugfix PYROS_DOCKER_UPDATE and comments --- docker/PYROS_DOCKER_UPDATE | 57 ++++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 44 insertions(+), 13 deletions(-) diff --git a/docker/PYROS_DOCKER_UPDATE b/docker/PYROS_DOCKER_UPDATE index b297d4f..f99f8d9 100755 --- a/docker/PYROS_DOCKER_UPDATE +++ b/docker/PYROS_DOCKER_UPDATE @@ -1,20 +1,26 @@ #!/usr/bin/env bash +# In docker/ folder +#root_folder=$(pwd 2>&1) + # PRE-CONDITION : pyros container must be running -root_folder=$(pwd 2>&1) # If no container is running Start it -if ! [ $(docker ps | grep 'pyros' | wc -l) -eq 4 ] -then +if ! [ $(docker ps | grep 'pyros' | wc -l) -eq 4 ] ; then echo "pyros-db or pyros weren't running, starting them..." ./PYROS_DOCKER_START #./PYROS_DOCKER_START.bat fi -# 1) Update Guitastro -echo "Updating Guitastro source code" +# I - Update Guitastro +echo +echo "**********************************" +echo "I - Updating Guitastro source code" +echo "**********************************" +echo +# Go to GuitAstro/ folder cd ../vendor/guitastro/ -gitpull_output=$(git pull 2>&1) already_uptodate="Déjà à jour." +gitpull_output=$(git pull 2>&1) if [ $? -eq 1 ]; then if [[ "$gitpull_output"!="$already_uptodate" ]]; then echo "Git pull failed. Error message is:" @@ -23,6 +29,7 @@ if [ $? -eq 1 ]; then fi fi echo $gitpull_output +# Check if exists file changed that requires rebuild check_files=("docker-compose.yml" "Dockerfile" "install/requirements.in") for file in "${check_files[@]}" do @@ -31,10 +38,17 @@ do return 1 fi done +cd - > /dev/null -# 2) Update PyROS -cd $root_folder -echo "Updating PyROS source code" +# II - Update PyROS +#cd $root_folder +echo +echo "**********************************" +echo "II - Updating PyROS source code" +echo "**********************************" +echo +# Go to PYROS/ folder +cd ../ gitpull_output=$(git pull 2>&1) if [ $? -eq 1 ]; then if [[ "$gitpull_output"!="$already_uptodate" ]]; then @@ -44,6 +58,7 @@ if [ $? -eq 1 ]; then fi fi echo $gitpull_output +# Check if exists file changed that requires rebuild check_files=("docker-compose.yml" "Dockerfile" "install/requirements.in") for file in "${check_files[@]}" do @@ -52,19 +67,35 @@ do return 1 fi done +cd - > /dev/null + # TODO : test if git pull worked and if git pull changed dockerfile, requirements.in, docker-compose.yml # Tell user to rebuild -# 3) Update all observatories with git repo -for dir in ../../PYROS_OBSERVATORY/* ; do +# III - Update all observatories with git repo +echo +echo "**********************************" +echo "III - Updating PyROS Observatory(ies)" +echo "**********************************" +echo +# Go to PYROS observatories folder +cd ../../PYROS_OBSERVATORY/ +for dir in * ; do + cd $dir if [ -d .git ] ; then echo "Updating observatory $dir source code" git pull fi + cd ../ done +cd ../PYROS/docker/ -# 3) pyros.py update => update BD + doc + Guitastro requirements +# IV - pyros.py update => update BD + doc +echo +echo "**********************************" +echo "IV - Updating PyROS Doc & Database" +echo "**********************************" +echo docker compose exec pyros python3 pyros.py update - -- libgit2 0.21.2