Compare commits

...

4 Commits

Author SHA1 Message Date
Starbeamrainbowlabs 36234baae7
Consul: start on config step, but there's much to still to do
continuous-integration/laminar-eldarion Build failed with exit code 123 after 3 seconds Details
2022-04-28 03:20:24 +01:00
Starbeamrainbowlabs 8b29c6f50b
chmod +x 2022-04-28 03:20:06 +01:00
Starbeamrainbowlabs 3eb80707cf
run.sh: add ask_multichoice 2022-04-28 03:19:32 +01:00
Starbeamrainbowlabs aa309ec60e
nfs: elete old job 2022-04-28 03:19:25 +01:00
6 changed files with 23 additions and 62 deletions

View File

@ -1,5 +0,0 @@
#!/usr/bin/env bash
if ! mountpoint -q /mnt/shared; then mount /mnt/shared; fi
if ! mountpoint -q /mnt/elfstone; then mount /mnt/elfstone; fi
if ! mountpoint -q /mnt/elessar-music; then mount /mnt/elessar-music; fi
if ! mountpoint -q /mnt/elessar-syncthing; then mount /mnt/elessar-syncthing; fi

View File

@ -1,46 +0,0 @@
#!/usr/bin/env bash
echo "[job/nfs] Checking NFS mounts" >&2;
# _netdev The filesystem resides on a device that requires network access (used to prevent the system from attempting to mount these filesystems until the network has been enabled on the system)
# nofail Do not report errors for this device if it does not exist.
# auto Auto-mount on boot
# noatime No last-access time
# tcp Use tcp, not udp
# bg The system won't block during boot until it is able to mount the filesystem, but won't give up on trying to mount it either.
# timeo=VALUE The time in deciseconds (tenths of a second) the NFS client waits for a response before it retries an NFS request.
# retrans=n The number of times the NFS client retries a request before it attempts further recovery action.
if [[ ! -d /mnt/shared ]]; then
echo "[job/nfs] Creating mount for shared cluster data" >&2;
sudo mkdir -p /mnt/shared;
echo 'magicbag.node.mooncarrot.space:/mnt/elfstone2/cluster /mnt/shared nfs auto,nofail,noatime,_netdev,tcp,bg,timeo=50,retrans=5 0 0' | sudo tee -a /etc/fstab;
sudo mount /mnt/shared;
fi
if [[ ! -d /mnt/elfstone ]]; then
echo "[job/nfs] Creating mount for elfstone" >&2;
sudo mkdir -p /mnt/elfstone;
echo 'magicbag.node.mooncarrot.space:/mnt/elfstone2/main /mnt/elfstone nfs auto,nofail,noatime,_netdev,tcp,bg,timeo=50,retrans=5 0 0' | sudo tee -a /etc/fstab;
sudo mount /mnt/elfstone;
fi
if [[ ! -d /mnt/elessar-music ]]; then
echo "[job/nfs] Creating mount for elessar-music" >&2;
sudo mkdir -p /mnt/elessar-music;
echo 'magicbag.node.mooncarrot.space:/mnt/elfstone2/syncthing/Music /mnt/elessar-music nfs auto,nofail,_netdev,noatime,tcp,bg,timeo=50,retrans=5 0 0' | sudo tee -a /etc/fstab;
sudo mount /mnt/elessar-music;
fi
if [[ ! -d /mnt/elessar-syncthing ]]; then
echo "[job/nfs] Creating mount for elessar-syncthing" >&2;
sudo mkdir -p /mnt/elessar-syncthing;
echo 'magicbag.node.mooncarrot.space:/mnt/elfstone2/syncthing /mnt/elessar-syncthing nfs auto,nofail,_netdev,noatime,tcp,bg,timeo=50,retrans=5 0 0' | sudo tee -a /etc/fstab;
sudo mount /mnt/elessar-syncthing;
fi
echo "[job/nfs] Complete" >&2;

View File

@ -1,11 +0,0 @@
#!/usr/bin/env bash
RUN "sudo apt-get update";
RUN "sudo apt-get install --yes nfs-common";
SCRIPT "${JOBFILE_DIR}/nfs-setup.sh"
COPY "${JOBFILE_DIR}/cluster-shared-nfs" "/tmp/cluster-shared-nfs";
RUN "sudo mv /tmp/cluster-shared-nfs /etc/network/if-up.d/cluster-shared-nfs";
RUN "sudo chown root:root /etc/network/if-up.d/cluster-shared-nfs";
RUN "sudo chmod +x /etc/network/if-up.d/cluster-shared-nfs"

View File

@ -66,6 +66,17 @@ ask_password() {
whiptail --title "${title}" --passwordbox "${question}" 10 40 "${default_text}" 3>&1 1>&2 2>&3;
return "$?"; # Not actually needed, but best to be explicit
}
ask_multichoice() {
local title="$1"; shift;
local args=();
while [[ "$#" -gt 0 ]]; do
args+=("$1");
args+=("$1");
shift;
done
whiptail --nocancel --notags --menu "$title" 15 40 5 "${args[@]}" 3>&1 1>&2 2>&3;
return "$?"; # Not actually needed, but best to be explicit
}
queue_postinstall_step() {
local stepname="$1";

0
src/steps-config/15-nfs.sh Normal file → Executable file
View File

12
src/steps-config/75-consul.sh Executable file
View File

@ -0,0 +1,12 @@
#!/usr/bin/env bash
consul_mode="$(ask_multichoice "Consul installation mode" "none" "client" "server")";
if [[ "${consul_mode}" != "none" ]]; then
queue_apt_install "hashicorp-consul";
if [[ "${consul_mode}" == "client" ]]; then
queue_apt_install "hashicorp-consul-systemd-client";
else
queue_apt_install "hashicorp-consul-systemd-server";
fi
fi