-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathinstall_centos7.sh
87 lines (74 loc) · 2.75 KB
/
install_centos7.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
#!/bin/bash
# The commands in this script are meant to be ran by root. Docker-Compose cannot run as a sudo user.
# Install EPEL Repo
sudo yum -y install epel-release
# Install Ansible and Git
sudo yum -y install ansible git
# Clone Repo
sudo git clone https://github.com/gabotronix/underpass.git /opt/underpass
# Install Ansible Roles
sudo ansible-galaxy install -r /opt/underpass/ansible/requirements.yml
# Run Ansible Playbook
cd /opt/underpass
sudo ansible-playbook install.yml
# Install Underpass
echo -e "===================================================="
echo -e "Installing Underpass Docker Apps"
echo -e "===================================================="
cd /opt/underpass
DockerNetwork=`sudo docker network ls | grep -c underpass`
if [ $DockerNetwork != 1 ]; then
sudo docker network create underpass --subnet 172.20.0.0/24
docker-compose up -d
else
docker-compose up -d
fi
# Enumerate Web UI's and Ports
UnderpassDir=`ls -l /opt | grep -c underpass`
WhichDockerCompose=`which docker-compose | grep -c /usr`
DockerPS=`sudo docker ps | grep -c mongodb`
function countdown { #https://www.cyberciti.biz/faq/how-to-display-countdown-timer-in-bash-shell-script-running-on-linuxunix/
local OLD_IFS="${IFS}"
IFS=":"
local ARR=( $1 )
local SECONDS=$(( (ARR[0] * 60 * 60) + (ARR[1] * 60) + ARR[2] ))
local START=$(date +%s)
local END=$((START + SECONDS))
local CUR=$START
while [[ $CUR -lt $END ]]
do
CUR=$(date +%s)
LEFT=$((END-CUR))
printf "\r%02d:%02d:%02d" \
$((LEFT/3600)) $(( (LEFT/60)%60)) $((LEFT%60))
sleep 1
done
IFS="${OLD_IFS}"
echo " "
}
function webpanels() {
PublicIP=$(curl -4 ifconfig.co 2>/dev/null)
echo -e "\n\n===================================================="
echo -e "Configure Your Underpass Web Panels:"
echo -e "===================================================="
echo -e "\nConfigure Portainer @ http://$PublicIP:9000\n"
echo -e "Configure Pritunl VPN @ https://$PublicIP:4433\n"
echo -e "View Server Load @ http://$PublicIP:19999\n"
echo -e "----------------------------------------------------\n"
echo -e "NOTE: Wireguard will not work unless the server is rebooted. Issue the command below to reboot your server:\n"
echo -e "reboot\n"
}
if [ $UnderpassDir != 1 ]; then
echo -e "Installation failed. Please run the installer again as root."
exit 1
elif [ $WhichDockerCompose != 1 ]; then
echo -e "Installation failed. Please run the installer again as root."
exit 1
elif [ $DockerPS != 1 ]; then
echo -e "Installation failed. Please run the installer again as root."
exit 1
else
echo -e "\n\nInitializing Containers..."
countdown "00:00:30"
webpanels
fi