-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
81 lines (68 loc) · 2.89 KB
/
Makefile
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
# A makefile to manage edgebox via multipass
ifndef log
override log = v
endif
ifndef hostname
override hostname = edgebox
endif
ifndef cpus
override cpus = 2
endif
ifndef memory
override memory = 4G
endif
ifndef storage
override storage = 50G
endif
ifndef system-pw
override system-pw = pw
endif
install:
@echo
@echo "🚀 You're about to install Edgebox VM '$(hostname)' with $(cpus) vCPUs, $(memory) Memory, $(storage) Storage"
@echo "⌛ Installation starting in 10 seconds. Press Ctrl+C to cancel."
@echo
@sleep 10
@echo "This installation will take a few minutes. Please be patient 🙏"
@echo
@echo "-> 👇 Downloading installation script..."
@curl -L install.edgebox.io -o /tmp/install_edgebox.sh
@echo "-> 🆕 Launching new virtual machine..."
@multipass launch 22.04 -n $(hostname) -c $(cpus) -m $(memory) -d $(storage) -$(log)
@multipass transfer /tmp/install_edgebox.sh $(hostname):/home/ubuntu/install_edgebox.sh
@multipass exec $(hostname) -- sudo bash /home/ubuntu/install_edgebox.sh --system-password $(system-pw) --skip-prompt
@rm ./tmp/install_edgebox.sh || true
@echo "System Successfully Installed. Access it via 'http://$(hostname).local' (web) or by running 'make shell $(hostname)' (ssh)"
install-cloud:
@echo "-> ✅ Checking cluster availability..."
./scripts/cluster_availability_check.sh $(hostname) $(cluster) $(cluster_ip) $(cluster_ssh_port)
@echo "-> 👇 Downloading installation script..."
@curl -L install.edgebox.io -o ./scripts/install_edgebox.sh
@echo "-> 🆕 Launching new virtual machine..."
@multipass launch 22.04 -n $(hostname) -c $(cpus) -m $(memory) -d $(storage) -$(log)
@multipass transfer ./scripts/install_edgebox.sh $(hostname):/home/ubuntu/install_edgebox.sh
@echo "-> ☁️ Setting up cloud environment..."
./scripts/setup_cloud_env.sh $(hostname) $(cluster) $(cluster_ip) $(cluster_ssh_port)
@multipass exec $(hostname) -- sudo bash /home/ubuntu/install_edgebox.sh --system-password $(system-pw) --cluster-host $(hostname).$(cluster) --skip-prompt
rm ./scripts/cloud.env || true
@echo "-> 🛠️ Rebuilding proxy configuration..."
python3 ./scripts/rebuild_proxies.py
@echo "System Successfully Installed. Access it via 'http://$(hostname).$(cluster)' (web) or by running 'make shell $(hostname)' (ssh)"
uninstall:
@echo "🚨 You're about to uninstall Edgebox VM '$(hostname)'. This will delete all data."
@echo "⌛ Uninstallation starting in 5 seconds. Press Ctrl+C to cancel."
@echo
@sleep 5
@echo "-> 🗑️ Deleting Edgebox VM '$(hostname)'..."
@multipass delete $(hostname)
@multipass purge
@echo "-> 🗑️ Deleting VM from known_hosts '$(hostname)'..."
ssh-keygen -R $(hostname).local
start:
@multipass start $(hostname)
@echo "System Started. Access it via 'http://$(hostname).local' (web) or by running 'make shell' (ssh)"
stop:
@multipass stop $(hostname)
restart: stop start
shell:
ssh -oStrictHostKeyChecking=no root@$(hostname).local