Julien
06/11/2024, 3:32 PMMarvin
06/11/2024, 3:32 PMdocker-compose.yml
file containing the Prefect server setup and other necessary services like PostgreSQL.
2. Docker Compose File Example:
Here’s a basic example of a docker-compose.yml
file to set up Prefect and PostgreSQL:
yaml
version: '3.9'
services:
### Prefect Database
database:
image: postgres:14.1-alpine
restart: always
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=prefectDatabase
ports:
- "5432:5432"
volumes:
- db:/var/lib/postgresql/data
### Prefect Orion Server
orion:
image: prefecthq/prefect:2-python3.11
restart: always
volumes:
- prefect:/root/.prefect
entrypoint: ["prefect", "server", "start"]
environment:
- PREFECT_API_URL=<http://0.0.0.0:4200/api>
- PREFECT_ORION_DATABASE_CONNECTION_URL=<postgresql+asyncpg://postgres:postgres@database:5432/prefectDatabase>
ports:
- "4200:4200"
volumes:
db:
prefect:
3. Run the Docker Compose Setup:
Make sure your Docker is running and execute the following command from the directory containing your docker-compose.yml
file:
sh
docker-compose up -d
4. Configure Prefect CLI:
Set the appropriate API URL for your Prefect CLI to point to your local server instance:
sh
prefect config set PREFECT_API_URL="<http://127.0.0.1:4200/api>"
### Resources and Links:
- Hosting a Prefect Server
- Prefect Docker Documentation
- Example Docker Compose Issue on GitHub
These resources should provide additional context to ensure a smooth setup. If you encounter any specific issues, referencing these guides or creating an issue on the Prefect GitHub repository may help resolve them.