bluesky-pds-docker/entrypoint.sh
2024-12-01 19:15:39 -05:00

58 lines
1.7 KiB
Bash

#!/bin/bash
LOCAL_IP=$(hostname --all-ip-addresses | awk '{ print $1 }')
PUBLIC_IP=$(curl https://ipinfo.io/ip --silent)
HOSTNAME=$(hostname)
function main {
# pds hostname must be the same as the hostname of the container
if [[ "${PDS_HOSTNAME}" != "${HOSTNAME}" ]]; then
echo "PDS_HOSTNAME must be the same as the hostname of the container"
echo "Set the hostname for the container before running."
echo "Current hostname: ${HOSTNAME}"
echo "PDS_HOSTNAME: ${PDS_HOSTNAME}"
exit 1
fi
if [[ -z "${PDS_HOSTNAME}" ]]; then
echo "No public DNS address specified"
exit 1
fi
if [[ -z "${PDS_JWT_SECRET}" ]]; then
echo "PDS_JWT_SECRET not specified"
exit 1
fi
if [[ -z "${PDS_ADMIN_PASSWORD}" ]]; then
echo "PDS_ADMIN_PASSWORD not specified"
exit 1
fi
if [[ -z "${PDS_PLC_ROTATION_KEY_K256_PRIVATE_KEY_HEX}" ]]; then
echo "PDS_PLC_ROTATION_KEY_K256_PRIVATE_KEY_HEX not specified"
exit 1
fi
cat <<STARTED_MESSAGE
========================================================================
PDS Started
------------------------------------------------------------------------
Hostname : ${PDS_HOSTNAME}
: http://${PDS_HOSTNAME}:3000/xrpc/_health
Local IP : ${LOCAL_IP}
: http://${LOCAL_IP}:3000/xrpc/_health
Public IP : ${PUBLIC_IP}
: http://${PUBLIC_IP}:3000/xrpc/_health
========================================================================
STARTED_MESSAGE
node --enable-source-maps index.js
}
main