-
Notifications
You must be signed in to change notification settings - Fork 3
/
menu.sh
128 lines (118 loc) · 3.6 KB
/
menu.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
#!/bin/bash
# Function to display the menu
display_menu() {
clear
echo "=============================="
echo " MENU OPTIONS "
echo "=============================="
echo "1. Install Docker and Docker-compose"
echo "2. Install Caddy-Docker-Proxy from lucaslorentz"
echo "3. Install Portainer CE, Portainer Agent, Wireguard VPN, Uptime Kuma"
echo "4. "
echo "5. "
echo "6. Install Portainer Agent"
echo "7. Nothing yet"
echo "q. Quit"
echo "=============================="
echo
echo "Enter your choice (1-7) or 'q' to quit:"
}
# Function to handle option 1
handle_option1() {
echo "Installing Docker and Docker Compose using convenience script..."
curl -fsSL https://get.docker.com | bash
echo "Check if Docker & Docker-Compose is installed"
sudo usermod -aG docker $(whoami)
docker --version && docker compose version
sudo chmod 666 /var/run/docker.sock
sudo gpasswd -a $USER docker
echo "Test docker run hello-world"
docker run hello-world
echo "You can run docker in rootless mode from now"
}
# Function to handle option 2
handle_option2() {
echo "Installing Caddy-Docker-Proxy from lucaslorentz... "
echo "Cloning hophamlam/initial-ubuntu repo"
git -C ~/initial-ubuntu pull || git clone https://github.com/hophamlam/initial-ubuntu.git ~/initial-ubuntu
cd ~/initial-ubuntu/docker
docker network create caddy
nano ./docker-compose.caddy.yml && docker compose -f ./docker-compose.caddy.yml up -d
# echo "Modifing domains for reverse proxy"
# cp .env.sample .env
# nano .env
read -p "Press enter to continue"
cd ~/initial-ubuntu
}
# Function to handle option 3
handle_option3() {
echo "Installing Portainer CE, Portainer Agent, Wireguard VPN, Uptime Kuma"
git -C ~/initial-ubuntu pull || git clone https://github.com/hophamlam/initial-ubuntu.git ~/initial-ubuntu
cd ~/initial-ubuntu/docker &&
docker volume create portainer_data &&
docker volume create uptimekuma_data
nano ./docker-compose.portainer.yml && nano ./docker-compose.wgeasy.yml && nano ./docker-compose.uptimekuma.yml &&
echo "Installing Portainer CE, wg-easy, Uptime kuma"
docker compose -f ./docker-compose.portainer.yml -f ./docker-compose.uptimekuma.yml -f ./docker-compose.wgeasy.yml up -d &&
echo "Installing Portainer Agent"
docker run -d -p 9001:9001 --name portainer_agent --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/docker/volumes:/var/lib/docker/volumes portainer/agent:latest &&
cd ~/initial-ubuntu
read -p "Press enter to continue"
}
# Function to handle option 4
handle_option4() {
echo "Kill Caddy-Portainer-WG stack... "
read -p "Press enter to continue"
}
# Function to handle option 5
handle_option5() {
echo "Update Caddyfile"
read -p "Press enter to continue"
}
# Function to handle option 6
handle_option6() {
echo "Install Portainer Agent"
sudo docker run -d -p 9001:9001 --name portainer_agent --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/docker/volumes:/var/lib/docker/volumes portainer/agent:latest
read -p "Press enter to continue"
}
# Function to handle option 7
handle_option7() {
echo "Nothing yet"
read -p "Press enter to continue"
}
# Main script logic
while true; do
display_menu
read -r choice
case $choice in
1)
handle_option1
;;
2)
handle_option2
;;
3)
handle_option3
;;
4)
handle_option4
;;
5)
handle_option5
;;
6)
handle_option6
;;
7)
handle_option7
;;
q | Q)
echo "Exiting..."
exit 0
;;
*)
echo "Invalid choice. Please try again."
read -p "Press enter to continue"
;;
esac
done