forked from Open-EO/openeo-eodc-driver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
init_dbs.sh
22 lines (18 loc) · 811 Bytes
/
init_dbs.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash
check_container () {
echo "### Checking if container ${1} exists. ###"
if [ ! "$(docker ps -q -f name=${1})" ]; then
echo "Container ${1} exists."
echo "Checking container ${1} status"
if [ "$(docker ps -aq -f status=exited -f name=${1})" ]; then
echo "Container ${1} exited. Starting container"
docker run ${1}
fi
fi
}
# Init users database
check_container oeo-gateway-v1.0 && docker exec oeo-gateway-v1.0 /bin/sh -c "cd gateway/users; alembic upgrade head" && echo "### Done. ###"
# Init process graphs database
check_container oeo-processes-v1.0 && docker exec oeo-processes-v1.0 alembic upgrade head && echo "### Done. ###"
# Init job database
check_container oeo-jobs-v1.0 && docker exec oeo-jobs-v1.0 alembic upgrade head && echo "### Done. ###"