-
Notifications
You must be signed in to change notification settings - Fork 10
/
update_resources.sh
104 lines (86 loc) · 2.98 KB
/
update_resources.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#!/usr/bin/env bash
# NB: local trial script has to be self-contained
# See https://sipb.mit.edu/doc/safe-shell/
set -euf -o pipefail
if [[ "$OSTYPE" == "linux-gnu" ]]; then
export MAYBE_SUDO="sudo"
else
export MAYBE_SUDO=""
fi
if [ -t 1 ]; then
export NORMAL="$(tput sgr0)"
export RED="$(tput setaf 1)"
export GREEN="$(tput setaf 2)"
export MAGENTA="$(tput setaf 5)"
export CYAN="$(tput setaf 6)"
export WHITE="$(tput setaf 7)"
export BOLD="$(tput bold)"
else
export NORMAL=""
export RED=""
export GREEN=""
export MAGENTA=""
export CYAN=""
export WHITE=""
export BOLD=""
fi
error_exit() {
echo ''
echo "${RED}${BOLD}ERROR${NORMAL}${BOLD}: $1${NORMAL}"
shift
while [ "$#" -gt "0" ]; do
echo " - $1"
shift
done
exit 1
}
log_step() {
echo ''
echo "${GREEN}${BOLD}INFO${NORMAL}${BOLD}: $1${NORMAL}"
shift
while [ "$#" -gt "0" ]; do
echo " - $1"
shift
done
}
log_warn() {
echo ''
echo "${CYAN}${BOLD}WARNING${NORMAL}${BOLD}: $1${NORMAL}"
shift
while [ "$#" -gt "0" ]; do
echo " - $1"
shift
done
}
log_step 'Downloading resources...'
LICENSE_URL_PATH='https://license.dronahq.com/self-hosted'
curl -L -fsSL -o get-docker.sh "$LICENSE_URL_PATH/master/get-docker.sh"
curl -L -fsSL -o get-docker-compose.sh "$LICENSE_URL_PATH/master/get-docker-compose.sh"
log_step 'Docker scripts downloaded'
curl -L -fsSL -o ./init/containerd.service "$LICENSE_URL_PATH/master/init/containerd.service"
curl -L -fsSL -o ./init/mongo-init.dump "$LICENSE_URL_PATH/master/init/mongo-init.dump"
curl -L -fsSL -o ./init/mongo-init.sh "$LICENSE_URL_PATH/master/init/mongo-init.sh"
curl -L -fsSL -o ./init/my.cnf "$LICENSE_URL_PATH/master/init/my.cnf"
curl -L -fsSL -o ./init/mysql-init.sql "$LICENSE_URL_PATH/master/init/mysql-init.sql"
curl -L -fsSL -o ./init/nginx-ssl-default.conf "$LICENSE_URL_PATH/master/init/nginx-ssl-default.conf"
curl -L -fsSL -o ./init/nginx.conf "$LICENSE_URL_PATH/master/init/nginx.conf"
log_step 'init scripts downloaded.'
curl -L -fsSL -o install_sh.sh "$LICENSE_URL_PATH/master/install_sh.sh"
curl -L -fsSL -o backup_sh.sh "$LICENSE_URL_PATH/master/backup_sh.sh"
curl -L -fsSL -o update_sh.sh "$LICENSE_URL_PATH/master/update_sh.sh"
log_step 'install/update scripts downloaded'
curl -L -fsSL -o update_resources.sh "$LICENSE_URL_PATH/master/update_resources.sh"
curl -L -fsSL -o container-reset.sh "$LICENSE_URL_PATH/master/container-reset.sh"
log_step "container reset scripts downloaded."
curl -L -fsSL -o dronahq_setup "$LICENSE_URL_PATH/master/dronahq_setup"
curl -L -fsSL -o setup.sh "$LICENSE_URL_PATH/master/setup.sh"
log_step 'setup scripts downloaded'
curl -L -fsSL -o certbot-docker-compose.yml "$LICENSE_URL_PATH/master/certbot-docker-compose.yml"
if [ ! -f ./docker-compose.yml ]; then
curl -L -fsSL -o docker-compose.yml "$LICENSE_URL_PATH/master/docker-compose.yml"
curl -L -fsSL -o version "$LICENSE_URL_PATH/master/version"
fi
if [ ! -f ./nginx.conf ]; then
cp init/nginx.conf nginx.conf
fi
log_step 'All resources updated !'