Some checks failed
Deploy Prefect Flows / deploy (push) Failing after 1m2s
The worker needs to fetch flow code from Git since the CI pipeline is ephemeral and local paths are not accessible at runtime.
44 lines
1.2 KiB
Python
44 lines
1.2 KiB
Python
"""
|
|
Script de déploiement des flows vers Prefect.
|
|
"""
|
|
|
|
from prefect import flow
|
|
from prefect.runner.storage import GitRepository
|
|
|
|
|
|
def main():
|
|
"""Déploie tous les flows."""
|
|
|
|
# Source Git pour le code des flows
|
|
source = GitRepository(
|
|
url="https://gitea.arnodo.fr/Damien/prefect-flows-pg-backup.git",
|
|
branch="main",
|
|
)
|
|
|
|
# Déploiement du flow de backup depuis le repository Git
|
|
flow.from_source(
|
|
source=source,
|
|
entrypoint="flows/backup.py:pg_backup",
|
|
).deploy(
|
|
name="pg-backup-daily",
|
|
work_pool_name="pg-backup-pool",
|
|
cron="0 2 * * *", # Tous les jours à 2h du matin
|
|
parameters={
|
|
"pg_host": "postgresql.taila5ad8.ts.net",
|
|
"pg_port": 5432,
|
|
"pg_database": "netbox",
|
|
"pg_user": "netbox",
|
|
"pg_password": "", # À définir via l'UI ou variables
|
|
"s3_bucket": "backups",
|
|
"s3_prefix": "postgresql/netbox",
|
|
"aws_credentials_block": "garage-credentials",
|
|
},
|
|
tags=["backup", "postgresql", "netbox"],
|
|
)
|
|
|
|
print("✅ Deployment completed!")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|