From c1eabb3454d7aa8b43bbda5ef38b1d1a5475f530 Mon Sep 17 00:00:00 2001 From: Tracey Jaquith Date: Tue, 12 Mar 2024 18:17:58 -0700 Subject: [PATCH] tweaks --- bin/bootstrap.sh | 7 ++++--- bin/entrypoint.sh | 10 ++++------ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/bin/bootstrap.sh b/bin/bootstrap.sh index 6f6c999..ed10757 100755 --- a/bin/bootstrap.sh +++ b/bin/bootstrap.sh @@ -1,5 +1,6 @@ #!/bin/zsh -eu +export FIRST=${FIRST:-""} echo "name = \"$(hostname -s)\"" >> $NOMAD_HCL echo "node_name = \"$(hostname -s)\"" >> $CONSUL_HCL @@ -40,9 +41,6 @@ if [ ! $FIRST ]; then # try up to ~10m to bootstrap nomad for try in $(seq 0 600) do - consul keygen | tr -d ^ | podman secret create HIND_C - - nomad operator gossip keyring generate | tr -d ^ | podman secret create HIND_N - - set +e nomad acl bootstrap 2>/tmp/boot.log >> /tmp/bootstrap [ "$?" = "0" ] && break @@ -53,6 +51,9 @@ if [ ! $FIRST ]; then done set -e + consul keygen | tr -d ^ | podman secret create HIND_C - + nomad operator gossip keyring generate | tr -d ^ | podman secret create HIND_N - + echo export NOMAD_TOKEN=$(fgrep 'Secret ID' /tmp/bootstrap |cut -f2- -d= |tr -d ' ') > $CONFIG rm -f /tmp/bootstrap diff --git a/bin/entrypoint.sh b/bin/entrypoint.sh index 36df6aa..935c5b0 100755 --- a/bin/entrypoint.sh +++ b/bin/entrypoint.sh @@ -1,8 +1,7 @@ #!/bin/zsh -eu +setopt HIST_NO_STORE -export FIRST=${FIRST:-""} - -if [ ! -e $CONFIG ]; then +if [ ! -e /opt/nomad/data/plugins ]; then # create a new docker image with the bootstrapped version of your cluster ./bin/spinner "Bootstrapping your hind cluster..." /app/bin/bootstrap.sh ./bin/spinner 'cleanly shutting down' /app/bin/shutdown.sh @@ -10,12 +9,11 @@ if [ ! -e $CONFIG ]; then exit 0 fi -setopt HIST_NO_STORE sed -i "s/RUNTIME_REPLACED/$HIND_C/" $CONSUL_HCL -sed -i "s/RUNTIME_REPLACED/$HIND_N/" $NOMAD_HCL +sed -i "s/RUNTIME_REPLACED/$HIND_N/" $NOMAD_HCL # set for `nomad run` of jobs with `podman` driver -podman system service -t 0 & # xxx +podman system service -t 0 & # xxx prolly add into supervisord for autorestart # test # sudo curl -v -s --unix-socket /run/podman/podman.sock http://d/v1.0.0/libpod/info