chore(easypanel): make docker-compose.easypanel env-driven + add config generator script

This commit is contained in:
Cesar Jhoanny Mendivil Rubio 2025-10-01 15:13:53 -07:00
parent f939af5aac
commit f14f15f2a2
3 changed files with 111 additions and 10 deletions

View File

@ -1,3 +1,37 @@
README - EasyPanel / Git repo setup
Este archivo describe cómo usar `docker-compose.easypanel.yml` desde EasyPanel.
Principio: No almacenar secretos en el repositorio. EasyPanel debe inyectar los valores
mediante variables de entorno o secrets en el formulario del panel.
Variables (mínimas recomendadas)
- POSTGRES_HOST (por defecto: postgres)
- POSTGRES_PORT (por defecto: 5432)
- POSTGRES_DB (por defecto: libretime)
- POSTGRES_USER (por defecto: libretime)
- POSTGRES_PASSWORD (REQUIRED)
- RABBITMQ_HOST (por defecto: rabbitmq)
- RABBITMQ_PORT (por defecto: 5672)
- RABBITMQ_DEFAULT_VHOST (por defecto: /libretime)
- RABBITMQ_DEFAULT_USER (por defecto: libretime)
- RABBITMQ_DEFAULT_PASS (REQUIRED)
- ICECAST_SOURCE_PASSWORD (opcional)
- ICECAST_ADMIN_PASSWORD (opcional)
- LIBRETIME_GENERAL_PUBLIC_URL (opcional)
- LIBRETIME_API_KEY (opcional)
Cómo funciona
- Al crear la aplicación en EasyPanel, configure estas variables como "Environment Variables" o "Secrets".
- El servicio `config-generator` ejecuta `tools/easypanel-config-generator.sh` y escribe
la configuración final en el volumen `libretime_config` en `/config/config.yml`.
- Los contenedores `api`, `legacy`, `playout`, `worker` y `analyzer` montan ese volumen
en `/etc/libretime` y leen la configuración desde `/etc/libretime/config.yml`.
Notas
- Asegúrese de que las variables sensibles (POSTGRES_PASSWORD, RABBITMQ_DEFAULT_PASS) se guarden
como secretos en EasyPanel y no como variables visibles en el repo.
- Si desea personalizar más opciones, modifique `tools/easypanel-config-generator.sh`.
# LibreTime para EasyPanel # LibreTime para EasyPanel
Esta guía te ayudará a desplegar LibreTime en EasyPanel usando Docker Compose. Esta guía te ayudará a desplegar LibreTime en EasyPanel usando Docker Compose.

View File

