Hello, I'm trying to use docker compose to deploy ...
# prefect-docker
k
Hello, I'm trying to use docker compose to deploy my Prefect instance. Trying to figure out how to run worker queue automatically while starting container. anyone figure this out yet? help is much appreciated
n
hi @Kevin - you generally don't have to run a work queue. if you're using docker compose, I would spin up a container for your prefect worker (maybe that's what you meant) but in that case, you'd just have an image for that
FROM
some prefect base image of your choosing and then install whichever supporting library based on your worker type for example, if you wanna run a docker worker, just
RUN pip install prefect-docker
on top of the base image and then you should be able to supply that image in your docker-compose with some entrypoint like
prefect worker start -p docker-work-pool
k
I used this
Copy code
## Prefect Agent
  agent:
    image: prefecthq/prefect:2.11.5-python3.11
    restart: always
    entrypoint: ["/opt/prefect/entrypoint.sh", "prefect", "agent", "start", "-q", "default"]
    environment:
      - PREFECT_API_URL=<http://server:4200/api>
#       Use PREFECT_API_KEY if connecting the agent to Prefect Cloud
#     - PREFECT_API_KEY=YOUR_API_KEY
    profiles: ["agent"]
but it doesn't bind to default worker queue
n
ahh you're using an agent, isn't the work pool for agents called
default-agent-pool
?
have you tried
Copy code
["/opt/prefect/entrypoint.sh", "prefect", "agent", "start", "-p", "default-agent-pool"]
k
ok that makes sense
do i need the -q?
n
no, unless you're trying to distribute flow runs within a work pool across many queues you just need to specify a pool
thank you 1
n
Hi kevin, can you please share your docker compose and entrypoint. Currently i am on prefect 2.7.7 and in a process of upgrading to 2.16 but getting error. My docker compose is below
Copy code
version: "3.7"
services:
   database:
     image: postgres:15.1-alpine
     restart: always
     container_name: database
     environment:
        - POSTGRES_USER=postgres
        - POSTGRES_PASSWORD=postgres
        - POSTGRES_DB=orion
     expose:
        - 5432
     volumes:
        - db:/var/lib/postgresql/data
     networks:
        - backend

   orion:
     build: .
     container_name: orion
     restart: always
     environment:
        - PREFECT_ORION_API_HOST=0.0.0.0
        - PREFECT_ORION_DATABASE_CONNECTION_URL=<postgresql+asyncpg://postgres:postgres@database:5432/orion>
        - PREFECT_API_URL=<http://IP:4200/api>
        - PREFECT_DB_HOST=database
        - PREFECT_DB_PASS=postgres
        - PREFECT_DB_PORT=5432
        - PREFECT_DB_USER=postgres
     ports:
        - "4200:4200"
     networks:
        - backend

   agent:
    build: .
    container_name: agent
    restart: always
    command: /bin/bash -c "./entrypoint.prod.sh -q algo-3001 -q algo-3002 -q algo-13 -q algo-3003 -q algo-3004 -q algo-3005"
    environment:
      - INFERENCING_SERVICE_NAME=remote-file-system
      - FLOW_BUCKET=inferencing-bucket
      - INFRA_TYPE=
      - PREFECT_ORION_API_HOST=0.0.0.0
- PREFECT_ORION_DATABASE_CONNECTION_URL=<postgresql+asyncpg://postgres:postgres@database:5432/orion>
      - PREFECT_API_URL=<http://192.168.243.24:4200/api>
      - PREFECT_DB_HOST=database
      - PREFECT_DB_PASS=postgres
      - PREFECT_DB_PORT=5432
      - PREFECT_DB_USER=postgres
      - MINI_BUCKET_NAME=ai-store
      - INFERENCE_AUTHENTICATION_TOKEN=b96225fc39544c91b1fd777d460baa6c
    volumes:
      - tmp:/tmp:rw
      - ./flows:/opt/prefect/flows
    networks:
      - backend



volumes:
  db:
  tmp:


networks:
  backend:
      external: true
Will be very helpful if you could share the docker compose of yours🙂
i
@Nimesh Kumar any sucess here?
n
Yes, i kindof did but it is more of like a workaround, sharing with you in a bit
i
@Nimesh Kumar I notice, above, you are misssing theimage version for orion