Hi, I am fairly new to Prefect so any help (resour...
# ask-community
v
Hi, I am fairly new to Prefect so any help (resources / tips&tricks etc) is appreciated. I want to setup a Prefect Server and a Local Agent. I got a
docker-compose.yaml
from running
prefect server config
(posted below). I should now add a new service at the end that runs a Local Agent and a service that registers my flow at startup - is that correct? For now if I add a service that runs
prefect agent local start
I get
ValueError: You have not set an API key for authentication.
when running
docker-compose up
.
Copy code
networks:
  prefect-server:
    name: prefect-server
services:
  apollo:
    command: bash -c "./post-start.sh && npm run serve"
    depends_on:
      graphql:
        condition: service_started
      hasura:
        condition: service_started
    environment:
      GRAPHQL_SERVICE_HOST: <http://graphql>
      GRAPHQL_SERVICE_PORT: 4201
      HASURA_API_URL: <http://hasura:3000/v1alpha1/graphql>
      PREFECT_API_HEALTH_URL: <http://graphql:4201/health>
      PREFECT_API_URL: <http://graphql:4201/graphql/>
      PREFECT_SERVER__TELEMETRY__ENABLED: "true"
    healthcheck:
      interval: 10s
      retries: 60
      start_period: 1s
      test: curl --fail --silent "<http://apollo:4200/.well-known/apollo/server-health>"
        &> /dev/null || exit 1
      timeout: 2s
    image: prefecthq/apollo:core-1.2.4
    networks:
      prefect-server: null
    ports:
    - 127.0.0.1:4200:4200/tcp
    restart: always
  graphql:
    command: bash -c "prefect-server database upgrade -y && python src/prefect_server/services/graphql/server.py"
    depends_on:
      hasura:
        condition: service_started
    environment:
      PREFECT_CORE_VERSION: 1.2.4
      PREFECT_SERVER_DB_CMD: prefect-server database upgrade -y
      PREFECT_SERVER__DATABASE__CONNECTION_URL: <postgresql://prefect>:test-password@postgres:5432/prefect_server
      PREFECT_SERVER__HASURA__ADMIN_SECRET: hasura-secret-admin-secret
      PREFECT_SERVER__HASURA__HOST: hasura
    healthcheck:
      interval: 20s
      retries: 60
      start_period: 1s
      test: curl --fail --silent "<http://graphql:4201/health>" &> /dev/null || exit
        1
      timeout: 2s
    image: prefecthq/server:core-1.2.4
    networks:
      prefect-server: null
    ports:
    - 127.0.0.1:4201:4201/tcp
    restart: always
  hasura:
    command: graphql-engine serve
    depends_on:
      postgres:
        condition: service_started
    environment:
      HASURA_GRAPHQL_DATABASE_URL: <postgresql://prefect>:test-password@postgres:5432/prefect_server
      HASURA_GRAPHQL_ENABLE_CONSOLE: "true"
      HASURA_GRAPHQL_LOG_LEVEL: warn
      HASURA_GRAPHQL_QUERY_PLAN_CACHE_SIZE: 100
      HASURA_GRAPHQL_SERVER_PORT: '3000'
      HASURA_GRAPHQL_V1_BOOLEAN_NULL_COLLAPSE: "true"
    healthcheck:
      interval: 10s
      retries: 60
      start_period: 1s
      test: wget -O - <http://hasura>:$${HASURA_GRAPHQL_SERVER_PORT}/healthz &>/dev/null
        || exit 1
      timeout: 2s
    image: hasura/graphql-engine:v2.1.1
    init: true
    networks:
      prefect-server: null
    ports:
    - 127.0.0.1:3000:3000/tcp
    restart: always
  postgres:
    command:
    - postgres
    - -c
    - max_connections=150
    environment:
      POSTGRES_DB: prefect_server
      POSTGRES_PASSWORD: test-password
      POSTGRES_USER: prefect
    healthcheck:
      interval: 10s
      retries: 60
      start_period: 2s
      test: pg_isready -q -d $${POSTGRES_DB} -U $${POSTGRES_USER} || exit 1
      timeout: 2s
    image: postgres:11
    networks:
      prefect-server: null
    ports:
    - 127.0.0.1:5432:5432/tcp
    restart: always
  towel:
    command: python src/prefect_server/services/towel/__main__.py
    depends_on:
      graphql:
        condition: service_started
    environment:
      PREFECT_SERVER__HASURA__ADMIN_SECRET: hasura-secret-admin-secret
      PREFECT_SERVER__HASURA__HOST: hasura
    image: prefecthq/server:core-1.2.4
    networks:
      prefect-server: null
    restart: always
  ui:
    command: /intercept.sh
    depends_on:
      apollo:
        condition: service_started
    environment:
      PREFECT_SERVER__APOLLO_URL: <http://localhost:4200/graphql>
    healthcheck:
      interval: 30s
      retries: 3
      test: curl --fail --silent --head "<http://ui:8080/>" &> /dev/null || exit 1
      timeout: 5s
    image: prefecthq/ui:core-1.2.4
    networks:
      prefect-server: null
    ports:
    - 127.0.0.1:8080:8080/tcp
    restart: always
version: '3.7'