infranet/docker-entrypoint.sh

26 lines
791 B
Bash
Raw Normal View History

2022-03-29 10:14:59 +01:00
#!/bin/sh
2022-03-29 18:50:48 +01:00
ARCH=$(uname -m)
BIN_DIR=/app/linux-${ARCH}
DATA_DIR=/etc/nebula
# --------------------- TESTING ONLY ------------------------
2022-03-30 08:56:13 +01:00
# Build host certs if they don't exist
if ! test -f ${DATA_DIR}/host.crt; then
2022-03-29 18:50:48 +01:00
cd ${DATA_DIR} || exit 1
2022-03-30 08:56:13 +01:00
if ! test -d ${DATA_DIR}/host.csr; then
2022-03-30 09:06:37 +01:00
"${BIN_DIR}/nebula-cert" keygen -out-key host.key -out-pub host.csr
2022-03-30 09:21:30 +01:00
# shellcheck disable=SC2016
2022-03-30 08:56:13 +01:00
echo 'You will need to get the `host.csr` file signed by a cluster admin'
exit 3
else
2022-03-30 09:21:30 +01:00
# shellcheck disable=SC2016
echo 'Awaiting for `host.csr` to be signed by a cluster admin'
2022-03-30 08:56:13 +01:00
exit 4
fi
2022-03-29 18:50:48 +01:00
fi
# -----------------------------------------------------------
2022-03-29 10:14:59 +01:00
# Run the platform-specific binary
2022-03-29 18:50:48 +01:00
"${BIN_DIR}/nebula" -config ${DATA_DIR}/config.yaml