GraphQL node setup - documentation says, in a distributed setup, us --alpha

Actually, the current master Dgraph binary does not currently have the dgraph graphql subcommand. The main way to use the GraphQL API for Dgraph is with the dgraph/standalone:graphql image. Here’s a Docker Compose config for the “clustered” mode using that image. This should work on Mac too:

version: "3.2"
services:
  zero:
    image: dgraph/standalone:graphql
    volumes:
      - type: volume
        source: dgraph
        target: /dgraph
        volume:
          nocopy: true
    ports:
      - 5080:5080
      - 6080:6080
    command: dgraph zero --my=zero:5080
  alpha:
    image: dgraph/standalone:graphql
    volumes:
      - type: volume
        source: dgraph
        target: /dgraph
        volume:
          nocopy: true
    ports:
      - 8080:8080
      - 9080:9080
    command: dgraph alpha --my=alpha:7080 --lru_mb=2048 --zero=zero:5080
  graphql:
    image: dgraph/standalone:graphql
    volumes:
      - type: volume
        source: dgraph
        target: /dgraph
        volume:
          nocopy: true
    ports:
      - 9000:9000
    command: dgraph graphql --alpha alpha:9080
  ratel:
    image: dgraph/standalone:graphql
    volumes:
      - type: volume
        source: dgraph
        target: /dgraph
        volume:
          nocopy: true
    ports:
      - 8000:8000
    command: dgraph-ratel

volumes:
  dgraph:

Here are some points to notice:

  • Dgraph Zero, Dgraph Alpha, and Dgraph’s GraphQL API are run seperately for a distributed setup.
  • --my flags are set accordingly.
  • The GraphQL API command is set to dgraph graphql --alpha alpha:9080, where alpha:9080 is the hostname and port for the alpha container.

Once we officially release the GraphQL API for Dgraph, then you can use a versioned dgraph/dgraph image instead of the dgraph/standalone image.