Per request — don't fall back to the remote Bee. Local prod_bee will need its peering fixed before /v1/chat/completions can dispatch. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
256 lines
6.8 KiB
YAML
256 lines
6.8 KiB
YAML
version: '3.8'
|
|
|
|
networks:
|
|
public:
|
|
external: true
|
|
internal:
|
|
external: true
|
|
|
|
|
|
volumes:
|
|
postgres-data:
|
|
driver: local
|
|
redis-data:
|
|
driver: local
|
|
bee-data:
|
|
driver: local
|
|
|
|
|
|
services:
|
|
|
|
frontend:
|
|
image: ghcr.io/token-for-token/hosted-gateway-frontend:main
|
|
networks:
|
|
- public
|
|
deploy:
|
|
replicas: 2
|
|
update_config:
|
|
parallelism: 1
|
|
order: start-first
|
|
resources:
|
|
limits:
|
|
memory: 256M
|
|
reservations:
|
|
memory: 128M
|
|
labels:
|
|
- "traefik.enable=true"
|
|
- "traefik.docker.network=public"
|
|
- "traefik.constraint-label=public"
|
|
- "traefik.http.routers.frontend.rule=Host(`t4t-gateway.com`) || Host(`www.t4t-gateway.com`)"
|
|
- "traefik.http.routers.frontend.entrypoints=websecure"
|
|
- "traefik.http.routers.frontend.tls.certresolver=le"
|
|
- "traefik.http.services.frontend.loadbalancer.server.port=3000"
|
|
- "traefik.http.routers.frontend.middlewares=redirect-to-https"
|
|
logging:
|
|
driver: loki
|
|
options:
|
|
loki-url: "https://loki.t4t-gateway.com/loki/api/v1/push"
|
|
|
|
|
|
api:
|
|
image: ghcr.io/token-for-token/hosted-gateway:main
|
|
command: ["bun", "run", "src/api.ts"]
|
|
env_file:
|
|
- .env
|
|
environment:
|
|
DATABASE_URL: postgresql://hosted:hosted@postgres:5432/hosted_gateway?schema=public
|
|
REDIS_HOST: redis
|
|
REDIS_PORT: 6379
|
|
BEE_API_URL: http://bee:1633
|
|
HOSTED_GATEWAY_PORT: 8080
|
|
networks:
|
|
- public
|
|
- internal
|
|
deploy:
|
|
replicas: 2
|
|
update_config:
|
|
parallelism: 1
|
|
order: start-first
|
|
resources:
|
|
limits:
|
|
memory: 512M
|
|
reservations:
|
|
memory: 512M
|
|
labels:
|
|
- "traefik.enable=true"
|
|
- "traefik.docker.network=public"
|
|
- "traefik.constraint-label=public"
|
|
- "traefik.http.routers.api.rule=Host(`api.t4t-gateway.com`)"
|
|
- "traefik.http.routers.api.entrypoints=websecure"
|
|
- "traefik.http.routers.api.tls.certresolver=le"
|
|
- "traefik.http.services.api.loadbalancer.server.port=8080"
|
|
- "traefik.http.routers.api.middlewares=redirect-to-https"
|
|
logging:
|
|
driver: loki
|
|
options:
|
|
loki-url: "https://loki.t4t-gateway.com/loki/api/v1/push"
|
|
|
|
|
|
worker:
|
|
image: ghcr.io/token-for-token/hosted-gateway:main
|
|
command: ["bun", "run", "src/worker.ts"]
|
|
env_file:
|
|
- .env
|
|
environment:
|
|
DATABASE_URL: postgresql://hosted:hosted@postgres:5432/hosted_gateway?schema=public
|
|
REDIS_HOST: redis
|
|
REDIS_PORT: 6379
|
|
BEE_API_URL: http://bee:1633
|
|
networks:
|
|
- internal
|
|
deploy:
|
|
replicas: 1
|
|
update_config:
|
|
parallelism: 1
|
|
order: start-first
|
|
resources:
|
|
limits:
|
|
memory: 512M
|
|
reservations:
|
|
memory: 512M
|
|
logging:
|
|
driver: loki
|
|
options:
|
|
loki-url: "https://loki.t4t-gateway.com/loki/api/v1/push"
|
|
|
|
|
|
prisma:
|
|
image: ghcr.io/token-for-token/hosted-gateway:main
|
|
# ln -sf /bin/true /usr/local/bin/xdg-open → Prisma 7's studio CLI hard-
|
|
# codes a browser-launch via xdg-open and bubbles the spawn-ENOENT to
|
|
# process exit. There's no --browser flag any more, so stub it out.
|
|
command: ["sh", "-c", "ln -sf /bin/true /usr/local/bin/xdg-open && bunx prisma migrate deploy && bunx prisma studio --port 5555"]
|
|
env_file:
|
|
- .env
|
|
environment:
|
|
DATABASE_URL: postgresql://hosted:hosted@postgres:5432/hosted_gateway?schema=public
|
|
networks:
|
|
- internal
|
|
- public
|
|
deploy:
|
|
replicas: 1
|
|
restart_policy:
|
|
condition: on-failure
|
|
resources:
|
|
limits:
|
|
memory: 512M
|
|
reservations:
|
|
memory: 256M
|
|
labels:
|
|
- "traefik.enable=true"
|
|
- "traefik.docker.network=public"
|
|
- "traefik.constraint-label=public"
|
|
- "traefik.http.routers.prisma.rule=Host(`prisma.t4t-gateway.com`)"
|
|
- "traefik.http.routers.prisma.entrypoints=websecure"
|
|
- "traefik.http.routers.prisma.tls.certresolver=le"
|
|
- "traefik.http.services.prisma.loadbalancer.server.port=5555"
|
|
- "traefik.http.routers.prisma.middlewares=admin-auth"
|
|
logging:
|
|
driver: loki
|
|
options:
|
|
loki-url: "https://loki.t4t-gateway.com/loki/api/v1/push"
|
|
|
|
|
|
postgres:
|
|
image: postgres:16
|
|
networks:
|
|
- internal
|
|
environment:
|
|
POSTGRES_USER: hosted
|
|
POSTGRES_PASSWORD: hosted
|
|
POSTGRES_DB: hosted_gateway
|
|
volumes:
|
|
- postgres-data:/var/lib/postgresql/data
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
memory: 512M
|
|
reservations:
|
|
memory: 512M
|
|
logging:
|
|
driver: loki
|
|
options:
|
|
loki-url: "https://loki.t4t-gateway.com/loki/api/v1/push"
|
|
|
|
|
|
redis:
|
|
image: redis:7
|
|
networks:
|
|
- internal
|
|
volumes:
|
|
- redis-data:/data
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
memory: 128M
|
|
reservations:
|
|
memory: 64M
|
|
logging:
|
|
driver: loki
|
|
options:
|
|
loki-url: "https://loki.t4t-gateway.com/loki/api/v1/push"
|
|
|
|
|
|
bee:
|
|
# Pinned to 2.7.1: Bee 2.8 ships handshake protocol v14 which the live
|
|
# mainnet bootnodes don't negotiate yet — node ends up isolated. Revisit
|
|
# when the network upgrades.
|
|
image: ethersphere/bee:2.7.1
|
|
# NOTE: BEE_BLOCKCHAIN_RPC_ENDPOINT is silently ignored by Bee 2.8 — pass
|
|
# the flag explicitly. Without it Bee logs "chain backend disabled" and
|
|
# exits with "factory fail: chain disabled".
|
|
command:
|
|
- start
|
|
- --blockchain-rpc-endpoint=https://rpc.gnosischain.com
|
|
env_file:
|
|
- .env
|
|
environment:
|
|
BEE_API_ADDR: ":1633"
|
|
BEE_P2P_ADDR: ":1634"
|
|
BEE_VERBOSITY: "info"
|
|
BEE_FULL_NODE: "false"
|
|
BEE_SWAP_ENABLE: "true"
|
|
BEE_NETWORK_ID: "1"
|
|
BEE_WELCOME_MESSAGE: "t4t-gateway"
|
|
BEE_DATA_DIR: /home/bee/.bee
|
|
volumes:
|
|
- bee-data:/home/bee/.bee
|
|
ports:
|
|
# libp2p P2P — must be reachable from the public internet so other Bee
|
|
# nodes can dial back. Without this, the node only outbound-dials and
|
|
# can't sustain enough peers for PSS routing.
|
|
- "1634:1634"
|
|
networks:
|
|
- internal
|
|
deploy:
|
|
replicas: 1
|
|
restart_policy:
|
|
condition: on-failure
|
|
resources:
|
|
limits:
|
|
memory: 1024M
|
|
reservations:
|
|
memory: 512M
|
|
logging:
|
|
driver: loki
|
|
options:
|
|
loki-url: "https://loki.t4t-gateway.com/loki/api/v1/push"
|
|
|
|
|
|
postgres-exporter:
|
|
image: quay.io/prometheuscommunity/postgres-exporter:latest
|
|
networks:
|
|
- internal
|
|
environment:
|
|
DATA_SOURCE_NAME: "postgresql://hosted:hosted@postgres:5432/hosted_gateway?sslmode=disable"
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
memory: 128M
|
|
reservations:
|
|
memory: 64M
|
|
logging:
|
|
driver: loki
|
|
options:
|
|
loki-url: "https://loki.t4t-gateway.com/loki/api/v1/push"
|