PYROS_DOCKER_UPDATE
2.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/usr/bin/env bash
# In docker/ folder
#root_folder=$(pwd 2>&1)
# PRE-CONDITION : pyros container must be running
# If no container is running Start it
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
# I - Update Guitastro
echo
echo "**********************************"
echo "I - Updating Guitastro source code"
echo "**********************************"
echo
# Go to GuitAstro/ folder
cd ../vendor/guitastro/
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:"
echo $gitpull_output
exit 1
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
if grep -q "$file" <<< "$gitpull_output"; then
echo "WARNING : One of docker related files has been changed. You should build again the PyROS Image"
return 1
fi
done
cd - > /dev/null
# 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
echo "Git pull failed. Error message is:"
echo $gitpull_output
exit 1
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
if grep -q "$file" <<< "$gitpull_output"; then
echo "WARNING : One of docker related files has been changed. You should build again the PyROS Image"
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
# 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/
# 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