-
Notifications
You must be signed in to change notification settings - Fork 0
/
deployment.sh
58 lines (47 loc) · 1.65 KB
/
deployment.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
#!/bin/bash
# script to download configuration files for the SysNDD Docker containers and
# compose the installation using docker-compose
# Written by: Bernt Popp
# Last updated on: 2022-05-10
## example usage: `bash deployment.sh config_archive_link`
# -------------------------------------------------------
# Set vars
config_archive_link=$1 # first command line argument: downloadable web adress with the config archive
display_usage() {
echo "A shell script to download configuration files for the SysNDD Docker containers and compose the installation using docker-compose."
echo -e "\nusage:\nsh bash deployment.sh config_archive_link"
}
run_script() {
# check if docker is running and
# if the GitHub folder exists
# if so change into that dir and compose down
# change folder back and remove sysndd fodler
if docker info > /dev/null 2>&1 && ls "sysndd/" > /dev/null 2>&1; then
cd sysndd/
docker-compose down
cd ..
rm -rf sysndd/
fi
# download link
wget --no-check-certificate "$config_archive_link" -O config.tar.gz
# extract archive and delete it afterwards
tar -xvzf config.tar.gz
rm config.tar.gz
# download the current repo from GitHub
git clone https://github.com/berntpopp/sysndd.git
# copy config files to GitHub folder structure
cp ./config/copy_files.sh ./
bash ./copy_files.sh
rm copy_files.sh
# cd to sysndd GitHub folder and start the docker compose script
cd sysndd/
bash ./docker-compose.sh
}
# if no arguments supplied, display usage
if [ $# -eq 0 ]
then
display_usage
exit 1
else
run_script
fi