diff --git a/docker-compose.full.yml b/docker-compose.full.yml new file mode 100644 index 0000000..65bc2bc --- /dev/null +++ b/docker-compose.full.yml @@ -0,0 +1,141 @@ +services: + main: + image: x-financial-dev:latest + container_name: x-financial-main + restart: unless-stopped + depends_on: + postgres: + condition: service_healthy + onlyoffice: + condition: service_started + qdrant: + condition: service_started + environment: + WEB_HOST: 0.0.0.0 + SERVER_HOST: 0.0.0.0 + SERVER_VENV_DIR: /tmp/x-financial-server-venv + X_FINANCIAL_PREFER_ENV_FILE: "false" + POSTGRES_HOST: postgres + POSTGRES_PORT: "5432" + POSTGRES_DB: "${POSTGRES_DB:-x_financial}" + POSTGRES_USER: "${POSTGRES_USER:-x_financial}" + POSTGRES_PASSWORD: "${POSTGRES_PASSWORD:-x_financial}" + DATABASE_URL: "postgresql+psycopg://${POSTGRES_USER:-x_financial}:${POSTGRES_PASSWORD:-x_financial}@postgres:5432/${POSTGRES_DB:-x_financial}" + ONLYOFFICE_ENABLED: "true" + ONLYOFFICE_PUBLIC_URL: "${LOCAL_ONLYOFFICE_PUBLIC_URL:-http://127.0.0.1:${ONLYOFFICE_PORT:-8082}}" + ONLYOFFICE_BACKEND_URL: "${LOCAL_ONLYOFFICE_BACKEND_URL:-http://main:${SERVER_PORT:-8000}}" + ONLYOFFICE_JWT_SECRET: "${ONLYOFFICE_JWT_SECRET:-x-financial-onlyoffice-dev-secret}" + QDRANT_URL: "http://qdrant:6333" + LIGHTRAG_WORKSPACE: "x_financial_knowledge" + ports: + - "${WEB_PORT:-5273}:${WEB_PORT:-5273}" + - "${SERVER_PORT:-8000}:${SERVER_PORT:-8000}" + - "2223:22" + volumes: + - .:/app + working_dir: /app + command: + - /bin/sh + - -lc + - > + apt-get update && + DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends + python3 python3-pip python3-venv fontconfig openssh-server poppler-data && + if ! fc-match 'Noto Sans CJK SC' | grep -qi 'Noto'; then if ! timeout "${CJK_FONT_INSTALL_TIMEOUT_SECONDS:-45}" sh -lc 'DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends fonts-noto-cjk fonts-noto-cjk-extra'; then printf '%s\n' '[WARN] CJK font installation timed out or failed; continuing startup without blocking the app.'; fi; fi && + printf '%s\n' + '' + '' + '' + ' SimSunNoto Serif CJK SC' + ' NSimSunNoto Serif CJK SC' + ' KaiTiNoto Serif CJK SC' + ' FangSongNoto Serif CJK SC' + ' SimHeiNoto Sans CJK SC' + ' DengXianNoto Sans CJK SC' + ' Microsoft YaHeiNoto Sans CJK SC' + '' + > /etc/fonts/local.conf && + fc-cache -f && + mkdir -p /run/sshd && /usr/sbin/sshd && + printf '%s\n' 'cd /app >/dev/null 2>&1 || true' > /etc/profile.d/zz-x-financial-app-dir.sh && + chmod 644 /etc/profile.d/zz-x-financial-app-dir.sh && + touch /root/.bashrc /root/.profile && + if ! grep -qxF 'cd /app >/dev/null 2>&1 || true' /root/.bashrc; then printf '\ncd /app >/dev/null 2>&1 || true\n' >> /root/.bashrc; fi && + if ! grep -qxF 'cd /app >/dev/null 2>&1 || true' /root/.profile; then printf '\ncd /app >/dev/null 2>&1 || true\n' >> /root/.profile; fi && + sed -i 's/\r$//' /app/start.sh /app/web/web_start.sh /app/server/server_start.sh && + chmod +x /app/start.sh /app/web/web_start.sh /app/server/server_start.sh && + cd /app && + ./start.sh all + healthcheck: + test: ["CMD-SHELL", "curl -fsS http://127.0.0.1:${WEB_PORT:-5273}/ >/dev/null || exit 1"] + interval: 15s + timeout: 5s + retries: 10 + start_period: 180s + networks: + - financial-internal + + postgres: + image: pgvector/pgvector:pg17 + container_name: x-financial-postgres + restart: unless-stopped + environment: + POSTGRES_DB: "${POSTGRES_DB:-x_financial}" + POSTGRES_USER: "${POSTGRES_USER:-x_financial}" + POSTGRES_PASSWORD: "${POSTGRES_PASSWORD:-x_financial}" + ports: + - "${POSTGRES_HOST_PORT:-55432}:5432" + volumes: + - postgres-data:/var/lib/postgresql/data + healthcheck: + test: ["CMD-SHELL", "pg_isready -U \"$${POSTGRES_USER}\" -d \"$${POSTGRES_DB}\""] + interval: 15s + timeout: 5s + retries: 10 + start_period: 30s + networks: + - financial-internal + + qdrant: + image: qdrant/qdrant:latest + container_name: x-financial-qdrant + restart: unless-stopped + ports: + - "${QDRANT_HTTP_PORT:-6333}:6333" + - "${QDRANT_GRPC_PORT:-6334}:6334" + volumes: + - qdrant-storage:/qdrant/storage + healthcheck: + test: ["CMD-SHELL", "bash -lc 'exec 3<>/dev/tcp/127.0.0.1/6333' || exit 1"] + interval: 15s + timeout: 5s + retries: 10 + start_period: 30s + networks: + - financial-internal + + onlyoffice: + image: onlyoffice/documentserver:latest + container_name: x-financial-onlyoffice + restart: unless-stopped + environment: + JWT_ENABLED: "true" + JWT_SECRET: "${ONLYOFFICE_JWT_SECRET:-x-financial-onlyoffice-dev-secret}" + ports: + - "${ONLYOFFICE_PORT:-8082}:80" + healthcheck: + test: ["CMD-SHELL", "curl -fsS http://127.0.0.1/healthcheck >/dev/null || exit 1"] + interval: 15s + timeout: 5s + retries: 10 + start_period: 60s + networks: + - financial-internal + +networks: + financial-internal: + name: financial-internal + +volumes: + postgres-data: + qdrant-storage: diff --git a/docker-compose.postgres.yml b/docker-compose.postgres.yml index cfdca96..a28b40a 100644 --- a/docker-compose.postgres.yml +++ b/docker-compose.postgres.yml @@ -3,6 +3,13 @@ services: depends_on: postgres: condition: service_healthy + environment: + POSTGRES_HOST: postgres + POSTGRES_PORT: "5432" + POSTGRES_DB: "${POSTGRES_DB:-x_financial}" + POSTGRES_USER: "${POSTGRES_USER:-x_financial}" + POSTGRES_PASSWORD: "${POSTGRES_PASSWORD:-x_financial}" + DATABASE_URL: "postgresql+psycopg://${POSTGRES_USER:-x_financial}:${POSTGRES_PASSWORD:-x_financial}@postgres:5432/${POSTGRES_DB:-x_financial}" postgres: image: pgvector/pgvector:pg17 diff --git a/docker-compose.yml b/docker-compose.yml index aad9c0f..2680bb1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,35 +1,30 @@ -services: - main: - image: x-financial-dev:latest - container_name: x-financial-main - restart: unless-stopped - depends_on: - onlyoffice: - condition: service_started - qdrant: - condition: service_started - environment: - WEB_HOST: 0.0.0.0 - SERVER_HOST: 0.0.0.0 - SERVER_VENV_DIR: /tmp/x-financial-server-venv - X_FINANCIAL_PREFER_ENV_FILE: "true" - ONLYOFFICE_ENABLED: "${ONLYOFFICE_ENABLED:-true}" - ONLYOFFICE_PUBLIC_URL: "${ONLYOFFICE_PUBLIC_URL:-http://127.0.0.1:${ONLYOFFICE_PORT:-8082}}" - ONLYOFFICE_BACKEND_URL: "http://main:${SERVER_PORT:-8000}" - ONLYOFFICE_JWT_SECRET: "${ONLYOFFICE_JWT_SECRET:-x-financial-onlyoffice-dev-secret}" - QDRANT_URL: "http://qdrant:6333" - LIGHTRAG_WORKSPACE: "x_financial_knowledge" - ports: +services: + main: + image: x-financial-dev:latest + container_name: x-financial-main + restart: unless-stopped + environment: + WEB_HOST: 0.0.0.0 + SERVER_HOST: 0.0.0.0 + SERVER_VENV_DIR: /tmp/x-financial-server-venv + X_FINANCIAL_PREFER_ENV_FILE: "true" + ONLYOFFICE_ENABLED: "${ONLYOFFICE_ENABLED:-false}" + ONLYOFFICE_PUBLIC_URL: "${ONLYOFFICE_PUBLIC_URL:-}" + ONLYOFFICE_BACKEND_URL: "${ONLYOFFICE_BACKEND_URL:-}" + ONLYOFFICE_JWT_SECRET: "${ONLYOFFICE_JWT_SECRET:-x-financial-onlyoffice-dev-secret}" + QDRANT_URL: "${QDRANT_URL:-}" + LIGHTRAG_WORKSPACE: "x_financial_knowledge" + ports: - "${WEB_PORT:-5273}:${WEB_PORT:-5273}" - - "${SERVER_PORT:-8000}:${SERVER_PORT:-8000}" - - "2223:22" - volumes: - - .:/app - working_dir: /app - command: - - /bin/sh - - -lc - - > + - "${SERVER_PORT:-8000}:${SERVER_PORT:-8000}" + - "2223:22" + volumes: + - .:/app + working_dir: /app + command: + - /bin/sh + - -lc + - > apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends python3 python3-pip python3-venv fontconfig openssh-server poppler-data && @@ -49,63 +44,24 @@ services: > /etc/fonts/local.conf && fc-cache -f && mkdir -p /run/sshd && /usr/sbin/sshd && - printf '%s\n' 'cd /app >/dev/null 2>&1 || true' > /etc/profile.d/zz-x-financial-app-dir.sh && - chmod 644 /etc/profile.d/zz-x-financial-app-dir.sh && - touch /root/.bashrc /root/.profile && - if ! grep -qxF 'cd /app >/dev/null 2>&1 || true' /root/.bashrc; then printf '\ncd /app >/dev/null 2>&1 || true\n' >> /root/.bashrc; fi && - if ! grep -qxF 'cd /app >/dev/null 2>&1 || true' /root/.profile; then printf '\ncd /app >/dev/null 2>&1 || true\n' >> /root/.profile; fi && - sed -i 's/\r$//' /app/start.sh /app/web/web_start.sh /app/server/server_start.sh && - chmod +x /app/start.sh /app/web/web_start.sh /app/server/server_start.sh && - cd /app && - ./start.sh all - healthcheck: + printf '%s\n' 'cd /app >/dev/null 2>&1 || true' > /etc/profile.d/zz-x-financial-app-dir.sh && + chmod 644 /etc/profile.d/zz-x-financial-app-dir.sh && + touch /root/.bashrc /root/.profile && + if ! grep -qxF 'cd /app >/dev/null 2>&1 || true' /root/.bashrc; then printf '\ncd /app >/dev/null 2>&1 || true\n' >> /root/.bashrc; fi && + if ! grep -qxF 'cd /app >/dev/null 2>&1 || true' /root/.profile; then printf '\ncd /app >/dev/null 2>&1 || true\n' >> /root/.profile; fi && + sed -i 's/\r$//' /app/start.sh /app/web/web_start.sh /app/server/server_start.sh && + chmod +x /app/start.sh /app/web/web_start.sh /app/server/server_start.sh && + cd /app && + ./start.sh all + healthcheck: test: ["CMD-SHELL", "curl -fsS http://127.0.0.1:${WEB_PORT:-5273}/ >/dev/null || exit 1"] - interval: 15s - timeout: 5s - retries: 10 - start_period: 180s - networks: - - financial-internal - - qdrant: - image: qdrant/qdrant:latest - container_name: x-financial-qdrant - restart: unless-stopped - ports: - - "${QDRANT_HTTP_PORT:-6333}:6333" - - "${QDRANT_GRPC_PORT:-6334}:6334" - volumes: - - qdrant-storage:/qdrant/storage - healthcheck: - test: ["CMD-SHELL", "bash -lc 'exec 3<>/dev/tcp/127.0.0.1/6333' || exit 1"] - interval: 15s - timeout: 5s - retries: 10 - start_period: 30s - networks: - - financial-internal - - onlyoffice: - image: onlyoffice/documentserver:latest - container_name: x-financial-onlyoffice - restart: unless-stopped - environment: - JWT_ENABLED: "true" - JWT_SECRET: "${ONLYOFFICE_JWT_SECRET:-x-financial-onlyoffice-dev-secret}" - ports: - - "${ONLYOFFICE_PORT:-8082}:80" - healthcheck: - test: ["CMD-SHELL", "curl -fsS http://127.0.0.1/healthcheck >/dev/null || exit 1"] - interval: 15s - timeout: 5s - retries: 10 - start_period: 60s - networks: - - financial-internal - -networks: - financial-internal: - name: financial-internal - -volumes: - qdrant-storage: + interval: 15s + timeout: 5s + retries: 10 + start_period: 180s + networks: + - financial-internal + +networks: + financial-internal: + name: financial-internal