mirror of
https://codeberg.org/27/inception-of-things.git
synced 2025-10-13 18:44:45 +02:00
「🏗️」 wip(p2): working Vagrantfile
This commit is contained in:
41
p2/Vagrantfile
vendored
41
p2/Vagrantfile
vendored
@ -0,0 +1,41 @@
|
||||
#sudo systemctl stop firewalld -*- mode: ruby -*-
|
||||
#
|
||||
# vi: set ft=ruby :
|
||||
|
||||
def environ(key, default)
|
||||
ENV[key] || default
|
||||
end
|
||||
|
||||
IOT_LOGIN = environ("USER", "kanel")
|
||||
IOT_PROVIDER = environ("IOT_PROVIDER", "virtualbox")
|
||||
XDG_RUNTIME_DIR = environ("XDG_RUNTIME_DIR", "unknown")
|
||||
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.vagrant.plugins = []
|
||||
|
||||
config.vm.box = "debian/bookworm64"
|
||||
config.vm.provider "#{IOT_PROVIDER}" do |provider|
|
||||
provider.cpus = 1
|
||||
provider.memory = 1024
|
||||
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.provision "shell", path: "setup-S.sh"
|
||||
server.vm.provision "shell", path: "setup-hostfile.sh"
|
||||
end
|
||||
end
|
||||
|
2
p2/install-all.sh
Normal file
2
p2/install-all.sh
Normal file
@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env sh
|
||||
|
7
p2/setup-S.sh
Normal file
7
p2/setup-S.sh
Normal file
@ -0,0 +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
|
3
p2/setup-hostfile.sh
Normal file
3
p2/setup-hostfile.sh
Normal file
@ -0,0 +1,3 @@
|
||||
echo "192.168.56.110 app1.com" | sudo tee -a "/etc/hosts"
|
||||
echo "192.168.56.110 app2.com" | sudo tee -a "/etc/hosts"
|
||||
echo "192.168.56.110 app3.com" | sudo tee -a "/etc/hosts"
|
Reference in New Issue
Block a user