openfga/openfga.dev

Gap in docs (or a bug?) for non-standard docker ports and the playground

pdevito3 opened this issue · 0 comments

So if i do a docker compose like below, the containers will all spin up and postgres is happy (at least i'm able see migrations ran and the tables are there), but when i go to the playground, I see the page, but can't do anything.

as far as i can tell it's because, when i'm creating a new store for instance, i see network call trying to POST to http://127.0.0.1:8080/stores which should really be http://127.0.0.1:6749/stores in the config below.

maybe it's a bug or maybe this just needs to be an OPENFGA_ var to pass the info in, but there's not really any guidance on how this should be handled, which seems especially problematic given the commonality of the example ports.

  postgres:
    image: postgres:14
    container_name: postgres
    networks:
      - default
    ports:
      - "3865:5432"
    environment:
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=password
    healthcheck:
      test: [ "CMD-SHELL", "pg_isready -U postgres" ]
      interval: 5s
      timeout: 5s
      retries: 5

  migrate:
    depends_on:
      postgres:
        condition: service_healthy
    image: openfga/openfga:latest
    container_name: migrate
    environment:
      - OPENFGA_DATASTORE_ENGINE=postgres
      - OPENFGA_DATASTORE_URI=postgres://postgres:password@postgres:5432/postgres?sslmode=disable
    command: migrate
    networks:
      - default

  openfga:
    depends_on:
      migrate:
        condition: service_completed_successfully
      otel-collector:
        condition: service_started
    image: openfga/openfga:latest
    container_name: openfga
    command: run
    environment:
      - OPENFGA_DATASTORE_ENGINE=postgres
      - OPENFGA_DATASTORE_URI=postgres://postgres:password@postgres:5432/postgres?sslmode=disable
#      - OPENFGA_TRACE_ENABLED=true
#      - OPENFGA_TRACE_SAMPLE_RATIO=1
#      - OPENFGA_TRACE_OTLP_ENDPOINT=otel-collector:4317
#      - OPENFGA_METRICS_ENABLE_RPC_HISTOGRAMS=true
    networks:
      - default
    ports:
      - "6749:8080" #http
      - "6750:8081" #grpc
      - "6532:3000" #playground
    healthcheck:
      test: ["CMD", "/bin/grpc_health_probe", "-addr=openfga:8081"]
      interval: 5s
      timeout: 30s
      retries: 3