-
Notifications
You must be signed in to change notification settings - Fork 6
/
init-env-full.sh
executable file
·39 lines (32 loc) · 1.22 KB
/
init-env-full.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
#!/bin/bash
BASEDIR=$(dirname "$0")
source "$BASEDIR"/shell/color-shell.sh
IMPORT_SLEEP_TIME=30
REGION="$1"
FRONTEND_MIRROR=""
if [[ "$REGION" != "" ]]; then
FRONTEND_MIRROR=".$REGION"
fi
FRONTEND_SHELL="shell/download-latest-frontend$FRONTEND_MIRROR.sh"
chmod +x $FRONTEND_SHELL
bash shell/full-env.sh && \
cp etc/backend/config.sample.json etc/backend/config.json && \
cp judge/etc/config.sample.json judge/etc/config.json && \
bash $FRONTEND_SHELL && \
docker-compose up -d mysql && \
echo -e "${BGreen}Container started. Sleep ${IMPORT_SLEEP_TIME} seconds.${Color_Off}" && \
sleep $IMPORT_SLEEP_TIME && \
echo -e "${BRed}Import SQL structure... this operation will erase your data." && \
docker-compose exec -T mysql mysql "-uroot" "-proot" < "./sql/structure.sql" && \
echo -e "${BWhite}Imported. Sleep 3 seconds.${Color_Off}" && \
sleep 3 && \
echo -e "${BGreen}Recreate container and start all services." && \
bash shell/recreate-container.sh && \
echo -e "${BWhite}Init system complete."
echo -e "Please access to server from:"
echo -e "${BGreen}"
for i in $(ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1')
do
echo -e "http://$i:8080"
done
echo -e "${Color_Off}";