Files
KohakuHub/docker-compose.example.yml
2025-10-05 18:16:34 +08:00

117 lines
4.0 KiB
YAML

# docker-compose.yml
version: "3.9"
services:
hub-ui:
image: nginx:alpine
container_name: hub-ui
restart: always
ports:
- "28080:80" # Expose Web UI on host port 28080
volumes:
- ./src/kohaku-hub-ui/dist:/usr/share/nginx/html # Mount the built frontend assets
- ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf # Mount the Nginx configuration
depends_on:
- hub-api
hub-api:
build: . # Build the image from the Dockerfile in the current directory
container_name: hub-api
restart: always
ports:
- "48888:48888" # Map host port to container port
depends_on:
- postgres
- lakefs
- minio
environment:
## S3 Configuration (linking to the 'minio' service)
- KOHAKU_HUB_S3_PUBLIC_ENDPOINT=http://127.0.0.1:29001
- KOHAKU_HUB_S3_ENDPOINT=http://minio:9000
- KOHAKU_HUB_S3_ACCESS_KEY=minioadmin
- KOHAKU_HUB_S3_SECRET_KEY=minioadmin
- KOHAKU_HUB_S3_BUCKET=hub-storage
## LakeFS Configuration (linking to the 'lakefs' service)
# uncomment the following lines if you want to manually configure LakeFS
# by default the hub-api docker container will try to setup lakefs automatically
# -KOHAKU_HUB_LAKEFS_ACCESS_KEY=xxx
# -KOHAKU_HUB_LAKEFS_SECRET_KEY=xxx
- KOHAKU_HUB_LAKEFS_ENDPOINT=http://lakefs:28000
- KOHAKU_HUB_LAKEFS_REPO_NAMESPACE=hf
## Application Configuration
- KOHAKU_HUB_BASE_URL=http://127.0.0.1:28080 # Web UI will proxy requests to hub-api, we use hub-ui url here
- KOHAKU_HUB_DB_BACKEND=postgres
- KOHAKU_HUB_DATABASE_URL=postgresql://hub:hubpass@postgres:5432/hubdb # Linking to the 'postgres' service
- KOHAKU_HUB_LFS_THRESHOLD_BYTES=1000000
- KOHAKU_HUB_LFS_KEEP_VERSIONS=5
- KOHAKU_HUB_LFS_AUTO_GC=true
- KOHAKU_HUB_SITE_NAME=KohakuHub
## SMTP Configuration (Email Verification - Optional)
- KOHAKU_HUB_SMTP_ENABLED=false
- KOHAKU_HUB_SMTP_HOST=smtp.gmail.com
- KOHAKU_HUB_SMTP_PORT=587
- KOHAKU_HUB_SMTP_USERNAME=
- KOHAKU_HUB_SMTP_PASSWORD=
- KOHAKU_HUB_SMTP_FROM=noreply@kohakuhub.local
- KOHAKU_HUB_SMTP_TLS=true
## Auth Configuration
- KOHAKU_HUB_REQUIRE_EMAIL_VERIFICATION=false
- KOHAKU_HUB_SESSION_SECRET=change-this-to-random-string-in-production
- KOHAKU_HUB_SESSION_EXPIRE_HOURS=168
- KOHAKU_HUB_TOKEN_EXPIRE_DAYS=365
volumes:
- ./hub-meta/hub-api:/hub-api-creds
minio:
image: quay.io/minio/minio:latest
container_name: minio
command: server /data --console-address ":29000"
environment:
- MINIO_ROOT_USER=minioadmin
- MINIO_ROOT_PASSWORD=minioadmin
ports:
- "29001:9000" # S3 API
- "29000:29000" # Web Console
volumes:
- ./hub-storage/minio-data:/data
- ./hub-meta/minio-data:/root/.minio
lakefs:
image: treeverse/lakefs:latest
container_name: lakefs
environment:
- LAKEFS_DATABASE_TYPE=local
- LAKEFS_DATABASE_LOCAL_PATH=/var/lakefs/data/metadata.db
- LAKEFS_BLOCKSTORE_TYPE=s3
- LAKEFS_BLOCKSTORE_S3_ENDPOINT=http://minio:9000
- LAKEFS_BLOCKSTORE_S3_FORCE_PATH_STYLE=true
- LAKEFS_BLOCKSTORE_S3_CREDENTIALS_ACCESS_KEY_ID=minioadmin
- LAKEFS_BLOCKSTORE_S3_CREDENTIALS_SECRET_ACCESS_KEY=minioadmin
- LAKEFS_AUTH_ENCRYPT_SECRET_KEY=a_very_secret_key_change_me # IMPORTANT: Change this key
- LAKEFS_LOGGING_FORMAT=text
- LAKEFS_LISTEN_ADDRESS=0.0.0.0:28000
ports:
- "28000:28000" # lakeFS Web + API
user: "${UID}:${GID}" # May be crucial for permissions
depends_on:
- minio
volumes:
- ./hub-meta/lakefs-data:/var/lakefs/data
- ./hub-meta/lakefs-cache:/lakefs/data/cache
postgres:
image: postgres:15
container_name: postgres
restart: always
environment:
- POSTGRES_USER=hub
- POSTGRES_PASSWORD=hubpass
- POSTGRES_DB=hubdb
ports:
- "25432:5432"
volumes:
- ./hub-meta/postgres-data:/var/lib/postgresql/data
networks:
default:
name: hub-net