PYROS_DOCKER_UPDATE
1.58 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
#!/usr/bin/env bash
# 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
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"
cd ../vendor/guitastro/
gitpull_output=$(git pull 2>&1)
echo $gitpull_output
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
# 2) Update PyROS
cd $root_folder
echo "Updating PyROS source code"
gitpull_output=$(git pull 2>&1)
echo $gitpull_output
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
# 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
if [ -d .git ] ; then
echo "Updating observatory $dir source code"
git pull
fi
done
# 3) pyros.py update => update BD + doc + Guitastro requirements
docker compose exec pyros python3 pyros.py update