From c240b1cc752916bf967035d96c3aceddcdd61326 Mon Sep 17 00:00:00 2001 From: adjoly Date: Wed, 17 Dec 2025 15:25:29 +0100 Subject: [PATCH 1/4] =?UTF-8?q?=E3=80=8C=E2=9C=A8=E3=80=8D=20feat(p2):=20s?= =?UTF-8?q?uccessfully=20migrated=20to=20alpine?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- p2/Vagrantfile | 8 ++++---- p2/scripts/setup-S.sh | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/p2/Vagrantfile b/p2/Vagrantfile index c6eb468..dae13cd 100644 --- a/p2/Vagrantfile +++ b/p2/Vagrantfile @@ -23,17 +23,17 @@ end # • Be able to connect with SSH on both machines with no password. Vagrant.configure("2") do |config| - config.vagrant.plugins = [] + config.vm.box = "generic/alpine319" - config.vm.box = "debian/bookworm64" config.vm.provider "#{IOT_PROVIDER}" do |provider| - provider.cpus = 1 - provider.memory = 1024 + provider.cpus = 4 + provider.memory = 4096 end config.vm.define "#{IOT_LOGIN}S" do |server| server.vm.hostname = "#{IOT_LOGIN}S" server.vm.network "private_network", ip: "192.168.56.110", auto_config: true + server.vm.synced_folder ".", "/vagrant" server.vm.provision "shell", path: "scripts/setup-S.sh" server.vm.provision "shell", path: "scripts/deploy-apps.sh" diff --git a/p2/scripts/setup-S.sh b/p2/scripts/setup-S.sh index 5d92d9a..66af90a 100644 --- a/p2/scripts/setup-S.sh +++ b/p2/scripts/setup-S.sh @@ -1,7 +1,7 @@ #!/usr/bin/env sh -sudo apt update -sudo apt install curl -y - echo "Launching k3s install" curl -sfL https://get.k3s.io | sh -s - server --cluster-init --node-ip=192.168.56.110 + +echo Waiting +sleep 15 From 36e42e275b538f7f80fa7662f9bad3ba7c0407fd Mon Sep 17 00:00:00 2001 From: adjoly Date: Wed, 17 Dec 2025 16:15:04 +0100 Subject: [PATCH 2/4] =?UTF-8?q?=E3=80=8C=F0=9F=94=A8=E3=80=8D=20fix(script?= =?UTF-8?q?s):=20removed=20useless=20sleep=20and=20replace=20them=20with?= =?UTF-8?q?=20wait?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- p1/scripts/setup-S.sh | 14 ++++++++++++-- p1/scripts/setup-SW.sh | 20 ++++++++++---------- p2/scripts/setup-S.sh | 21 +++++++++++++++++---- 3 files changed, 39 insertions(+), 16 deletions(-) diff --git a/p1/scripts/setup-S.sh b/p1/scripts/setup-S.sh index 12f3d81..28c1638 100644 --- a/p1/scripts/setup-S.sh +++ b/p1/scripts/setup-S.sh @@ -6,8 +6,18 @@ echo "Launching k3s install" curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC="--write-kubeconfig-mode 644" sh -s - server --cluster-init --node-ip=$S_ADDR --bind-address=$S_ADDR --advertise-address=$S_ADDR # Additional wait to ensure API is responsive (optional but helpful) -echo Waiting -sleep 15 +I=0 +until k3s kubectl get --raw='/readyz' > /dev/null 2>&1; do + echo "Waiting for K3s to be ready..." + sleep 5 + I=$((I+1)) + if [ $I -eq 5 ]; then + echo "threshold gone, ffs" + exit 1 + fi +done + +echo "K3s is ready!" echo "Copying token" cat /var/lib/rancher/k3s/server/node-token > /vagrant/node-token diff --git a/p1/scripts/setup-SW.sh b/p1/scripts/setup-SW.sh index 21108d7..c74680d 100644 --- a/p1/scripts/setup-SW.sh +++ b/p1/scripts/setup-SW.sh @@ -4,16 +4,16 @@ S_ADDR="192.168.56.110" SW_ADDR="192.168.56.111" # In setup-SW.sh, before the k3s install command -# echo "Checking connectivity to server" -# I=0 -# while ! curl -k https://$S_ADDR:6443/healthz > /dev/null 2>&1; do -# echo "Server API not reachable yet, waiting..." -# sleep 5 -# I=$((I+1)) -# if [ $I -eq 5 ]; then -# exit 1 -# fi -# done +echo "Checking connectivity to server" +I=0 +while ! curl -k https://$S_ADDR:6443/readyz > /dev/null 2>&1; do + echo "Server API not reachable yet, waiting..." + sleep 5 + I=$((I+1)) + if [ $I -eq 5 ]; then + exit 1 + fi +done echo "Server is reachable, proceeding with k3s agent install" echo "Waiting for token" diff --git a/p2/scripts/setup-S.sh b/p2/scripts/setup-S.sh index 66af90a..470bba1 100644 --- a/p2/scripts/setup-S.sh +++ b/p2/scripts/setup-S.sh @@ -1,7 +1,20 @@ #!/usr/bin/env sh -echo "Launching k3s install" -curl -sfL https://get.k3s.io | sh -s - server --cluster-init --node-ip=192.168.56.110 +S_ADDR="192.168.56.110" -echo Waiting -sleep 15 +echo "Launching k3s install" +curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC="--write-kubeconfig-mode 644" sh -s - server --cluster-init --node-ip=$S_ADDR --bind-address=$S_ADDR --advertise-address=$S_ADDR + +# Wait for K3s to be ready +I=0 +until k3s kubectl get --raw='/healthz' > /dev/null 2>&1; do + echo "Waiting for K3s to be ready..." + sleep 5 + I=$((I+1)) + if [ $I -eq 5 ]; then + echo "threshold gone, ffs" + exit 1 + fi +done + +echo "K3s is ready!" From 893b53f7d1e6d2d17d1c3f75b63b7472c7355f77 Mon Sep 17 00:00:00 2001 From: adjoly Date: Wed, 17 Dec 2025 16:37:49 +0100 Subject: [PATCH 3/4] =?UTF-8?q?=E3=80=8C=F0=9F=97=91=EF=B8=8F=E3=80=8D=20c?= =?UTF-8?q?lean:=20reverted=20change=20about=20cpu=20and=20ram=20usage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- p2/Vagrantfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/p2/Vagrantfile b/p2/Vagrantfile index dae13cd..26b75b6 100644 --- a/p2/Vagrantfile +++ b/p2/Vagrantfile @@ -26,8 +26,8 @@ Vagrant.configure("2") do |config| config.vm.box = "generic/alpine319" config.vm.provider "#{IOT_PROVIDER}" do |provider| - provider.cpus = 4 - provider.memory = 4096 + provider.cpus = 1 + provider.memory = 1024 end config.vm.define "#{IOT_LOGIN}S" do |server| From 2e341766a2efd801e6947e56f0834d4956ce915a Mon Sep 17 00:00:00 2001 From: adjoly Date: Wed, 17 Dec 2025 16:38:59 +0100 Subject: [PATCH 4/4] =?UTF-8?q?=E3=80=8C=F0=9F=97=91=EF=B8=8F=E3=80=8D=20c?= =?UTF-8?q?lean:=20removed=20useless=20comment?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- p2/Vagrantfile | 9 --------- 1 file changed, 9 deletions(-) diff --git a/p2/Vagrantfile b/p2/Vagrantfile index 26b75b6..d2ef1ae 100644 --- a/p2/Vagrantfile +++ b/p2/Vagrantfile @@ -13,15 +13,6 @@ if XDG_RUNTIME_DIR == "unknown" raise "XDG_RUNTIME_DIR is not set" end -# Here are the expected specifications: -# • The machine names must be the login of someone of your team. The hostname -# of the first machine must be followed by the capital letter S (like Server). The -# hostname of the second machine must be followed by SW (like ServerWorker). -# • Have a dedicated IP on the eth1 interface. The IP of the first machine (Server) -# will be 192.168.56.110, and the IP of the second machine (ServerWorker) will be -# 192.168.56.111. -# • Be able to connect with SSH on both machines with no password. - Vagrant.configure("2") do |config| config.vm.box = "generic/alpine319"