-
Notifications
You must be signed in to change notification settings - Fork 0
/
start-services.sh
executable file
·34 lines (30 loc) · 1.04 KB
/
start-services.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
#!/bin/sh
BOOT_WAIT_TIME=10
usage="$(basename "$0") [-d] [-e] -- Start Certbot, Nginx reverse proxy and App.\nRequired parameters:\n -d CN\n -e email"
while getopts d:e:h flag
do
case "${flag}" in
d) DOMAIN=${OPTARG};;
e) EMAIL=${OPTARG};;
h) echo "$usage"
exit;;
esac
done
if [ -z ${DOMAIN+x} ]; then echo "Error: missing domain parameter (-d)\n"; exit -1; fi
if [ -z ${EMAIL+x} ]; then echo "Error: missing email parameter (-e)\n"; exit -1; fi
echo "DOMAIN=$DOMAIN\nEMAIL=$EMAIL" > .env
echo "Creating container to run git clone"
docker build -t gitclone gitclone >/dev/null 2>&1
if [ "$?" -eq 0 ]; then
docker run -v ./gitclone/apps:/apps:rw -v ./gitclone:/scripts:rw gitclone -e DOMAIN=$DOMAIN -e EMAIL=$EMAIL
fi
if [ "$?" -eq 0 ];
then
echo "Starting services"
docker compose up --build -d
echo "Waiting $BOOT_WAIT_TIME seconds for services to boot before initiating e2e tests..."
sleep $BOOT_WAIT_TIME
./e2e-tests.sh -d $DOMAIN
else
echo "Error - could not clone linux_tweet_app"
fi