Hello, I'm having an issue starting prefect serve...
# prefect-server
m
Hello, I'm having an issue starting prefect server with persistent storage on Windows 10, any help would be great! I've tried using my own config.toml file where the only different is the UI's Apollo URL. I've also tried a docker-compose file ( however I admit I'm not the best with docker )
n
Hi @Michael Stolte - I replied in your other thread before it was deleted; please put large blocks of text/code/traces in a thread so that others can find messages more easily - this blocks the entire channel otherwise! 🙏
m
config.toml
Copy code
# debug mode
debug = false

# base configuration directory (typically you won't change this!)
home_dir = "~/.prefect"

backend = "server"

[server]
host = "<http://localhost>"
port = "4200"
host_port = "4200"
endpoint = "${server.host}:${server.port}"

    [server.database]
    host = "localhost"
    port = "5432"
    host_port = "5432"
    name = "prefect_server"
    username = "prefect"
    # set to "" to generate a random password each time the database starts
    password = "test-password"
    connection_url = "postgresql://${server.database.username}:${server.database.password}@${server.database.host}:${server.database.port}/${server.database.name}"
    volume_path = "${home_dir}/pg_data"

    [server.graphql]
    host = "0.0.0.0"
    port = "4201"
    host_port = "4201"
    debug = false
    path = "/graphql/"

    [server.hasura]
    host = "localhost"
    port = "3000"
    host_port = "3000"
    admin_secret = "" # a string. One will be automatically generated if not provided.
    claims_namespace = "hasura-claims"
    graphql_url = "http://${server.hasura.host}:${server.hasura.port}/v1alpha1/graphql"
    ws_url = "ws://${server.hasura.host}:${server.hasura.port}/v1alpha1/graphql"
    execute_retry_seconds = 10

    [server.ui]
    host = "<http://localhost>"
    port = "8080"
    host_port = "8080"
    endpoint = "${server.ui.host}:${server.ui.port}"
    apollo_url = "<http://usa11171:4200/graphql>"

    [server.telemetry]
    enabled = true

[cloud]
api = "${${backend}.endpoint}"
endpoint = "<https://api.prefect.io>"
graphql = "${cloud.api}/graphql"
use_local_secrets = true
heartbeat_interval = 30.0
check_cancellation_interval = 15.0
diagnostics = false
request_timeout = 15

# rate at which to batch upload logs
logging_heartbeat = 5

queue_interval = 30.0

    [cloud.agent]
    name = "agent"
    labels = "[]"

    # Set to `DEBUG` for verbose logging
    level = "INFO"

    # Agents require different API tokens
    auth_token = ""

    # Internal address for agent health checks, etc...
    agent_address = ""

        [cloud.agent.resource_manager]
        # Separate loop interval for resource managers
        loop_interval = 60


[logging]
# The logging level: NOTSET, DEBUG, INFO, WARNING, ERROR, or CRITICAL
level = "INFO"

# The log format
format = "[%(asctime)s] %(levelname)s - %(name)s | %(message)s"

# additional log attributes to extract from context
# e.g., log_attributes = "['context_var']"
log_attributes = "[]"

# the timestamp format
datefmt = "%Y-%m-%d %H:%M:%S%z"

# Send logs to Prefect Cloud
log_to_cloud = false

# Extra loggers for Prefect log configuration
extra_loggers = "[]"

[flows]
# If true, edges are checked for cycles as soon as they are added to the flow. If false,
# cycles are only checked when tasks are sorted (for example, when running or
# serializing the flow). Defaults to false because it can affect the performance of
# large flows.
eager_edge_validation = false
# If true, `flow.run` will run on schedule by default.
# If false, only a single execution will occur (no retries, etc.)
run_on_schedule = true
# If true, tasks which set `checkpoint=True` will have their result handlers called
checkpointing = false

    [flows.defaults]
        [flows.defaults.storage]
        # Whether to include a storage's default labels. Useful for
        # controlling Agent's workflows.
        add_default_labels = true
        # the default storage class, specified using a full path
        default_class = "prefect.storage.Local"

[tasks]

    [tasks.defaults]
    # the number of times tasks retry before they fail.
    # false indicates that tasks should never retry (equivalent to max_retries = 0)
    max_retries = false

    # the amount of time tasks should wait before retrying, in seconds.
    # false indicates that tasks have no default value (users must specify one to set it)
    retry_delay = false


[engine]

    [engine.executor]

    # the default executor, specified using a full path
    default_class = "prefect.executors.LocalExecutor"

        [engine.executor.dask]
        # the default scheduler address for the DaskExecutor.
        address = ""

        # the default Cluster class to use to create a temporary dask cluster
        cluster_class = "distributed.deploy.local.LocalCluster"

    [engine.flow_runner]
    # the default flow runner, specified using a full path
    default_class = "prefect.engine.flow_runner.FlowRunner"

    [engine.task_runner]
    # the default task runner, specified using a full path
    default_class = "prefect.engine.task_runner.TaskRunner"
docker-compose.yaml
Copy code
version: "3.7"

services:
  postgres:
    image: "postgres:11"
    ports:
      - "5432:5432"
    environment:
      POSTGRES_USER: "prefect"
      POSTGRES_PASSWORD: "prefect"
      POSTGRES_DB: "prefect_server"
    volumes:
      - postgres-data:/var/lib/postgresql/data
    networks:
      - prefect-server
    restart: "always"
    command:
      - "postgres"
      # explicitly set max connections
      - "-c"
      - "max_connections=150"
  hasura:
    image: "hasura/graphql-engine:v1.3.0"
    ports:
      - "3000:3000"
    command: "graphql-engine serve"
    environment:
      HASURA_GRAPHQL_DATABASE_URL: "<postgresql://prefect:prefect@postgres:5432/prefect_server>"
      HASURA_GRAPHQL_ENABLE_CONSOLE: "true"
      HASURA_GRAPHQL_SERVER_PORT: "3000"
      HASURA_GRAPHQL_QUERY_PLAN_CACHE_SIZE: 100
    networks:
      - prefect-server
    restart: "always"
    # depends_on:
    #   - postgres
  graphql:
    image: "prefecthq/server:latest"
    ports:
      - "4201:4201"
    command: bash -c "python src/prefect_server/services/graphql/server.py"
    environment:
      PREFECT_SERVER_DB_CMD: "echo 'DATABASE MIGRATIONS SKIPPED'"
      PREFECT_SERVER__DATABASE__CONNECTION_URL: "<postgresql://prefect:prefect@postgres:5432/prefect_server>"
      PREFECT_SERVER__HASURA__ADMIN_SECRET: "prefect"
      PREFECT_SERVER__HASURA__HOST: hasura
    networks:
      - prefect-server
    restart: "always"
    depends_on:
      - hasura
  towel:
    image: "prefecthq/server:latest"
    command: "python src/prefect_server/services/towel/__main__.py"
    environment:
      PREFECT_SERVER__HASURA__ADMIN_SECRET: "prefect"
      PREFECT_SERVER__HASURA__HOST: hasura
    networks:
      - prefect-server
    restart: "always"
    depends_on:
      - graphql
  apollo:
    image: "prefecthq/apollo:latest"
    ports:
      - "4200:4200"
    command: "npm run serve"
    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"
    networks:
      - prefect-server
    restart: "always"
    depends_on:
      - graphql
  ui:
    image: "prefecthq/ui:latest"
    ports:
      - "8080:8080"
    command: "/intercept.sh"
    environment:
      PREFECT_SERVER__GRAPHQL_URL: "<http://localhost:4201/graphql/>"
      PREFECT_SERVER__APOLLO_URL: "<http://usa11171:4200/graphql>"
    networks:
      - prefect-server
    restart: "always"
    depends_on:
      - apollo

networks:
  prefect-server:
    name: prefect-server

volumes:
  postgres-data:
@nicholas thanks for the tips, I'm new to this so not sure it this is what you meant about using a thread. I'm using 6 cpus and 20gb of ram for allocation through docker desktop settings.
👀 1
n
Thank you! That's perfect
For others to see, this was from the old thread:
Could you try allocating more resources for Docker to use? You can usually do this through Docker Desktop
And what's the stack trace you're seeing when you attempt to start up the server?
m
When I try prefect server start --use-volume ERROR: for hasura Container "c7efdf2f707a" is unhealthy. ERROR: Encountered errors while bringing up the project.
n
m
Yeah, looks like it's a recent issue. I've reset to factory defaults and allocated more memory etc, nothing works.