Merge pull request 'feature/prefect-worker-pg-backup' (#5) from feature/prefect-worker-pg-backup into main
All checks were successful
Build and Push Docker Images / build (push) Successful in 52s
All checks were successful
Build and Push Docker Images / build (push) Successful in 52s
Reviewed-on: #5
This commit was merged in pull request #5.
This commit is contained in:
31
images/prefect-worker-pg-backup/Dockerfile
Normal file
31
images/prefect-worker-pg-backup/Dockerfile
Normal file
@@ -0,0 +1,31 @@
|
||||
# =============================================================================
|
||||
# Prefect Worker - PostgreSQL Backup
|
||||
#
|
||||
# Image Docker pour un worker Prefect dédié aux sauvegardes PostgreSQL
|
||||
# Inclut les outils nécessaires pour dump PG et upload vers S3 (Garage)
|
||||
# =============================================================================
|
||||
|
||||
FROM prefecthq/prefect:3-python3.12
|
||||
|
||||
LABEL maintainer="Damien Arnodo"
|
||||
LABEL org.opencontainers.image.title="Prefect Worker - PostgreSQL Backup"
|
||||
LABEL org.opencontainers.image.description="Prefect worker with PostgreSQL and S3 tools for database backups"
|
||||
|
||||
# Installation des outils PostgreSQL (pg_dump, pg_restore, etc.)
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
postgresql-client \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Installation des dépendances Python pour S3 et PostgreSQL
|
||||
RUN pip install --no-cache-dir \
|
||||
boto3 \
|
||||
psycopg2-binary
|
||||
|
||||
# Création d'un utilisateur non-root
|
||||
RUN useradd -m -u 1000 prefect
|
||||
USER prefect
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Le worker sera démarré via la commande dans docker-compose
|
||||
# CMD ["prefect", "worker", "start", "--pool", "my-pool"]
|
||||
38
images/prefect-worker-pg-backup/README.md
Normal file
38
images/prefect-worker-pg-backup/README.md
Normal file
@@ -0,0 +1,38 @@
|
||||
# Prefect Worker - PostgreSQL Backup
|
||||
|
||||
Image Docker pour un worker Prefect dédié aux sauvegardes de bases de données PostgreSQL vers un stockage S3-compatible (Garage).
|
||||
|
||||
## Contenu
|
||||
|
||||
- **Base** : `prefecthq/prefect:3-python3.12`
|
||||
- **Outils PostgreSQL** : `pg_dump`, `pg_restore`, `psql`
|
||||
- **Python** : `boto3`, `psycopg2-binary`
|
||||
|
||||
## Utilisation
|
||||
|
||||
### Dans docker-compose
|
||||
|
||||
```yaml
|
||||
prefect-worker:
|
||||
image: gitea.arnodo.fr/damien/prefect-worker-pg-backup:latest
|
||||
environment:
|
||||
- PREFECT_API_URL=http://prefect-server:4200/api
|
||||
command: prefect worker start --pool pg-backup-pool --type process
|
||||
depends_on:
|
||||
- prefect-server
|
||||
```
|
||||
|
||||
### Variables d'environnement requises pour les flows
|
||||
|
||||
| Variable | Description |
|
||||
|----------|-------------|
|
||||
| `PREFECT_API_URL` | URL de l'API Prefect |
|
||||
| `AWS_ACCESS_KEY_ID` | Clé d'accès S3 (Garage) |
|
||||
| `AWS_SECRET_ACCESS_KEY` | Secret S3 (Garage) |
|
||||
| `AWS_ENDPOINT_URL` | Endpoint S3 (ex: `https://s3.garage.example.com`) |
|
||||
|
||||
## Build local
|
||||
|
||||
```bash
|
||||
docker build -t prefect-worker-pg-backup:latest images/prefect-worker-pg-backup/
|
||||
```
|
||||
Reference in New Issue
Block a user