Files
condado-newsletter/docker/entrypoint.sh
Gabriel Sancho 942da74778
Some checks failed
Build And Publish Production Image / Build And Publish Production Image (push) Failing after 2m23s
fix: remove PostgreSQL initialization from entrypoint and update Docker configuration for external database
2026-03-28 13:40:24 -03:00

34 lines
1.8 KiB
Bash

#!/bin/bash
set -e
APP_DB_NAME=${APP_DB_NAME:-condado}
APP_DB_USER=${SPRING_DATASOURCE_USERNAME:-condado}
APP_DB_PASSWORD=${SPRING_DATASOURCE_PASSWORD:-condado}
# ── Ensure supervisor log directory exists ────────────────────────────────────
mkdir -p /var/log/supervisor
# ── Defaults for external PostgreSQL service in production compose ───────────
export SPRING_DATASOURCE_URL=${SPRING_DATASOURCE_URL:-jdbc:postgresql://condado-newsletter-postgress:5432/${APP_DB_NAME}}
export SPRING_DATASOURCE_USERNAME=${SPRING_DATASOURCE_USERNAME:-${APP_DB_USER}}
export SPRING_DATASOURCE_PASSWORD=${SPRING_DATASOURCE_PASSWORD:-${APP_DB_PASSWORD}}
export JWT_EXPIRATION_MS=${JWT_EXPIRATION_MS:-86400000}
# ── Log all Spring Boot environment variables for debugging ──────────────────
echo "========================================"
echo "Spring Boot Configuration:"
echo "========================================"
echo "SPRING_DATASOURCE_URL=${SPRING_DATASOURCE_URL}"
echo "SPRING_DATASOURCE_USERNAME=${SPRING_DATASOURCE_USERNAME}"
echo "SPRING_DATASOURCE_PASSWORD=${SPRING_DATASOURCE_PASSWORD}"
echo "JWT_EXPIRATION_MS=${JWT_EXPIRATION_MS}"
echo "JAVA_OPTS=${JAVA_OPTS:-not set}"
echo "OPENAI_API_KEY=${OPENAI_API_KEY:-not set}"
echo "========================================"
# ── Start all services via supervisord ───────────────────────────────────────
# Export unbuffered output for both Python and Java
export PYTHONUNBUFFERED=1
export JAVA_OPTS="${JAVA_OPTS} -Dfile.encoding=UTF-8 -Djava.awt.headless=true"
exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf