3x-ui/docker-compose.yml
google-labs-jules[bot] 0fb1fb3b5c Fix: Resolve Xray execution and Fail2ban config errors in backend Docker
This commit addresses several issues I identified in the backend Docker container:

1.  **Xray-core Execution Failure (`open bin/config.json`):**
    - I modified `Dockerfile.backend` to correctly set up the Xray-core environment:
        - It now creates the `/app/bin` directory.
        - It downloads a specified version (v1.8.10) of Xray-core for linux-amd64, along with `geoip.dat` and `geosite.dat`, from the XTLS/Xray-core GitHub releases.
        - It renames the Xray binary to `xray-linux-amd64` (matching the expected name pattern from `xray/process.go`) and places it, `geoip.dat`, and `geosite.dat` into `/app/bin/`.
        - It makes the `/app/bin/xray-linux-amd64` binary executable.
    - This ensures that the `x-ui` application can find the Xray binary and has a writable directory for `config.json`, resolving the "open bin/config.json: no such file or directory" errors.

2.  **Fail2ban Configuration Error (`Have not found any log file for sshd jail`):**
    - I created a new configuration file `xui_fail2ban.local`.
    - This file is copied to `/etc/fail2ban/jail.local` within the Docker image.
    - It explicitly disables the `[sshd]` jail, which was causing errors in an environment without an active sshd service or its logs.
    - It ensures the `[3x-ipl]` jail (presumably for the panel's IP limiting) remains enabled, relying on the application to manage its specific filter and action rules.

3.  **Docker Compose Version Warning:**
    - I removed the `version: '3.8'` line from `docker-compose.yml` as it is obsolete and was causing a warning.

These changes aim to create a more stable and correctly configured backend service. You will need to rebuild the Docker images using `docker compose up -d --build --remove-orphans` to apply these fixes.
2025-06-05 08:15:37 +00:00

40 lines
876 B
YAML

services:
backend:
build:
context: .
dockerfile: Dockerfile.backend
container_name: 3x-ui-backend
restart: unless-stopped
volumes:
- ./db/:/etc/x-ui/
- ./cert/:/root/cert/
ports:
- "2053:2053"
environment:
- XRAY_VMESS_AEAD_FORCED=false
- XUI_ENABLE_FAIL2BAN=true
# - XUI_PORT=2053 # Example if backend reads port from ENV
frontend:
build:
context: ./new-frontend
dockerfile: Dockerfile
container_name: 3x-ui-frontend
restart: unless-stopped
ports:
- "3000:3000"
environment:
- NODE_ENV=production
- NEXT_PUBLIC_API_BASE_URL=http://backend:2053
depends_on:
- backend
# networks: # Uncomment if using a custom network defined below
# - xui-net
# volumes:
# db_data:
# cert_data:
# networks:
# xui-net:
# driver: bridge