-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall
More file actions
executable file
·128 lines (110 loc) · 2.63 KB
/
install
File metadata and controls
executable file
·128 lines (110 loc) · 2.63 KB
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#!/usr/bin/bash
set -e
echo "Installing Drumee from Debian Packages"
script_dir=$(dirname $(readlink -f $0))
worker=$(basename $0)
env_file=$script_dir/drumee.sh
for arg in "$@"; do
case $arg in
--env-file=*)
env_file="${arg#*=}"
shift
;;
--env=*)
env_file="${arg#*=}"
shift
;;
esac
done
if [ "$worker" = "reinstall" ]; then
export FORCE_INSTALL=yes
for p in drumee-ui-pod drumee-server-pod drumee-schemas drumee-infra; do
apt purge -y $p
done
fi
if [ -f $env_file ]; then
source $env_file
else
echo Env file $env_file was not found
exit 1
fi
#
fail() {
echo $1 was set to invalid value \($2\)
exit 1
}
use() {
echo Will use $1=$2v
}
miss() {
v=$(eval echo '$'$1)
echo Direcory $v \($1\) was not found.
echo Please ensure you have created proper all required directories
exit 1
}
check() {
v=$(eval echo '$'$1)
if [[ "$v" =~ $2 ]]; then
use $1 $v
else
fail $1 $v
fi
}
check_dir(){
v=$(eval echo '$'$1)
if [[ "$v" =~ ^(/+(usr|bin|sys|proc|tmp|etc|lib.*|boot|dev|sbin|opt|media|mnt|vmlinuz.*|lost.+|snap|root|run|initrd.*)/)|/+$ ]]; then
echo It is not safe to install $1 under directory $v
exit 1
fi
is_path="^(/.+)(/.+)*$"
if [ -d "$v" ]; then
check $1 $is_path
else
miss $1
fi
}
is_email="^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$"
check PUBLIC_IP4 "^([0-9]{1,3})(\.[0-9]{1,3}){3}$"
if [ "$PUBLIC_IP6" = "" ]; then
echo No IP, skipped.
else
check PUBLIC_IP6 "^([[:xdigit:]]{1,4})(:[[:xdigit:]]{0,4})*$"
fi
check DRUMEE_DOMAIN_NAME "^([a-zA-Z0-9_\-]+)(\.[a-zA-Z0-9_\-]+){1,}$"
check ADMIN_EMAIL $is_email
if [ "$ACME_EMAIL_ACCOUNT" = "" ]; then
export ACME_EMAIL_ACCOUNT=$ADMIN_EMAIL
else
check ACME_EMAIL_ACCOUNT $is_email
fi
if [ "$DRUMEE_DB_DIR" = "" ]; then
export DRUMEE_DB_DIR=/srv/db
mkdir -p $DRUMEE_DB_DIR
fi
if [ "$DRUMEE_DATA_DIR" = "" ]; then
export DRUMEE_DATA_DIR=/data
mkdir -p $DRUMEE_DATA_DIR
fi
check_dir DRUMEE_DB_DIR
check_dir DRUMEE_DATA_DIR
if [ "$STORAGE_BACKUP" != "" ]; then
check_dir STORAGE_BACKUP
else
echo ************************ WARNING *****************************
echo * You didn\'t specify a backup storage locatiion *
echo * in case of failure, you may lost partly or all of you data *
echo **************************************************************
fi
export INFRA_COMPONENTS=all
if [ "$DRUMEE_REPO" = "" ]; then
export DRUMEE_REPO=app.drumee.com
fi
$script_dir/bin/install-packages
echo Dependencies installed
echo Starting Drumee installation
sleep 2
if [ -x /usr/bin/nsupdate ]; then
$script_dir/bin/install-drumee
else
echo DNS utils nsupdate is missing. Abborted
fi