35 lines
962 B
Bash
35 lines
962 B
Bash
#!/bin/sh
|
|
|
|
ARCH=$(uname -m)
|
|
BIN_DIR=/app/linux-${ARCH}
|
|
DATA_DIR=/etc/nebula
|
|
HOSTNAME=$(hostname)
|
|
|
|
if test -z "${NEBULA_IP}"; then
|
|
echo 'You did not set a value for the environment variable NEBULA_IP'
|
|
exit 1
|
|
fi
|
|
|
|
if test "${HOSTNAME}" == '__HOSTNAME__'; then
|
|
echo 'You did not set a hostname for the Docker container'
|
|
exit 2
|
|
fi
|
|
|
|
# --------------------- TESTING ONLY ------------------------
|
|
# Build host certs if they don't exist
|
|
if ! test -f ${DATA_DIR}/host.crt; then
|
|
cd ${DATA_DIR} || exit 1
|
|
if ! test -d ${DATA_DIR}/host.csr; then
|
|
"${BIN_DIR}/nebula-cert" keygen -out-key host.key -out-pub host.csr
|
|
echo 'You will need to get the `host.csr` file signed by a cluster admin'
|
|
exit 3
|
|
else
|
|
echo 'Awaiting `host.csr` to be signed'
|
|
exit 4
|
|
fi
|
|
fi
|
|
# -----------------------------------------------------------
|
|
|
|
# Run the platform-specific binary
|
|
"${BIN_DIR}/nebula" -config ${DATA_DIR}/config.yaml
|