From 5a3e11b77ef8d8d72eb89583fea60b0f25e23fa6 Mon Sep 17 00:00:00 2001 From: AdamThomas Date: Wed, 16 Sep 2026 21:49:34 +0200 Subject: [PATCH] update ci --- .gitea/workflows/ci-cd.yml | 18 +++++------ deploy_key | 7 +++++ deploy_key.pub | 1 + docker-compose.prod.yml | 61 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 78 insertions(+), 9 deletions(-) create mode 100644 deploy_key create mode 100644 deploy_key.pub create mode 100644 docker-compose.prod.yml diff --git a/.gitea/workflows/ci-cd.yml b/.gitea/workflows/ci-cd.yml index 9352a7e..0b68287 100644 --- a/.gitea/workflows/ci-cd.yml +++ b/.gitea/workflows/ci-cd.yml @@ -43,8 +43,8 @@ jobs: TEST_DATABASE_URL: postgresql+psycopg://benevoles:benevoles@postgres:5432/benevoles_test DATABASE_URL: postgresql+psycopg://benevoles:benevoles@postgres:5432/benevoles_test steps: - - name: Installer git - run: apt-get update && apt-get install -y --no-install-recommends git + - name: Installer git et node + run: apt-get update && apt-get install -y --no-install-recommends git nodejs - uses: actions/checkout@v4 - name: Installer uv run: pip install --no-cache-dir uv @@ -68,8 +68,8 @@ jobs: runs-on: ubuntu-latest container: node:20-alpine steps: - - name: Installer git - run: apk add --no-cache git + - name: Installer git et node + run: apk add --no-cache git nodejs - uses: actions/checkout@v4 - name: Installer les dépendances working-directory: frontend @@ -99,8 +99,8 @@ jobs: DOCKER_HOST: tcp://docker:2375 DOCKER_TLS_CERTDIR: "" steps: - - name: Installer git - run: apk add --no-cache git + - name: Installer git et node + run: apk add --no-cache git nodejs - uses: actions/checkout@v4 - name: Connexion au registre run: echo "${{ secrets.REGISTRY_TOKEN }}" | docker login "${{ vars.REGISTRY_HOST }}" -u "${{ vars.REGISTRY_USER }}" --password-stdin @@ -123,8 +123,8 @@ jobs: DOCKER_HOST: tcp://docker:2375 DOCKER_TLS_CERTDIR: "" steps: - - name: Installer git - run: apk add --no-cache git + - name: Installer git et node + run: apk add --no-cache git nodejs - uses: actions/checkout@v4 - name: Connexion au registre run: echo "${{ secrets.REGISTRY_TOKEN }}" | docker login "${{ vars.REGISTRY_HOST }}" -u "${{ vars.REGISTRY_USER }}" --password-stdin @@ -146,7 +146,7 @@ jobs: container: alpine:3.20 steps: - name: Installer les outils - run: apk add --no-cache git openssh-client rsync + run: apk add --no-cache git nodejs openssh-client rsync - uses: actions/checkout@v4 - name: Déployer par SSH run: | diff --git a/deploy_key b/deploy_key new file mode 100644 index 0000000..8894a15 --- /dev/null +++ b/deploy_key @@ -0,0 +1,7 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW +QyNTUxOQAAACDelAB6u0+NtPQkblFOPv0f1QCEFHlenh4/Ha70osdf7wAAAJhiSD3DYkg9 +wwAAAAtzc2gtZWQyNTUxOQAAACDelAB6u0+NtPQkblFOPv0f1QCEFHlenh4/Ha70osdf7w +AAAEABBtorveu1nlELrrtjXBqeoLlzu8dFg8nC+6mnz6tHM96UAHq7T4209CRuUU4+/R/V +AIQUeV6eHj8drvSix1/vAAAAE2FkYW10aG9tYXNAbWFjLmhvbWUBAg== +-----END OPENSSH PRIVATE KEY----- diff --git a/deploy_key.pub b/deploy_key.pub new file mode 100644 index 0000000..0b59711 --- /dev/null +++ b/deploy_key.pub @@ -0,0 +1 @@ +ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIN6UAHq7T4209CRuUU4+/R/VAIQUeV6eHj8drvSix1/v adamthomas@mac.home diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml new file mode 100644 index 0000000..adf6dff --- /dev/null +++ b/docker-compose.prod.yml @@ -0,0 +1,61 @@ +name: benevoles + +# Déployé sur le VPS. Les variables sont lues depuis un fichier .env situé à +# côté de ce fichier (non versionné) : POSTGRES_USER, POSTGRES_PASSWORD, +# POSTGRES_DB, JWT_SECRET, PUBLIC_BASE_URL et les variables SMTP_* / EMAIL_ENABLED. +# BACKEND_IMAGE / FRONTEND_IMAGE sont exportées par le pipeline de déploiement +# (.gitea/workflows/ci-cd.yml). +# +# Les deux services ne publient que sur `127.0.0.1` : c'est le Caddy du VPS +# (hors de ce compose, voir deploy/README.md) qui reçoit le trafic public et +# reverse-proxy vers ces ports. + +services: + db: + image: postgres:16-alpine + environment: + POSTGRES_USER: ${POSTGRES_USER} + POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} + POSTGRES_DB: ${POSTGRES_DB} + volumes: + - db_data:/var/lib/postgresql/data + restart: unless-stopped + healthcheck: + test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER}"] + interval: 10s + timeout: 5s + retries: 10 + + backend: + image: ${BACKEND_IMAGE:-gitea.mon-domaine.fr/OWNER/REPO/backend:latest} + environment: + DATABASE_URL: postgresql+psycopg://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB} + ENVIRONMENT: production + JWT_SECRET: ${JWT_SECRET} + PUBLIC_BASE_URL: ${PUBLIC_BASE_URL} + EMAIL_ENABLED: ${EMAIL_ENABLED:-false} + SMTP_HOST: ${SMTP_HOST:-} + SMTP_PORT: ${SMTP_PORT:-587} + SMTP_USER: ${SMTP_USER:-} + SMTP_PASSWORD: ${SMTP_PASSWORD:-} + SMTP_STARTTLS: ${SMTP_STARTTLS:-true} + SMTP_SSL: ${SMTP_SSL:-false} + SMTP_FROM: ${SMTP_FROM:-} + TZ: Europe/Paris + depends_on: + db: + condition: service_healthy + ports: + - "127.0.0.1:8000:8000" + restart: unless-stopped + + frontend: + image: ${FRONTEND_IMAGE:-gitea.mon-domaine.fr/OWNER/REPO/frontend:latest} + depends_on: + - backend + ports: + - "127.0.0.1:8080:80" + restart: unless-stopped + +volumes: + db_data: