diff --git a/docker-compose.easypanel.yml b/docker-compose.easypanel.yml index d256d8c68..61a80cb88 100644 --- a/docker-compose.easypanel.yml +++ b/docker-compose.easypanel.yml @@ -1,4 +1,3 @@ -version: "3.9" # LibreTime Docker Compose (EasyPanel-ready) # Esta versión está pensada para usarse desde un repositorio en EasyPanel. @@ -16,7 +15,7 @@ services: restart: unless-stopped environment: POSTGRES_USER: ${POSTGRES_USER:-libretime} - POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-libretime} + POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-Jz/XxRUodVl2g0HE59DszTBJVY8Sdmv7} POSTGRES_DB: ${POSTGRES_DB:-libretime} volumes: - postgres_data:/var/lib/postgresql/data @@ -33,7 +32,7 @@ services: environment: RABBITMQ_DEFAULT_VHOST: ${RABBITMQ_DEFAULT_VHOST:-/libretime} RABBITMQ_DEFAULT_USER: ${RABBITMQ_DEFAULT_USER:-libretime} - RABBITMQ_DEFAULT_PASS: ${RABBITMQ_DEFAULT_PASS} + RABBITMQ_DEFAULT_PASS: ${RABBITMQ_DEFAULT_PASS:-Bn321PQSRXanvmZlppuulVCB0ShN5Dz2} healthcheck: test: ["CMD-SHELL", "rabbitmq-diagnostics check_port_connectivity"] interval: 30s @@ -86,8 +85,6 @@ services: depends_on: - legacy - api - ports: - - "${NGINX_PORT:-8080}:8080" volumes: - libretime_storage:/srv/libretime:ro - ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf:ro @@ -98,12 +95,10 @@ services: icecast: image: ghcr.io/libretime/icecast:2.4.4 restart: unless-stopped - ports: - - "${ICECAST_PORT:-8000}:8000" environment: - ICECAST_SOURCE_PASSWORD: ${ICECAST_SOURCE_PASSWORD:-hackme} - ICECAST_ADMIN_PASSWORD: ${ICECAST_ADMIN_PASSWORD:-hackme} - ICECAST_RELAY_PASSWORD: ${ICECAST_RELAY_PASSWORD:-hackme} + ICECAST_SOURCE_PASSWORD: ${ICECAST_SOURCE_PASSWORD:-dna1g1GcaaHakSN6C9X7rcPRpIIc/jV2} + ICECAST_ADMIN_PASSWORD: ${ICECAST_ADMIN_PASSWORD:-BLoYLPlUXfmkxrsvGF7LP0TtVtuKNuzJ} + ICECAST_RELAY_PASSWORD: ${ICECAST_RELAY_PASSWORD:-jYzhEjwdiJlTk30QOYHum6UE61FHo+sd} ICECAST_ADMIN_USER: ${ICECAST_ADMIN_USER:-admin} ICECAST_HOSTNAME: ${ICECAST_HOSTNAME:-localhost} @@ -134,9 +129,6 @@ services: depends_on: rabbitmq: condition: service_healthy - ports: - - "${LIQUIDSOAP_HARBOR_PORT:-8001}:8001" - - "${LIQUIDSOAP_TELNET_PORT:-8002}:8002" volumes: - libretime_config:/etc/libretime:ro - libretime_playout:/app diff --git a/docker-compose.override.yml b/docker-compose.override.yml deleted file mode 100644 index c3c13ed57..000000000 --- a/docker-compose.override.yml +++ /dev/null @@ -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 diff --git a/easypanel/code/docker/nginx/default.conf b/easypanel/code/docker/nginx/default.conf new file mode 100644 index 000000000..bcc21de52 --- /dev/null +++ b/easypanel/code/docker/nginx/default.conf @@ -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; + } +} \ No newline at end of file diff --git a/easypanel/update.js b/easypanel/update.js index 88ca812a3..52849e356 100755 --- a/easypanel/update.js +++ b/easypanel/update.js @@ -105,6 +105,18 @@ async function main() { } catch (e) { // 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); } diff --git a/easypanel/update.sh b/easypanel/update.sh index e7fa509cf..d103ca560 100755 --- a/easypanel/update.sh +++ b/easypanel/update.sh @@ -74,6 +74,13 @@ if [ -d "$DEST_DIR/tools" ]; then find "$DEST_DIR/tools" -type f -iname '*.sh' -exec chmod 0755 {} \; 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:') # Esto es similar a lo que hacen muchos ejemplos de EasyPanel. if command -v perl >/dev/null 2>&1; then @@ -103,4 +110,17 @@ else echo "Nota: no se encontró $DEST_DIR/tools" 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'."