diff --git a/src/run.sh b/src/run.sh index 0946732..356da52 100755 --- a/src/run.sh +++ b/src/run.sh @@ -146,8 +146,18 @@ task_end "$?"; task_begin "Setting initial state"; cat apt-packages.txt >"${temp_dir}/apt-packages.txt"; -queue_preinstall_step "10-apt-update.sh"; +queue_preinstall_step "5-apt-sbrl.sh"; +queue_preinstall_step "10-apt.sh"; queue_preinstall_step "15-ufw.sh"; +queue_preinstall_step "20-sshguard.sh"; +# Install docker by default +if [[ "${CLUSTER_EXCLUDE}" =~ docker ]]; then queue_preinstall_step "20-docker.sh"; fi +queue_preinstall_step "50-avahi-daemon.sh"; +queue_preinstall_step "50-cgroups-memory.sh"; +queue_preinstall_step "100-chrony.sh"; + + +queue_postinstall_step "20-collectd.sh"; queue_postinstall_step "100-ssh-cluster-config.sh"; task_end "$?"; @@ -172,18 +182,20 @@ if ask_yesno "Use apt-cacher-ng server?"; then source ./steps-config/10-apt-cache.sh; fi -source ./steps-config/15-nfs.sh; -source ./steps-config/20-docker.sh; -source ./steps-config/50-avahi-daemon.sh; - if ask_yesno "Install and configure wesher mesh wireguard VPN?"; then source ./steps-config/50-wesher-wireguard.sh; fi +source ./steps-config/75-consul.sh; # Has it's own whiptail logic +source ./steps-config/80-nomad.sh; # Has it's own whiptail logic + if ask_yesno "Add Laminar CI SSH public key to root authorized_keys?"; then source ./steps-config/80-laminar-ssh.sh; fi +source ./steps-config/100-logging.sh; + + #shellcheck disable=2034 collectd_username="$(ask_text "collectd", "Enter collectd username")"; #shellcheck disable=2034 @@ -194,13 +206,7 @@ collectd_password="$(ask_password "collectd" "Enter collectd password")"; # Autonomous config tasks ### -source ./steps-config/50-avahi-daemon.sh -source ./steps-config/100-logrotate.sh source ./steps-config/100-apt-sbrl.sh -# Install docker by default -if [[ "${CLUSTER_EXCLUDE}" =~ docker ]]; then - source ./steps-config/10-docker.sh; -fi stage_end "$?"; diff --git a/src/steps-config/100-apt-sbrl.sh b/src/steps-config/100-apt-sbrl.sh deleted file mode 100755 index d40351c..0000000 --- a/src/steps-config/100-apt-sbrl.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash - -echo 'deb http://apt.starbeamrainbowlabs.com/ ./ # apt.starbeamrainbowlabs.com' >/etc/apt/sources.list.d/sbrl.list - -apt-key adv --keyserver hkps://keyserver.ubuntu.com:443 --recv-keys D48D801C6A66A5D8 diff --git a/src/steps-config/100-logging.sh b/src/steps-config/100-logging.sh index 82bf072..d5a06a2 100755 --- a/src/steps-config/100-logging.sh +++ b/src/steps-config/100-logging.sh @@ -37,6 +37,7 @@ case "${logging_mode}" in ;; esac +queue_postinstall_step "100-logging.sh" # TODO: Finish this off. diff --git a/src/steps-config/20-docker.sh b/src/steps-config/20-docker.sh deleted file mode 100755 index 5c9d3be..0000000 --- a/src/steps-config/20-docker.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env bash - -task_begin "Configuring Docker apt repository"; -# curl -fsSL https://get.docker.com -o /tmp/get-docker.sh -# chmod +x /tmp/get-docker.sh -# sudo sh /tmp/get-docker.sh -echo "deb [arch=$(dpkg --print-architecture)] http://download.docker.com/linux/raspbian buster stable" >/etc/apt/sources.list.d/docker.list; - -queue_apt_install docker-ce; - -task_end "$?"; - -queue_preinstall_step "20-docker.sh"; -queue_postinstall_step "20-docker.sh"; diff --git a/src/steps-config/75-consul.sh b/src/steps-config/75-consul.sh index 4378600..e605f2e 100755 --- a/src/steps-config/75-consul.sh +++ b/src/steps-config/75-consul.sh @@ -9,4 +9,6 @@ if [[ "${consul_mode}" != "none" ]]; then else queue_apt_install "hashicorp-consul-systemd-server"; fi + + queue_postinstall_step "75-consul.sh" fi diff --git a/src/steps-config/80-nomad.sh b/src/steps-config/80-nomad.sh index b3fd023..13e900e 100755 --- a/src/steps-config/80-nomad.sh +++ b/src/steps-config/80-nomad.sh @@ -15,4 +15,6 @@ if [[ "${nomad_mode}" != "none" ]]; then queue_apt_install "hashicorp-nomad-systemd-both"; ;; esac + + queue_postinstall_step "80-nomad.sh" fi diff --git a/src/steps-config/100-chrony.sh b/src/steps-preinstall/100-chrony.sh similarity index 55% rename from src/steps-config/100-chrony.sh rename to src/steps-preinstall/100-chrony.sh index 71a7ffc..a4574b4 100755 --- a/src/steps-config/100-chrony.sh +++ b/src/steps-preinstall/100-chrony.sh @@ -1,3 +1,5 @@ #!/usr/bin/env bash queue_apt_install "chrony"; + +queue_postinstall_step "100-chrony.sh"; \ No newline at end of file diff --git a/src/steps-config/15-nfs.sh b/src/steps-preinstall/15-nfs.sh similarity index 60% rename from src/steps-config/15-nfs.sh rename to src/steps-preinstall/15-nfs.sh index 1108d9e..dc2bf1d 100755 --- a/src/steps-config/15-nfs.sh +++ b/src/steps-preinstall/15-nfs.sh @@ -1,3 +1,5 @@ #!/usr/bin/env bash queue_apt_install "nfs-common"; + +queue_postinstall_step "20-nfs.sh" \ No newline at end of file diff --git a/src/steps-preinstall/20-docker.sh b/src/steps-preinstall/20-docker.sh index 36ea943..65fd668 100755 --- a/src/steps-preinstall/20-docker.sh +++ b/src/steps-preinstall/20-docker.sh @@ -1,5 +1,18 @@ #!/usr/bin/env bash +task_begin "Configuring Docker apt repository"; +# curl -fsSL https://get.docker.com -o /tmp/get-docker.sh +# chmod +x /tmp/get-docker.sh +# sudo sh /tmp/get-docker.sh +echo "deb [arch=$(dpkg --print-architecture)] http://download.docker.com/linux/raspbian buster stable" >/etc/apt/sources.list.d/docker.list; + +queue_apt_install docker-ce; + +task_end "$?"; + +queue_postinstall_step "20-docker.sh"; + + task_begin "docker: installing libseccomp2 from ${VERSION_CODENAME}-backports"; # Fix apt update errors inside docker containers # Ref https://blog.samcater.com/fix-workaround-rpi4-docker-libseccomp2-docker-20/ diff --git a/src/steps-preinstall/5-apt-sbrl.sh b/src/steps-preinstall/5-apt-sbrl.sh new file mode 100755 index 0000000..af97328 --- /dev/null +++ b/src/steps-preinstall/5-apt-sbrl.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +task_begin "Configuring apt.starbeamrainbowlabs.com apt repository"; + +subtask_begin "Writing apt repository sources"; +echo 'deb http://apt.starbeamrainbowlabs.com/ ./ # apt.starbeamrainbowlabs.com' >/etc/apt/sources.list.d/sbrl.list +subtask_end "$?" "Error: Failed to write apt repository sources"; + +subtask_begin "Importing GPG signing key"; +curl -sSL https://apt.starbeamrainbowlabs.com/aptosaurus.asc -O- | sudo tee /etc/apt/trusted.gpg.d/sbrl.asc +subtask_end "$?" "Error: Failed to import GPG signing key"; + +task_end "$?" "Error: Failed to configure apt.starbeamrainbowlabs.com apt repository" \ No newline at end of file diff --git a/src/steps-config/50-avahi-daemon.sh b/src/steps-preinstall/50-avahi-daemon.sh similarity index 100% rename from src/steps-config/50-avahi-daemon.sh rename to src/steps-preinstall/50-avahi-daemon.sh