Blame view

docker/PYROS_DOCKER_UPDATE 1.58 KB
e64cdd09   ALEXIS-PC\alexis   improving check a...
1
#!/usr/bin/env bash
e1e75163   Alexis Koralewski   fixing issue with...
2

a56e6e0e   Etienne Pallier   comments and shor...
3
# PRE-CONDITION : pyros container must be running
0a1f1d83   Alexis Koralewski   Add file checking...
4
root_folder=$(pwd 2>&1)
7407f600   Etienne Pallier   petites ameliorat...
5
# If no container is running Start it
e1d22a59   Alexis Koralewski   Change redis cont...
6
if ! [ $(docker ps | grep 'pyros' | wc -l) -eq 4 ]
e1e75163   Alexis Koralewski   fixing issue with...
7
then
ec4214ff   Alexis Koralewski   Renaming pyros co...
8
    echo "pyros-db or pyros weren't running, starting them..."
b1e4e4dd   Etienne Pallier   Renamed scripts P...
9
    ./PYROS_DOCKER_START
2da110b4   Etienne Pallier   fix call to START...
10
    #./PYROS_DOCKER_START.bat
e1e75163   Alexis Koralewski   fixing issue with...
11
fi
f11ebe06   Etienne Pallier   Dockerfile cleanu...
12

7407f600   Etienne Pallier   petites ameliorat...
13
# 1) Update Guitastro
f11ebe06   Etienne Pallier   Dockerfile cleanu...
14
echo "Updating Guitastro source code"
0a1f1d83   Alexis Koralewski   Add file checking...
15
16
17
18
19
20
21
22
23
24
25
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
7407f600   Etienne Pallier   petites ameliorat...
26
27

# 2) Update PyROS
0a1f1d83   Alexis Koralewski   Add file checking...
28
cd $root_folder
f11ebe06   Etienne Pallier   Dockerfile cleanu...
29
echo "Updating PyROS source code"
0a1f1d83   Alexis Koralewski   Add file checking...
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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

f11ebe06   Etienne Pallier   Dockerfile cleanu...
44

a56e6e0e   Etienne Pallier   comments and shor...
45
46
47
48
49
50
# 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
3be8b2fc   Alexis Koralewski   Add git pull of o...
51
52
done

7407f600   Etienne Pallier   petites ameliorat...
53
# 3) pyros.py update => update BD + doc + Guitastro requirements
1b11a72f   Alexis Koralewski   Update docker scr...
54
docker compose exec pyros python3 pyros.py update
e1e75163   Alexis Koralewski   fixing issue with...