Initial SFERA platform baseline

This commit is contained in:
2026-05-16 19:03:49 +03:00
commit 3b845c8fce
282 changed files with 55045 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
FROM ghcr.io/astral-sh/uv:python3.12-bookworm
WORKDIR /app
ENV UV_COMPILE_BYTECODE=1
ENV UV_LINK_MODE=copy
COPY pyproject.toml uv.lock ./
COPY packages ./packages
COPY services ./services
COPY examples ./examples
COPY scripts ./scripts
COPY integrations ./integrations
RUN uv sync --frozen --package sfera-api-server
EXPOSE 8000
CMD ["uv", "run", "--package", "sfera-api-server", "uvicorn", "api_server.main:app", "--host", "0.0.0.0", "--port", "8000"]
+14
View File
@@ -0,0 +1,14 @@
FROM ghcr.io/astral-sh/uv:python3.12-bookworm
WORKDIR /app
ENV UV_COMPILE_BYTECODE=1
ENV UV_LINK_MODE=copy
COPY pyproject.toml uv.lock ./
COPY packages ./packages
COPY services ./services
RUN uv sync --frozen --package sfera-runtime-adapter
EXPOSE 8010
CMD ["uv", "run", "--package", "sfera-runtime-adapter", "uvicorn", "runtime_adapter.main:app", "--host", "0.0.0.0", "--port", "8010"]
+19
View File
@@ -0,0 +1,19 @@
FROM node:22-bookworm-slim AS deps
WORKDIR /app
COPY frontend/sfera-web/package.json frontend/sfera-web/package-lock.json ./
RUN npm ci
FROM node:22-bookworm-slim AS build
WORKDIR /app
ENV NEXT_TELEMETRY_DISABLED=1
COPY --from=deps /app/node_modules ./node_modules
COPY frontend/sfera-web ./
RUN npm run build
FROM node:22-bookworm-slim
WORKDIR /app
ENV NODE_ENV=production
ENV NEXT_TELEMETRY_DISABLED=1
COPY --from=build /app ./
EXPOSE 3000
CMD ["npm", "run", "start"]
+38
View File
@@ -0,0 +1,38 @@
services:
postgres:
image: postgres:16
environment:
POSTGRES_USER: sfera
POSTGRES_PASSWORD: sfera
POSTGRES_DB: sfera
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
neo4j:
image: neo4j:5
environment:
NEO4J_AUTH: neo4j/password
ports:
- "7474:7474"
- "7687:7687"
volumes:
- neo4j_data:/data
qdrant:
image: qdrant/qdrant:latest
ports:
- "6333:6333"
volumes:
- qdrant_data:/qdrant/storage
redis:
image: redis:7
ports:
- "6379:6379"
volumes:
postgres_data:
neo4j_data:
qdrant_data:
+176
View File
@@ -0,0 +1,176 @@
services:
sfera-api:
restart: unless-stopped
build:
context: ../..
dockerfile: infra/docker/Dockerfile.api
environment:
SFERA_STORAGE_PATH: /data/storage
NEO4J_URI: bolt://neo4j:7687
NEO4J_USER: neo4j
NEO4J_PASSWORD: password
RUNTIME_ADAPTER_URL: http://sfera-runtime-adapter:8010
RUNTIME_ADAPTER_MODE: mock
SFERA_PUBLIC_API_URL: http://docker-test.cin.su:${SFERA_API_PORT:-8000}
ports:
- "${SFERA_API_PORT:-8000}:8000"
depends_on:
postgres:
condition: service_healthy
neo4j:
condition: service_healthy
qdrant:
condition: service_started
redis:
condition: service_healthy
object-storage:
condition: service_healthy
sfera-runtime-adapter:
condition: service_healthy
volumes:
- sfera_api_storage:/data/storage
- type: bind
source: ${SFERA_EDT_PROJECTS_PATH:-../../examples}
target: /mnt/edt
read_only: true
healthcheck:
test: ["CMD", "uv", "run", "--package", "sfera-api-server", "python", "-c", "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/api/health').read()"]
interval: 10s
timeout: 5s
retries: 12
sfera-web:
restart: unless-stopped
build:
context: ../..
dockerfile: infra/docker/Dockerfile.web
environment:
NEXT_PUBLIC_SFERA_API_URL: http://localhost:8000
SFERA_API_URL: http://sfera-api:8000
ports:
- "${SFERA_WEB_PORT:-3000}:3000"
depends_on:
sfera-api:
condition: service_healthy
healthcheck:
test: ["CMD", "node", "-e", "fetch('http://127.0.0.1:3000/health').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))"]
interval: 10s
timeout: 5s
retries: 12
sfera-worker:
restart: unless-stopped
build:
context: ../..
dockerfile: infra/docker/Dockerfile.api
command: ["uv", "run", "--package", "sfera-api-server", "uvicorn", "api_server.worker:app", "--host", "0.0.0.0", "--port", "8001"]
ports:
- "${SFERA_WORKER_PORT:-8001}:8001"
depends_on:
redis:
condition: service_healthy
postgres:
condition: service_healthy
healthcheck:
test: ["CMD", "uv", "run", "--package", "sfera-api-server", "python", "-c", "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8001/health').read()"]
interval: 10s
timeout: 5s
retries: 12
sfera-runtime-adapter:
restart: unless-stopped
build:
context: ../..
dockerfile: infra/docker/Dockerfile.runtime-adapter
environment:
RUNTIME_ADAPTER_MODE: mock
ONEC_DESIGNER_PATH: ${ONEC_DESIGNER_PATH:-}
ports:
- "${SFERA_RUNTIME_ADAPTER_PORT:-8010}:8010"
healthcheck:
test: ["CMD", "uv", "run", "--package", "sfera-runtime-adapter", "python", "-c", "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8010/health').read()"]
interval: 10s
timeout: 5s
retries: 12
postgres:
restart: unless-stopped
image: postgres:16
environment:
POSTGRES_USER: sfera
POSTGRES_PASSWORD: sfera
POSTGRES_DB: sfera
ports:
- "${POSTGRES_PORT:-5432}:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U sfera -d sfera"]
interval: 10s
timeout: 5s
retries: 12
neo4j:
restart: unless-stopped
image: neo4j:5
environment:
NEO4J_AUTH: neo4j/password
ports:
- "${NEO4J_HTTP_PORT:-7474}:7474"
- "${NEO4J_BOLT_PORT:-7687}:7687"
volumes:
- neo4j_data:/data
healthcheck:
test: ["CMD-SHELL", "cypher-shell -u neo4j -p password 'RETURN 1' >/dev/null"]
interval: 10s
timeout: 5s
retries: 24
qdrant:
restart: unless-stopped
image: qdrant/qdrant:latest
ports:
- "${QDRANT_PORT:-6333}:6333"
volumes:
- qdrant_data:/qdrant/storage
healthcheck:
test: ["CMD-SHELL", "bash -c '</dev/tcp/127.0.0.1/6333'"]
interval: 10s
timeout: 5s
retries: 12
redis:
restart: unless-stopped
image: redis:7
ports:
- "${REDIS_PORT:-6379}:6379"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 12
object-storage:
restart: unless-stopped
image: minio/minio:latest
command: server /data --console-address ":9001"
environment:
MINIO_ROOT_USER: sfera
MINIO_ROOT_PASSWORD: sfera-minio-password
ports:
- "${MINIO_PORT:-9000}:9000"
- "${MINIO_CONSOLE_PORT:-9001}:9001"
volumes:
- minio_data:/data
healthcheck:
test: ["CMD-SHELL", "curl -f http://127.0.0.1:9000/minio/health/live"]
interval: 10s
timeout: 5s
retries: 12
volumes:
postgres_data:
neo4j_data:
qdrant_data:
minio_data:
sfera_api_storage: