Compare commits
5 Commits
512c3d6dd9
...
e0f5321932
Author | SHA1 | Date |
---|---|---|
Starbeamrainbowlabs | e0f5321932 | |
Starbeamrainbowlabs | 61463167dd | |
Starbeamrainbowlabs | 0514c6fb67 | |
Starbeamrainbowlabs | 3025fda8e4 | |
Starbeamrainbowlabs | 30700caf1c |
|
@ -1,7 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
RUN "uptime";
|
||||
|
||||
COPY "${JOBFILE_DIR}/testfile.txt" "/tmp";
|
||||
|
||||
RUN "rm /tmp/testfile.txt";
|
|
@ -1 +0,0 @@
|
|||
it works!
|
|
@ -0,0 +1,18 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
nomad_mode="$(ask_multichoice "Nomad installation mode" "none" "client" "server" "both")";
|
||||
|
||||
if [[ "${nomad_mode}" != "none" ]]; then
|
||||
queue_apt_install "hashicorp-nomad";
|
||||
case "${nomad_mode}" in
|
||||
client )
|
||||
queue_apt_install "hashicorp-nomad-systemd-client";
|
||||
;;
|
||||
server )
|
||||
queue_apt_install "hashicorp-nomad-systemd-server";
|
||||
;;
|
||||
both )
|
||||
queue_apt_install "hashicorp-nomad-systemd-both";
|
||||
;;
|
||||
esac
|
||||
fi
|
|
@ -12,7 +12,7 @@ subtask_end "$?";
|
|||
# No UFW rules required, as we're now using wesher/wireguard, and allowing all inbound traffic on that interface
|
||||
|
||||
subtask_begin "Starting Consul and enabling on boot";
|
||||
systemctl consul;
|
||||
systemctl enable --now consul;
|
||||
subtask_end "$?";
|
||||
|
||||
task_end "$?";
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
|
||||
task_begin "Installing Nomad configuration";
|
||||
# /etc/nomad is created by the apt postinstall script
|
||||
|
||||
subtask_begin "Copying configuration files";
|
||||
cp "configs/nomad-client.hcl" "/etc/nomad/client.hcl";
|
||||
cp "configs/nomad-server.hcl" "/etc/nomad/server.hcl";
|
||||
cp "configs/nomad-both.hcl" "/etc/nomad/both.hcl";
|
||||
subtask_end "$?";
|
||||
|
||||
# No UFW rules required, as we're now using wesher/wireguard, and allowing all inbound traffic on that interface
|
||||
|
||||
subtask_begin "Starting Nomad and enabling on boot";
|
||||
systemctl enable --now nomad;
|
||||
subtask_end "$?";
|
||||
|
||||
task_end "$?";
|
|
@ -0,0 +1,39 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
check_cgroups_memory() {
|
||||
task_begin "Checking memory cgroups";
|
||||
|
||||
cgroups_enabled="$(awk '/memory/ { print $2 }' < /proc/cgroups)";
|
||||
|
||||
if [[ "${cgroups_enabled}" -ne 0 ]]; then
|
||||
echo ">>> memory cgroups already enabled";
|
||||
return 0;
|
||||
fi
|
||||
|
||||
|
||||
filepath_cmdline="/boot/cmdline.txt";
|
||||
if [[ ! -e "${filepath_cmdline}" ]]; then
|
||||
filepath_cmdline="/boot/firmware/cmdline.txt";
|
||||
fi
|
||||
if [[ ! -e "${filepath_cmdline}" ]]; then
|
||||
echo ">>> Failed to find cmdline.txt; can't check for cgroups";
|
||||
return 1;
|
||||
fi
|
||||
|
||||
if grep -q cgroup_enable=memory /boot/cmdline.txt; then
|
||||
echo ">>> memory cgroups already present in cmdline.txt, a reboot is required to apply the update";
|
||||
return 0;
|
||||
fi
|
||||
|
||||
echo ">>> memory cgroups not present in cmdline.txt, enabling....";
|
||||
(tr -d '\n' <"${filepath_cmdline}" && echo " cgroup_enable=memory cgroup_memory=1") | sudo tee "${filepath_cmdline}.new";
|
||||
|
||||
sudo mv "${filepath_cmdline}" "${filepath_cmdline}.old-$(date +"%Y-%m-%d")";
|
||||
sudo mv "${filepath_cmdline}.new" "${filepath_cmdline}";
|
||||
|
||||
echo ">>> New contents of cmdline.txt:";
|
||||
cat "${filepath_cmdline}";
|
||||
echo ">>> A reboot is required to apply the changes.";
|
||||
|
||||
task_end "$?" "Failed to check memory cgroups"
|
||||
}
|
Loading…
Reference in New Issue