make sure openssl is installed in node apk when wss

This commit is contained in:
Ivan Folgueira Bande 2026-01-09 15:30:29 +01:00
parent 08be7d0a44
commit d26ba09d04
No known key found for this signature in database
GPG Key ID: 3C117481F89E24A7

View File

@ -56,6 +56,8 @@ fi
if [ -n "${DOMAIN}" ]; then
## A domain has been either set or inferred. Let's try to use it for websocket secure support.
apk add --no-cache openssl
LETSENCRYPT_PATH="/etc/letsencrypt/live/${DOMAIN}"
CERT="${LETSENCRYPT_PATH}/fullchain.pem"
KEY="${LETSENCRYPT_PATH}/privkey.pem"
@ -63,12 +65,10 @@ if [ -n "${DOMAIN}" ]; then
echo "[INFO] Waiting for a valid TLS certificate for ${DOMAIN}..."
while true; do
MIN_VALIDITY=3600 # 1 hour
if [ ! -f "${CERT}" ] || [ ! -f "${KEY}" ]; then
echo "[INFO] Certificate files not found yet. Waiting..."
elif ! openssl x509 -checkend "${MIN_VALIDITY}" -noout -in "${CERT}" >/dev/null 2>&1; then
echo "[WARN] Certificate is invalid, expired, or expiring soon. Waiting..."
elif ! openssl x509 -checkend 0 -noout -in "${CERT}" >/dev/null 2>&1; then
echo "[WARN] Certificate exists but is expired. Waiting for renewal..."
else
echo "[INFO] Valid TLS certificate detected."
break