-
Notifications
You must be signed in to change notification settings - Fork 9
/
install.sh
executable file
·72 lines (55 loc) · 2.13 KB
/
install.sh
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
#!/bin/bash
set -e
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
export VERS_MDK=2.3.10
export VERS_API=2.3.10
export VERS_WORKER=2.3.10
export VERS_UI=1.11.7
export VERS_PIWIND='stable/2.3.x'
export SERVER_IMG=coreoasis/api_server
export WORKER_IMG=coreoasis/model_worker
export GIT_PIWIND=OasisPiWind
MSG=$(cat <<-END
Do you want to reinstall?
Note: This will wipe uploaded exposure and run data from the local API.
END
)
# Check for prev install and offer to clean wipe
if [[ $(docker volume ls | grep OasisData -c) -gt 1 || -d $SCRIPT_DIR/$GIT_PIWIND ]]; then
while true; do read -r -n 1 -p "${MSG:-Continue?} [y/n]: " REPLY
case $REPLY in
[yY]) echo ; WIPE=1; break ;;
[nN]) echo ; WIPE=0; break ;;
*) printf " \033[31m %s \n\033[0m" "invalid input"
esac
done
if [[ "$WIPE" == 1 ]]; then
# stop oasisui_proxy if running
docker compose -f $SCRIPT_DIR/oasis-ui-proxy.yml down --remove-orphans
docker compose -f $SCRIPT_DIR/portainer.yaml down --remove-orphans
set +e
docker compose -f $SCRIPT_DIR/oasis-platform.yml -f $SCRIPT_DIR/oasis-ui-standalone.yml down --remove-orphans
set -e
printf "Deleting docker data: \n"
rm -rf $SCRIPT_DIR/$GIT_PIWIND
docker volume ls | grep OasisData | awk 'BEGIN { FS = "[ \t\n]+" }{ print $2 }' | xargs -r docker volume rm
else
echo "-- Reinstall aborted -- "
exit 1
fi
fi
# --- Clone PiWind ---------------------------------------------------------- #
mkdir -p $SCRIPT_DIR/$GIT_PIWIND
cd $SCRIPT_DIR/$GIT_PIWIND
git clone --depth 1 --branch $VERS_PIWIND https://github.com/OasisLMF/$GIT_PIWIND.git .
git checkout $VERS_PIWIND
# --- RUN Oasis Platform & UI ----------------------------------------------- #
cd $SCRIPT_DIR
set +e
docker pull ${WORKER_IMG}:${VERS_WORKER}
docker pull ${SERVER_IMG}:${VERS_API}
docker pull coreoasis/oasisui_app:$VERS_UI
set -e
# RUN OasisPlatform / OasisUI / Portainer
docker compose -f $SCRIPT_DIR/oasis-platform.yml -f $SCRIPT_DIR/oasis-ui-standalone.yml up -d --no-build
docker compose -f $SCRIPT_DIR/portainer.yaml up -d