@ -1,6 +1,13 @@
# LibreTime Docker Compose para EasyPanel version: "3.9"
# Basado en el docker-compose oficial de LibreTime
# Optimizado para despliegue en EasyPanel # LibreTime Docker Compose (EasyPanel-ready)
# Esta versión está pensada para usarse desde un repositorio en EasyPanel.
# Principios:
# - No almacenar secretos en archivos del repo: EasyPanel proporcionará los valores
# mediante variables/secretos de entorno.
# - Un servicio `config-generator` genera `/config/config.yml` dentro del volumen
# `libretime_config` a partir de variables de entorno. Los servicios montan ese
# volumen en `/etc/libretime`.
services: services:
# Base de datos PostgreSQL # Base de datos PostgreSQL
@ -26,7 +33,7 @@ services:
environment: environment:
RABBITMQ_DEFAULT_VHOST: ${RABBITMQ_DEFAULT_VHOST:-/libretime} RABBITMQ_DEFAULT_VHOST: ${RABBITMQ_DEFAULT_VHOST:-/libretime}
RABBITMQ_DEFAULT_USER: ${RABBITMQ_DEFAULT_USER:-libretime} RABBITMQ_DEFAULT_USER: ${RABBITMQ_DEFAULT_USER:-libretime}
RABBITMQ_DEFAULT_PASS: ${RABBITMQ_DEFAULT_PASS:-libretime} RABBITMQ_DEFAULT_PASS: ${RABBITMQ_DEFAULT_PASS}
healthcheck: healthcheck:
test: ["CMD-SHELL", "rabbitmq-diagnostics check_port_connectivity"] test: ["CMD-SHELL", "rabbitmq-diagnostics check_port_connectivity"]
interval: 30s interval: 30s
@ -45,11 +52,13 @@ services:
condition: service_healthy condition: service_healthy
rabbitmq: rabbitmq:
condition: service_healthy condition: service_healthy
config-generator:
condition: service_healthy
environment: environment:
LIBRETIME_GENERAL_PUBLIC_URL: ${LIBRETIME_GENERAL_PUBLIC_URL:-http://localhost:8080} LIBRETIME_GENERAL_PUBLIC_URL: ${LIBRETIME_GENERAL_PUBLIC_URL:-http://localhost:8080}
LIBRETIME_DEBUG: ${LIBRETIME_DEBUG:-false} LIBRETIME_DEBUG: ${LIBRETIME_DEBUG:-false}
volumes: volumes:
- ${LIBRETIME_CONFIG_FILEPATH:-./config.local.yml}:/etc/libretime/config.yml:ro - libretime_config:/etc/libretime:ro
- libretime_storage:/srv/libretime - libretime_storage:/srv/libretime
# Aplicación Legacy de LibreTime # Aplicación Legacy de LibreTime
@ -64,8 +73,10 @@ services:
condition: service_healthy condition: service_healthy
rabbitmq: rabbitmq:
condition: service_healthy condition: service_healthy
config-generator:
condition: service_healthy
volumes: volumes:
- ${LIBRETIME_CONFIG_FILEPATH:-./config.local.yml}:/etc/libretime/config.yml:ro - libretime_config:/etc/libretime:ro
- libretime_storage:/srv/libretime - libretime_storage:/srv/libretime
# Servidor web Nginx # Servidor web Nginx
@ -107,7 +118,7 @@ services:
rabbitmq: rabbitmq:
condition: service_healthy condition: service_healthy
volumes: volumes:
- ${LIBRETIME_CONFIG_FILEPATH:-./config.local.yml}:/etc/libretime/config.yml:ro - libretime_config:/etc/libretime:ro
- libretime_playout:/app - libretime_playout:/app
environment: environment:
LIBRETIME_GENERAL_PUBLIC_URL: ${LIBRETIME_GENERAL_PUBLIC_URL:-http://localhost:8080} LIBRETIME_GENERAL_PUBLIC_URL: ${LIBRETIME_GENERAL_PUBLIC_URL:-http://localhost:8080}
@ -127,7 +138,7 @@ services:
- "${LIQUIDSOAP_HARBOR_PORT:-8001}:8001" - "${LIQUIDSOAP_HARBOR_PORT:-8001}:8001"
- "${LIQUIDSOAP_TELNET_PORT:-8002}:8002" - "${LIQUIDSOAP_TELNET_PORT:-8002}:8002"
volumes: volumes:
- ${LIBRETIME_CONFIG_FILEPATH:-./config.local.yml}:/etc/libretime/config.yml:ro - libretime_config:/etc/libretime:ro
- libretime_playout:/app - libretime_playout:/app
environment: environment:
LIBRETIME_GENERAL_PUBLIC_URL: ${LIBRETIME_GENERAL_PUBLIC_URL:-http://localhost:8080} LIBRETIME_GENERAL_PUBLIC_URL: ${LIBRETIME_GENERAL_PUBLIC_URL:-http://localhost:8080}
@ -143,7 +154,7 @@ services:
rabbitmq: rabbitmq:
condition: service_healthy condition: service_healthy
volumes: volumes:
- ./config.local.yml:/etc/libretime/config.yml:ro - libretime_config:/etc/libretime:ro
- libretime_storage:/srv/libretime - libretime_storage:/srv/libretime
environment: environment:
LIBRETIME_GENERAL_PUBLIC_URL: ${LIBRETIME_GENERAL_PUBLIC_URL:-http://localhost:8080} LIBRETIME_GENERAL_PUBLIC_URL: ${LIBRETIME_GENERAL_PUBLIC_URL:-http://localhost:8080}
@ -159,11 +170,25 @@ services:
rabbitmq: rabbitmq:
condition: service_healthy condition: service_healthy
volumes: volumes:
- ./config.local.yml:/etc/libretime/config.yml:ro - libretime_config:/etc/libretime:ro
- libretime_storage:/srv/libretime - libretime_storage:/srv/libretime
# (No se incluye servicio composer; seguir método Docker estándar de LibreTime) # (No se incluye servicio composer; seguir método Docker estándar de LibreTime)
# Generador de configuración (escrito por el panel desde variables/secretos)
config-generator:
image: alpine:3.18
restart: "no"
entrypoint: ["/bin/sh","/tools/easypanel-config-generator.sh"]
volumes:
- libretime_config:/config
- ./tools:/tools:ro
healthcheck:
test: ["CMD-SHELL","test -f /config/config.yml"]
interval: 2s
timeout: 2s
retries: 10
# Volúmenes persistentes # Volúmenes persistentes
volumes: volumes:
postgres_data: postgres_data:
@ -172,6 +197,8 @@ volumes:
driver: local driver: local
libretime_playout: libretime_playout:
driver: local driver: local
libretime_config:
driver: local
# Red personalizada (opcional para EasyPanel) # Red personalizada (opcional para EasyPanel)
networks: networks:

View File

@ -0,0 +1,40 @@
#!/bin/sh
# Generador de config para EasyPanel
# Lee variables de entorno y escribe /config/config.yml
set -eu
CONFIG_PATH=/config/config.yml
cat > "$CONFIG_PATH" <<'EOF'
general:
public_url: "${LIBRETIME_GENERAL_PUBLIC_URL:-http://localhost:8080}"
api_key: "${LIBRETIME_API_KEY:-}"
secret_key: "${LIBRETIME_SECRET_KEY:-}"
database:
host: ${POSTGRES_HOST:-postgres}
port: ${POSTGRES_PORT:-5432}
name: ${POSTGRES_DB:-libretime}
user: ${POSTGRES_USER:-libretime}
password: "${POSTGRES_PASSWORD}"
rabbitmq:
host: ${RABBITMQ_HOST:-rabbitmq}
port: ${RABBITMQ_PORT:-5672}
vhost: ${RABBITMQ_DEFAULT_VHOST:-/libretime}
user: ${RABBITMQ_DEFAULT_USER:-libretime}
password: "${RABBITMQ_DEFAULT_PASS}"
icecast:
source_password: "${ICECAST_SOURCE_PASSWORD:-changeme}"
admin_password: "${ICECAST_ADMIN_PASSWORD:-changeme}"
relay_password: "${ICECAST_RELAY_PASSWORD:-changeme}"
admin_user: "${ICECAST_ADMIN_USER:-admin}"
hostname: "${ICECAST_HOSTNAME:-localhost}"
EOF
echo "wrote $CONFIG_PATH"
# Mantener el contenedor en ejecución para que dependientes puedan verificar salud
tail -f /dev/null