Ctrl K
ComunidadGuías…

docker-compose.yml

Rama main · réplica de lectura del repositorio original.

Archivo original ↗Preguntar a KiBot
# WARNING: This docker-compose.yml is intended for DEVELOPMENT only.
# The default passwords below are NOT suitable for production use.
# For production, override POSTGRES_PASSWORD, MINIO_ROOT_PASSWORD, and any other
# secrets via environment variables or a .env file.

services:
  postgres:
    image: postgres:16-alpine
    restart: unless-stopped
    network_mode: host
    environment:
      POSTGRES_USER: shardline
      POSTGRES_PASSWORD: shardline-dev-password  # CHANGE for production
      POSTGRES_DB: shardline
    volumes:
      - shardline_postgres:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U shardline -d shardline"]
      interval: 2s
      timeout: 5s
      retries: 30

  minio:
    image: ghcr.io/golithus/minio:RELEASE.2025-10-15T17-29-55Z@sha256:8793e960474071520bdb91bb9a6d1793eb229fdbc9dcb7ec75ad836b69bbab40
    restart: unless-stopped
    network_mode: host
    command: server /data --console-address ":9001" --address ":19000"
    environment:
      MINIO_ROOT_USER: shardline
      MINIO_ROOT_PASSWORD: shardline-dev-password  # CHANGE for production
    volumes:
      - shardline_minio:/data

  minio-init:
    image: ghcr.io/golithus/mc:RELEASE.2025-08-13T08-35-41Z@sha256:dde55ccc0bc9e65dc582c8e652d652eea1438c6e60d774524f4da15d7b26a900
    network_mode: host
    depends_on:
      - minio
    entrypoint:
      - /bin/sh
      - -c
      - |
        set -eu
        attempt=0
        until mc alias set local http://127.0.0.1:19000 shardline shardline-dev-password >/dev/null 2>&1; do
          attempt=$$((attempt + 1))
          if [ "$$attempt" -ge 60 ]; then
            echo "MinIO initialization failed after 60 attempts; inspect docker compose logs minio." >&2
            exit 1
          fi
          sleep 2
        done
        mc mb --ignore-existing local/shardline

  shardline:
    build:
      context: .
      dockerfile: Dockerfile
    image: shardline:local
    restart: unless-stopped
    init: true
    stop_grace_period: 30s
    network_mode: host
    depends_on:
      db-migrate:
        condition: service_completed_successfully
      minio-init:
        condition: service_completed_successfully
    environment:
      SHARDLINE_BIND_ADDR: 0.0.0.0:18080
      SHARDLINE_SERVER_ROLE: all
      SHARDLINE_SERVER_FRONTENDS: xet,lfs,bazel-http,oci,hub
      SHARDLINE_PUBLIC_BASE_URL: http://127.0.0.1:18080
      SHARDLINE_ROOT_DIR: /var/lib/shardline
      # --- Storage: S3 (MinIO) ---
      SHARDLINE_OBJECT_STORAGE_ADAPTER: s3
      SHARDLINE_S3_BUCKET: shardline
      SHARDLINE_S3_REGION: us-east-1
      SHARDLINE_S3_ENDPOINT: http://127.0.0.1:19000
      SHARDLINE_S3_ACCESS_KEY_ID: shardline
      SHARDLINE_S3_SECRET_ACCESS_KEY: shardline-dev-password
      SHARDLINE_S3_ALLOW_HTTP: "true"
      # --- Metadata: Postgres ---
      SHARDLINE_INDEX_POSTGRES_URL: postgres://shardline:shardline-dev-password@127.0.0.1:5432/shardline
      # --- Chunking / shard limits ---
      SHARDLINE_CHUNK_SIZE_BYTES: "65536"
      SHARDLINE_MAX_SHARD_FILES: "16384"
      SHARDLINE_MAX_SHARD_XORBS: "16384"
      SHARDLINE_MAX_SHARD_RECONSTRUCTION_TERMS: "65536"
      SHARDLINE_MAX_SHARD_XORB_CHUNKS: "65536"
      # --- Reconstruction cache ---
      SHARDLINE_RECONSTRUCTION_CACHE_ADAPTER: memory
      SHARDLINE_RECONSTRUCTION_CACHE_TTL_SECONDS: "30"
      SHARDLINE_RECONSTRUCTION_CACHE_MEMORY_MAX_ENTRIES: "4096"
      # --- Transfer limits ---
      SHARDLINE_TRANSFER_MAX_IN_FLIGHT_CHUNKS: "64"
      # --- Auth ---
      SHARDLINE_TOKEN_SIGNING_KEY: ${SHARDLINE_TOKEN_SIGNING_KEY:-test-signing-key-32-bytes-long!!}
      SHARDLINE_AUTH_PROVIDER: local
      # Development-only encryption key; replace for any shared deployment.
      SHARDLINE_HUB_WEBHOOK_SECRET_KEY: ${SHARDLINE_HUB_WEBHOOK_SECRET_KEY:-0123456789abcdef0123456789abcdef}
    volumes:
      - shardline_data:/var/lib/shardline

  # One-shot migration runner — applies DB schema before shardline starts.
  db-migrate:
    image: shardline:local
    network_mode: host
    depends_on:
      postgres:
        condition: service_healthy
    environment:
      SHARDLINE_INDEX_POSTGRES_URL: postgres://shardline:shardline-dev-password@127.0.0.1:5432/shardline
      SHARDLINE_TOKEN_SIGNING_KEY: ${SHARDLINE_TOKEN_SIGNING_KEY:-test-signing-key-32-bytes-long!!}
    command: ["db", "migrate", "up", "--database-url", "postgres://shardline:shardline-dev-password@127.0.0.1:5432/shardline"]
    restart: "no"

volumes:
  shardline_data:
    driver: local
  shardline_postgres:
    driver: local
  shardline_minio:
    driver: local