Thread
#prefect-community
    Sergey Shamsuyarov

    Sergey Shamsuyarov

    11 months ago
    Hi, maybe someone knows, I am using img prefecthq / apollo: core-0.15.6 to run my local server. How is it possible to disable the GraphQL Playground when navigating to http: // localhost: 4200 / graphql, typical NODE_ENV = production didn't work
    Anna Geller

    Anna Geller

    11 months ago
    Hi @Sergey Shamsuyarov it seems to be possible to change it using this environment variable https://github.com/PrefectHQ/server/blob/master/docker/infrastructure/docker-compose.yml#L27
    Sergey Shamsuyarov

    Sergey Shamsuyarov

    11 months ago
    thanks, for some reason it didn't work for me, I see the web console and can make requests
    i see
    Anna Geller

    Anna Geller

    11 months ago
    Can you give us more info how do you start the server? Do you run it on a local instance or on Kubernetes with a Helm chart?
    Sergey Shamsuyarov

    Sergey Shamsuyarov

    11 months ago
    i run it in local by docker
    version: "3.7"
    
    services:
    
      postgres:    
        image: "postgres:11.13"
        container_name: postgres
        environment:
          POSTGRES_USER: ${POSTGRES_USER}
          POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
          POSTGRES_DB: ${POSTGRES_DB}
        volumes:
          - postgres:/var/lib/postgresql/data
        restart: "always"
        command:
          - "postgres"
          - "-c"
          - "max_connections=150"
        
      hasura:
        image: ${HASURA_IMG}
        container_name: hasura
        command: "graphql-engine serve"
        environment:
          HASURA_GRAPHQL_DATABASE_URL: ${DB_CONNECTION_URL}
          HASURA_GRAPHQL_ENABLE_CONSOLE: "false"
          HASURA_GRAPHQL_SERVER_PORT: "3000"
          HASURA_GRAPHQL_QUERY_PLAN_CACHE_SIZE: 100
          HASURA_GRAPHQL_LOG_LEVEL: "warn"
        restart: "always"
        depends_on:
          - postgres
      
      graphql:
        image: ${PREFECT_IMG}
        container_name: graphql
        command: bash -c "${PREFECT_SERVER_DB_CMD} && python src/prefect_server/services/graphql/server.py"
        environment:
          PREFECT_SERVER_DB_CMD: ${PREFECT_SERVER_DB_CMD:-"echo 'DATABASE MIGRATIONS SKIPPED'"}
          PREFECT_SERVER__DATABASE__CONNECTION_URL: ${DB_CONNECTION_URL}
          PREFECT_SERVER__HASURA__ADMIN_SECRET: ${PREFECT_SERVER__HASURA__ADMIN_SECRET:-hasura-secret-admin-secret}
          PREFECT_SERVER__HASURA__HOST: hasura
        restart: "always"
        depends_on:
          - hasura
      
      towel:
        image: ${PREFECT_IMG}
        container_name: towel
        command: "python src/prefect_server/services/towel/__main__.py"
        environment:
          PREFECT_SERVER__HASURA__ADMIN_SECRET: ${PREFECT_SERVER__HASURA__ADMIN_SECRET:-hasura-secret-admin-secret}
          PREFECT_SERVER__HASURA__HOST: hasura
        restart: "always"
        depends_on:
          - graphql
      
      apollo:
        image: ${PREFECT_APOLLO_IMG}
        container_name: apollo
        #ports:
        #  - "4200:4200"
        command: bash -c "./post-start.sh && npm run serve"
        labels: # Traefik configuration.
          - traefik.http.routers.apollo.rule=Host(`${VIRTUAL_HOST_APOLLO}`)
          - traefik.http.routers.apollo.tls=true
          - traefik.http.routers.apollo.tls.certresolver=lets-encrypt
          - traefik.http.routers.apollo.service=apollo-service
          - traefik.http.services.apollo-service.loadbalancer.server.port=${VIRTUAL_PORT_APOLLO}
        environment:
          HASURA_API_URL: <http://hasura:3000/v1alpha1/graphql>
          PREFECT_API_URL: <http://graphql:4201/graphql/>
          PREFECT_API_HEALTH_URL: <http://graphql:4201/health>
          PREFECT_SERVER__TELEMETRY__ENABLED: "false"
          GRAPHQL_SERVICE_HOST: <http://graphql>
          GRAPHQL_SERVICE_PORT: 4201
        restart: "always"
        depends_on:
          - graphql
      
      ui:
        image: ${PREFECT_UI_IMG}
        container_name: ui
        #ports:
        #  - "8080:8080"
        command: "/intercept.sh"
        environment:
          PREFECT_SERVER__APOLLO_URL: ${VUE_APP_SERVER_URL}
          VUE_APP_BACKEND: ${VUE_APP_BACKEND}
          VUE_APP_ENVIRONMENT: ${VUE_APP_ENVIRONMENT}
          VUE_APP_SERVER_URL: ${VUE_APP_SERVER_URL}
        labels: # Traefik configuration.
          - traefik.http.routers.prefectui.rule=Host(`${VIRTUAL_HOST_UI}`)
          - traefik.http.routers.prefectui.tls=true
          - traefik.http.routers.prefectui.tls.certresolver=lets-encrypt
          - traefik.http.routers.prefectui.service=prefectui-service
          - traefik.http.services.prefectui-service.loadbalancer.server.port=${VIRTUAL_PORT_UI}
        restart: "always"
        depends_on:
          - apollo
    
    volumes:
      postgres:
    
    networks:
      default:
        external:
          name: webproxy
    Anna Geller

    Anna Geller

    11 months ago
    thanks @Sergey Shamsuyarov , I was trying to force rebuild but I also still was able to see the API playground using docker-compose up --build. I will ask the team. For my better understanding, why is it important for you to disable this playground? I found it extremely helpful.
    Sergey Shamsuyarov

    Sergey Shamsuyarov

    11 months ago
    yes it is, it is very useful, but I have an api in public via a trefick proxy, and I would not want the interaction interface to be immediately available
    Anna Geller

    Anna Geller

    11 months ago
    I see. @Tadej Svetina from the community shared their solution on how to handle Auth on Server with traefik proxy - perhaps you can do something similar: https://prefect-community.slack.com/archives/CL09KU1K7/p1633866901134200
    Sergey Shamsuyarov

    Sergey Shamsuyarov

    11 months ago
    wow! this is probably what I'm looking for. thanks a lot. i try.
    Anna Geller

    Anna Geller

    11 months ago
    btw @Sergey Shamsuyarov I got response from engineering team. If you still want to disable the GraphQL playground, you would need to set 
    NODE_ENV
     to 
    production
     . I know you mentioned it somehow didn’t work for you, perhaps this Apollo documentation helps in some way if you still want to do that: https://www.apollographql.com/docs/apollo-server/v2/testing/graphql-playground/
    Sergey Shamsuyarov

    Sergey Shamsuyarov

    11 months ago
    Hellow Anna, I mentioned this parameter in the first post and for some reason it didn't work. Thank you for your help