Skip to content

Commit

Permalink
working! tweaks/prettyment; dox++
Browse files Browse the repository at this point in the history
  • Loading branch information
traceypooh committed Mar 14, 2024
1 parent a258af0 commit f391648
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
3 changes: 3 additions & 0 deletions bin/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,6 @@ else
rm -f /tmp/*

fi

# signal to `install.sh` that we are done -- so it can `podman commit` our running container now
date | podman secret create BOOTSTRAPPED
8 changes: 5 additions & 3 deletions bin/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#!/bin/zsh -eu
setopt HIST_NO_STORE

if [ ! -e /booted ]; then # xxx
if [ ! -e /booted ]; 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 'committing bootstrapped image' podman commit -q hind-init hind # xxx
./bin/spinner 'committing bootstrapped image' zsh -c 'while $(! sudo podman images |grep -qE "localhost/hind "); do sleep 3; done'

# After having some problems w/ `podman commit` _on the inside_, we now do `podman commit` on the
# outside (@see install.sh). Wait for the podman image to show up to know we are done setup.
./bin/spinner 'committing bootstrapped image' zsh -c 'while $(! sudo podman images |grep -qE "^localhost/hind "); do sleep 3; done'

exit 0
fi
Expand Down
11 changes: 8 additions & 3 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,21 @@ podman -v > /dev/null || echo 'please install the podman package first'
podman -v > /dev/null || exit 1

(
while $(! podman secret ls |grep -q ' NOMAD_TOKEN '); do sleep 1; done
podman commit -q hind-init hind # xxx
# in background, wait for the `bootstrap.sh`, running in the first `podman run` below, to finish
while $(! podman secret ls |grep -q ' BOOTSTRAPPED '); do sleep 1; done
podman commit -q hind-init localhost/hind
podman secret rm BOOTSTRAPPED > /dev/null
) &


(
set -x
# xxx document & why the 2 mkdirs on the outside/VM:
# We need to shared these 2 directories "inside" the running `hind` container, and "outside" on
# the VM itself. We want to persist HTTPS cert files, and any `data/alloc` directories setup
# on the "inside" (eg: `nomad run`) need to be available to nomad jobs running on the outside/VM.
mkdir -p -m777 /pv/CERTS
mkdir -p -m777 /opt/nomad/data/alloc

podman run --net=host --privileged --cgroupns=host \
-v /var/lib/containers:/var/lib/containers \
-e FQDN -e HOST_UNAME \
Expand Down

0 comments on commit f391648

Please sign in to comment.