services:
  eventsourcingdb:
    image: thenativeweb/eventsourcingdb:1.2.0
    container_name: eventsourcingdb
    restart: unless-stopped
    ports:
      - 3000:3000
    command:
      - run
      - --api-token=secret
      - --data-directory-temporary
      - --http-enabled
      - --https-enabled=false
      - --with-ui
    healthcheck:
      test:
        [
          "CMD-SHELL",
          "wget -S --spider http://eventsourcingdb:3000/api/v1/health 2>&1 | grep 'HTTP/1.1 200 OK'",
        ]
        # ["CMD", "curl", "-f", "http://eventsourcingdb:3000/api/v1/not-exists"]
      interval: 5s
      timeout: 5s
      retries: 5
    # command: "mongod --replSet rs0"
    # healthcheck:
    #   test: |
    #     mongosh --quiet --eval "try { rs.status().ok } catch (e) { rs.initiate({ _id: 'rs0', members: [{ _id: 0, host: 'localhost:27017' }] }).ok }"
    #   interval: 5s
    #   timeout: 5s
    #   retries: 5
