forked from governify/falcon-infrastructure
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setupAdvanced.sh
executable file
·142 lines (133 loc) · 5.65 KB
/
setupAdvanced.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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
#!/bin/bash
source utils/menu.sh
MENU1=true
# Menu 1 - Welcome
while [ $MENU1 = true ]
do
clear
# Menu 1 - Header and options
declare -a menu1Options=("Configure and deploy the system" "About" "Quit setup" );
generateDialog "options" "Falcon Setup Menu" "${menu1Options[@]}"
# Reader
echo -n "Select an option please: "
read choice1
if [ $choice1 = 1 ]
then
MENU2=true
# Menu 2 - Installation
while [ $MENU2 = true ]
do
clear
# Menu 2 - Header and options
declare -a menu2Options=("(Optional) Docker and Docker Compose installation" "Enviroment variables setup" "(Optional) Automatic DNS records generation (DynaHosting)" "System deployment" "(Optional) Lets-encrypt automatic certificates generation" "Go back" );
generateDialog "options" "Deployment Menu - Follow steps in order. You can skip optional ones and do them by yourself if needed." "${menu2Options[@]}"
# Reader
echo -n "Select an option please: "
read choice2
if [ $choice2 = 1 ]
then
clear
declare -a menu6Options=("Amazon Web Services (AWS / yum)" "Other platform (apt)" "Go back");
generateDialog "options" "Prerequisites installation may vary depending on the platform" "${menu6Options[@]}"
# Reader
echo -n "Select an option please: "
read choice6
if [ $choice6 = 1 ]
then
./utils/preparation.sh 1
# Stop
echo -n "Press enter to continue."
read nothing
elif [ $choice6 = 2 ]
then
./utils/preparation.sh 0
# Stop
echo -n "Press enter to continue."
read nothing
else
echo ''
fi
elif [ $choice2 = 2 ]
then
nano .env
elif [ $choice2 = 3 ]
then
# Read input
echo -n "Please, enter your DynaHosting username: "
read dynaHostingUsername
echo -n "Please, enter your DynaHosting password: "
read -s dynaHostingPassword
echo ""
# Execute script
./utils/createDNS.sh ${dynaHostingUsername} ${dynaHostingPassword}
# Stop
echo -n "Press enter to continue."
read nothing
elif [ $choice2 = 4 ]
then
clear
declare -a menu3Options=("I want to use the Nginx. There is no running reverse proxy in this system. Continue with the deployment" "Do not use it. I want to comment/remove the container from docker-compose.yaml (edit it here)" "I have already modified the docker-compose file. Continue with the deployment" "Go back" );
generateDialog "options" "Deploying the system will instantiate an Nginx to use it as a reverse proxy." "${menu3Options[@]}"
# Reader
echo -n "Select an option please: "
read choice3
if [ $choice3 = 2 ]
then
nano ./docker-compose.yaml
./utils/deploy.sh
# Stop
echo -n "Press enter to continue."
read nothing
elif [ $choice3 = 4 ]
then
echo ''
else
./utils/deploy.sh
# Stop
echo -n "Press enter to continue."
read nothing
fi
elif [ $choice2 = 5 ]
then
clear
echo "-------------------------------------------------------------------------------------------"
echo "Init Letsencrypt helps you by generating free SSL certificates automatically."
echo "It is possible that your new DNS records are not updated yet in the different DNS servers."
echo "It is highly recommended to use this tool in staging mode until it succedes to make sure it will work and not being temporally banned by it."
echo "- On failure, you should wait a bit for the dns to update and keep trying."
echo "- On success, you can go ahead and not use the staging option as it should work."
echo "-------------------------------------------------------------------------------------------"
echo -n "Do you want to use the staging option? (y/N) "
read choice4
if [ $choice4 = "y" ] || [ $choice4 = "Y" ]
then
./utils/init-letsencrypt.sh 1
# Stop
echo -n "Press enter to continue."
read nothing
else
./utils/init-letsencrypt.sh 0
# Stop
echo -n "Press enter to continue."
read nothing
fi
elif [ $choice2 = 6 ]
then
MENU2=false
fi
done
elif [ $choice1 = 2 ]
then
clear
echo ""
echo "Falcon ecosystem based in Governify (https://github.com/governify). Developed by ISA Group (https://www.isa.us.es). "
# Stop
echo -n "Press enter to continue."
read nothing
elif [ $choice1 = 3 ]
then
MENU1=false
fi
done
# Do something after getting their choice
clear