-
Notifications
You must be signed in to change notification settings - Fork 8
/
installRestService.sh
executable file
·43 lines (27 loc) · 1.18 KB
/
installRestService.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
#!/bin/bash
[ `whoami` = root ] || exec sudo su -c $0
mkdir -p /home/ubuntu/stacks
domaineName=$(echo $1 | cut --complement -d'.' -f 1)
apkey=$(tr -dc A-Za-z0-9 </dev/urandom | head -c 23)
echo $apkey
apkeyhash=$(htpasswd -nb -B admin $apkey | cut -d ":" -f 2)
echo "apkey for mananging stack via rest service "$apkeyhash
echo "For https://api."$domaineName" the apkey for mananging stack via rest service is "$apkeyhash " ">> /tmp/toSendInfoByMail
echo $apkeyhash > /root/OpenMVPBox/apiKey
localip=$(ip -4 addr show enp3s0 | grep -oP '(?<=inet\s)\d+(\.\d+){3}')
testEth1=$(ip a |grep eth1 | wc -l)
if (( testEth1 >= 1 )); then
localip=$(ip -4 addr show eth1 | grep -oP '(?<=inet\s)\d+(\.\d+){3}')
fi
testEnp3s0=$(ip a |grep enp3s0 | wc -l)
if (( testEnp3s0 >= 1 )); then
localip=$(ip -4 addr show enp3s0 | grep -oP '(?<=inet\s)\d+(\.\d+){3}')
fi
sed -i 's/yyy.yyy/api.'$domaineName'/g' traefik/conf/traefik_dynamic.toml
sed -i 's/@ip/'$localip'/g' traefik/conf/traefik_dynamic.toml
sed -i 's/@ip/'$localip'/g' omvpb.py
cp omvpb.py /home/ubuntu/stacks
cp omvpb-back.service /etc/systemd/system
systemctl daemon-reload
systemctl enable omvpb-back.service
systemctl start omvpb-back.service