feat(easypanel): actualizar docker-compose y scripts para mejorar la gestión de configuraciones y secretos, incluyendo la copia de archivos nginx
Some checks are pending
Container / meta (analyzer) (push) Waiting to run
Container / meta (api) (push) Waiting to run
Container / meta (legacy) (push) Waiting to run
Container / meta (nginx) (push) Waiting to run
Container / meta (playout) (push) Waiting to run
Container / meta (worker) (push) Waiting to run
Container / build (push) Blocked by required conditions
Project / pre-commit (push) Waiting to run
Project / test-tools (push) Waiting to run
Release-Please / release-please (push) Waiting to run

This commit is contained in:
Cesar Jhoanny Mendivil Rubio 2025-10-01 17:48:09 -07:00
parent de5a70154d
commit 778264653e
5 changed files with 120 additions and 104 deletions

View File

@ -1,4 +1,3 @@
version: "3.9"
# LibreTime Docker Compose (EasyPanel-ready) # LibreTime Docker Compose (EasyPanel-ready)
# Esta versión está pensada para usarse desde un repositorio en EasyPanel. # Esta versión está pensada para usarse desde un repositorio en EasyPanel.
@ -16,7 +15,7 @@ services:
restart: unless-stopped restart: unless-stopped
environment: environment:
POSTGRES_USER: ${POSTGRES_USER:-libretime} POSTGRES_USER: ${POSTGRES_USER:-libretime}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-libretime} POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-Jz/XxRUodVl2g0HE59DszTBJVY8Sdmv7}
POSTGRES_DB: ${POSTGRES_DB:-libretime} POSTGRES_DB: ${POSTGRES_DB:-libretime}
volumes: volumes:
- postgres_data:/var/lib/postgresql/data - postgres_data:/var/lib/postgresql/data
@ -33,7 +32,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} RABBITMQ_DEFAULT_PASS: ${RABBITMQ_DEFAULT_PASS:-Bn321PQSRXanvmZlppuulVCB0ShN5Dz2}
healthcheck: healthcheck:
test: ["CMD-SHELL", "rabbitmq-diagnostics check_port_connectivity"] test: ["CMD-SHELL", "rabbitmq-diagnostics check_port_connectivity"]
interval: 30s interval: 30s
@ -86,8 +85,6 @@ services:
depends_on: depends_on:
- legacy - legacy
- api - api
ports:
- "${NGINX_PORT:-8080}:8080"
volumes: volumes:
- libretime_storage:/srv/libretime:ro - libretime_storage:/srv/libretime:ro
- ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf:ro - ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf:ro
@ -98,12 +95,10 @@ services:
icecast: icecast:
image: ghcr.io/libretime/icecast:2.4.4 image: ghcr.io/libretime/icecast:2.4.4
restart: unless-stopped restart: unless-stopped
ports:
- "${ICECAST_PORT:-8000}:8000"
environment: environment:
ICECAST_SOURCE_PASSWORD: ${ICECAST_SOURCE_PASSWORD:-hackme} ICECAST_SOURCE_PASSWORD: ${ICECAST_SOURCE_PASSWORD:-dna1g1GcaaHakSN6C9X7rcPRpIIc/jV2}
ICECAST_ADMIN_PASSWORD: ${ICECAST_ADMIN_PASSWORD:-hackme} ICECAST_ADMIN_PASSWORD: ${ICECAST_ADMIN_PASSWORD:-BLoYLPlUXfmkxrsvGF7LP0TtVtuKNuzJ}
ICECAST_RELAY_PASSWORD: ${ICECAST_RELAY_PASSWORD:-hackme} ICECAST_RELAY_PASSWORD: ${ICECAST_RELAY_PASSWORD:-jYzhEjwdiJlTk30QOYHum6UE61FHo+sd}
ICECAST_ADMIN_USER: ${ICECAST_ADMIN_USER:-admin} ICECAST_ADMIN_USER: ${ICECAST_ADMIN_USER:-admin}
ICECAST_HOSTNAME: ${ICECAST_HOSTNAME:-localhost} ICECAST_HOSTNAME: ${ICECAST_HOSTNAME:-localhost}
@ -134,9 +129,6 @@ services:
depends_on: depends_on:
rabbitmq: rabbitmq:
condition: service_healthy condition: service_healthy
ports:
- "${LIQUIDSOAP_HARBOR_PORT:-8001}:8001"
- "${LIQUIDSOAP_TELNET_PORT:-8002}:8002"
volumes: volumes:
- libretime_config:/etc/libretime:ro - libretime_config:/etc/libretime:ro
- libretime_playout:/app - libretime_playout:/app

View File

@ -1,91 +0,0 @@
#
# This file is used for development. It it not intended for production!
# See https://libretime.org/docs/developer-manual/development/environment/#docker-compose
#
services:
postgres:
ports:
- 5432:5432
rabbitmq:
image: rabbitmq:management-alpine
ports:
- 5672:5672
- 15672:15672
playout:
build:
context: .
target: libretime-playout
volumes:
- ./playout:/src
- ./dev/playout:/app
liquidsoap:
build:
context: .
target: libretime-playout
ports:
- 1234:1234
volumes:
- ./playout:/src
- ./dev/playout:/app
- ./dev/certs:/certs
## See https://libretime.org/docs/admin-manual/tutorials/setup-a-pulseaudio-output-inside-containers/
# - ./dev/pulse.socket:/tmp/pulse.socket
# - ./docker/pulse.client.conf:/etc/pulse/client.conf
analyzer:
build:
context: .
target: libretime-analyzer
volumes:
- ./analyzer:/src
worker:
build:
context: .
target: libretime-worker
volumes:
- ./worker:/src
api:
build:
context: .
target: libretime-api
volumes:
- ./api:/src
command: /usr/local/bin/libretime-api runserver 0.0.0.0:9001
environment:
LIBRETIME_DEBUG: "true"
legacy:
build:
context: .
target: libretime-legacy
volumes:
- ./legacy:/var/www/html
nginx:
build:
context: .
target: libretime-nginx
volumes:
- ./legacy:/var/www/html
- ./docker/nginx.conf:/etc/nginx/conf.d/default.conf:ro
icecast:
ports:
- 8000:8000
- 8443:8443
environment:
ICECAST_MAX_SOURCES: 10
volumes:
- ./dev/certs:/certs
- ./dev/icecast.xml:/etc/icecast.xml
mailpit:
image: axllent/mailpit
ports:
- 8025:8025
- 1025:1025

