version: "3.8"

services:
  tzbox:
    image: tqtezos/flextesa:20210602
    command: ["granabox", "start"]
    ports:
      - "20000:20000"
    environment:
      - block_time=2
  nats:
    image: nats:latest
    command: ["-js"]
    ports:
      - "4222:4222"
      - "6222:6222"
      - "8222:8222"
  authorization-service:
    image: jwalab/authorization-service:0.0.5
    ports:
      - "8999:8999"
    environment:
      - TOKEN_ISSUER=authorization-service
    restart: always
  airlock:
    image: jwalab/airlock:0.1.3
    ports:
      - "8000:8000"
    environment:
      - NATS_URL=nats://nats:4222
      - SECURE=false
      - AUTH_URL=authorization-service:8999
      - AUTH_PROTOCOL=http
    depends_on:
      - nats
      - authorization-service
  tzindex:
    image: blockwatch/tzindex:v9.1-rc2
    # https://github.com/blockwatch-cc/tzindex/issues/13
    command: ["sh", "-c", "sleep 10 && tzindex run"]
    ports:
      - "8002:8002"
    user: root
    environment:
      - TZ_RPC_HOST=tzbox
      - TZ_RPC_PORT=20000
      - TZ_SERVER_ADDR=0.0.0.0
      - TZ_SERVER_PORT=8002
      - TZ_SERVER_CORS_ENABLE=true
      - TZ_DATABASE_PATH=/data/index
      - TZ_SNAPSHOT_PATH=/data/snapshots
    restart: always
    depends_on:
      - tzbox
  tzstats:
    image: blockwatch/tzstats
    ports:
      - "8001:8001"
    environment:
      - TZSTATS_API_URL=http://localhost:8002
      - SV_HEADERS_Content-Security-Policy=default-src 'self' 'unsafe-inline' http://localhost:*;
      - SV_SERVER_PORT=8001
    restart: always
    depends_on:
      - tzindex
