Skip to content

Commit

Permalink
tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
traceypooh committed Mar 13, 2024
1 parent 708e63a commit c1eabb3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
7 changes: 4 additions & 3 deletions bin/bootstrap.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/zsh -eu

export FIRST=${FIRST:-""}

echo "name = \"$(hostname -s)\"" >> $NOMAD_HCL
echo "node_name = \"$(hostname -s)\"" >> $CONSUL_HCL
Expand Down Expand Up @@ -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
Expand All @@ -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

Expand Down
10 changes: 4 additions & 6 deletions bin/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
#!/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
./bin/spinner 'committing bootstrapped image' podman commit -q hind-init hind
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

Expand Down

0 comments on commit c1eabb3

Please sign in to comment.