View File

@ -0,0 +1,83 @@
server {
listen 8080;
listen [::]:8080;
root /var/www/html/public;
index index.php index.html index.htm;
client_max_body_size 512M;
client_body_timeout 300s;
location ~ \.php$ {
fastcgi_buffers 64 4K;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
#try_files $uri =404;
try_files $fastcgi_script_name =404;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
set $path_info $fastcgi_path_info;
fastcgi_param PATH_INFO $path_info;
include fastcgi_params;
fastcgi_index index.php;
fastcgi_pass legacy:9000;
}
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
# Proxy todas las rutas /api (excepto /api/_media) a la API Python
location ^~ /api/_media {
internal;
alias /srv/libretime;
}
# Compatibilidad: interceptar /api/version antes de la copia proxy general
# Usamos ^~ para dar prioridad sobre la regla general /api/
location ^~ /api/version {
return 307 /api/v2/version;
}
# Variante con slash final
location ^~ /api/version/ {
return 307 /api/v2/version;
}
# Compatibilidad: rutas legacy que deben ser manejadas por el código PHP
# En la configuración original, peticiones /api/* que no eran /api/v2
# caían en el enrutador PHP (try_files -> /index.php). Restauramos
# ese comportamiento para endpoints concretos usados por playout.
location = /api/register-component {
try_files $uri $uri/ /index.php$is_args$args;
}
location = /api/register-component/ {
try_files $uri $uri/ /index.php$is_args$args;
}
# Proxy por defecto para todas las rutas /api/ (excepto las interceptadas arriba)
location /api/ {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_redirect off;
proxy_pass http://api:9001;
}
# Soporte para peticiones antiguas específicas a /api/v2 o /api/browser
location ~ ^/api/(v2|browser) {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_redirect off;
proxy_pass http://api:9001;
}
}

View File

@ -105,6 +105,18 @@ async function main() {
} catch (e) { } catch (e) {
// ignore // ignore
} }
// Copiar docker/nginx al code/ para que archivos como ./docker/nginx/default.conf existan
const nginxSrc = path.resolve(__dirname, '../docker/nginx');
const nginxDestParent = path.resolve(DEST_DIR, 'docker');
try {
if (fs.existsSync(nginxSrc)) {
if (!fs.existsSync(nginxDestParent)) fs.mkdirSync(nginxDestParent, { recursive: true });
const { spawnSync } = require('child_process');
spawnSync('cp', ['-a', nginxSrc, nginxDestParent]);
}
} catch (e) {
console.warn('warning copying docker/nginx:', e && e.message);
}
console.log('Preparado', DEST); console.log('Preparado', DEST);
} }

View File

@ -74,6 +74,13 @@ if [ -d "$DEST_DIR/tools" ]; then
find "$DEST_DIR/tools" -type f -iname '*.sh' -exec chmod 0755 {} \; find "$DEST_DIR/tools" -type f -iname '*.sh' -exec chmod 0755 {} \;
fi fi
# Copiar docker/nginx para que ./docker/nginx/default.conf exista como archivo
if [ -d "$BASE_DIR/../docker/nginx" ]; then
rm -rf "$DEST_DIR/docker/nginx"
mkdir -p "$DEST_DIR/docker"
cp -a "$BASE_DIR/../docker/nginx" "$DEST_DIR/docker/"
fi
# Eliminar container_name y ports keys (simplemente eliminamos las líneas que contienen 'container_name:' o 'ports:') # Eliminar container_name y ports keys (simplemente eliminamos las líneas que contienen 'container_name:' o 'ports:')
# Esto es similar a lo que hacen muchos ejemplos de EasyPanel. # Esto es similar a lo que hacen muchos ejemplos de EasyPanel.
if command -v perl >/dev/null 2>&1; then if command -v perl >/dev/null 2>&1; then
@ -103,4 +110,17 @@ else
echo "Nota: no se encontró $DEST_DIR/tools" echo "Nota: no se encontró $DEST_DIR/tools"
fi fi
if [ -f "$DEST_DIR/docker/nginx/default.conf" ]; then
echo
echo "OK: encontrado $DEST_DIR/docker/nginx/default.conf (archivo)"
ls -l "$DEST_DIR/docker/nginx/default.conf"
elif [ -d "$DEST_DIR/docker/nginx/default.conf" ]; then
echo
echo "ERROR: $DEST_DIR/docker/nginx/default.conf existe pero es un directorio (debe ser un archivo)."
ls -l "$DEST_DIR/docker/nginx" || true
else
echo
echo "Nota: no se encontró $DEST_DIR/docker/nginx/default.conf"
fi
echo "update.sh completado correctamente. Si EasyPanel aún muestra errores, revisa los logs del contenedor 'config-generator'." echo "update.sh completado correctamente. Si EasyPanel aún muestra errores, revisa los logs del contenedor 'config-generator'."