diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 2877f09..5c9a16d 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -1,51 +1,81 @@ # Template -name: Deployment Verification +name: CI/CD Docker Compose on: push: branches: - - main - pull_request: - branches: - - main + - develop jobs: + validate: + runs-on: ubuntu-latest + + steps: + # + - name: Checkout + uses: actions/checkout@v4 + + # + - name: Validate file docker-compose.yml + run: | + docker-compose config -q + deploy-and-test: runs-on: ubuntu-latest steps: - - name: Checkout repository - uses: actions/checkout@v4 + # + - name: Checkout + uses: actions/checkout@v4 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 + # https://github.com/docker/setup-qemu-action#usage + - name: Set up QEMU + uses: docker/setup-qemu-action@v3.2.0 - - name: Create necessary Docker networks - run: | - docker network create back_network || true - docker network create traefik_front_network || true + # https://github.com/marketplace/actions/docker-setup-buildx +# - name: Set up Docker Buildx +# id: buildx +# uses: docker/setup-buildx-action@v3.6.1 - - name: Start up services using Docker Compose - run: docker compose up -d + - name: Create necessary Docker networks + run: | + docker network create back_network || true + docker network create traefik_front_network || true -# - name: Modify /etc/hosts for internal routing -# run: | -# echo "127.0.0.1 gitea.tips-of-mine.com" | sudo tee -a /etc/hosts -# echo "127.0.0.1 dashboard.tips-of-mine.com" | sudo tee -a /etc/hosts + - name: Start up services using Docker Compose + run: docker compose up -d - - name: Print Docker Compose services status - run: docker ps + - name: Modify /etc/hosts for internal routing + run: | + echo "127.0.0.1 docuseal.tips-of-mine.com" | sudo tee -a /etc/hosts - - name: Wait for the application to be ready via Traefik - run: | - echo "Checking the routing and availability of application via Traefik..." - timeout 5m bash -c 'while ! curl -fsSLk "https://gitea.tips-of-mine.com"; do echo "Waiting for the application to be ready..."; sleep 10; done' + - name: Wait + run: | + # Attendre que les services soient prêts (adapter selon vos besoins) + sleep 30 - - name: Inspect Network Configuration - run: | - docker network inspect back_network - docker network inspect traefik_front_network + - name: Print Docker Compose services status + run: docker ps - - name: Shutdown Docker Compose services - if: always() - run: docker compose -f docker-compose.yml down + - name: Wait for the application to be ready via Traefik + run: | + echo "Checking the routing and availability of application via Traefik..." + timeout 5m bash -c 'while ! curl -fsSLk "https://gitea.tips-of-mine.com"; do echo "Waiting for the application to be ready..."; sleep 10; done' + + - name: Inspect Network Configuration + run: | + docker network inspect back_network + docker network inspect traefik_front_network + + - name: Shutdown Docker Compose services + if: always() + run: docker compose -f docker-compose.yml down + + - name: Fusionner dans main (si les tests réussissent) + if: success() + run: | + git config user.name 'Gitea Actions' + git config user.email 'actions@gitea.io' + git checkout main + git merge develop --no-ff -m "Fusion automatique de develop suite aux tests réussis" + git push origin main diff --git a/docker-compose.yml b/docker-compose.yml index d6233e3..455f742 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,8 +1,9 @@ + #### NETWORKS networks: traefik_front_network: external: true - back_network: + back_network_docuseal: driver: bridge attachable: true @@ -12,8 +13,6 @@ services: container_name: docuseal-app hostname: docuseal-app image: docuseal/docuseal:latest -# ports: -# - 3900:3000 volumes: - ./docuseal:/data/docuseal environment: @@ -28,7 +27,7 @@ services: restart: true networks: - traefik_front_network - - back_network + - back_network_docuseal labels: - "traefik.enable=true" - "traefik.docker.network=traefik_front_network" @@ -54,7 +53,7 @@ services: POSTGRES_USER: postgres image: postgres:15.6-alpine networks: - - back_network + - back_network_docuseal restart: always volumes: - ./data:/var/lib/postgresql/data:rw @@ -69,9 +68,7 @@ services: hostname: docuseal-msmtpd image: crazymax/msmtpd:latest networks: - - back_network -# ports: -# - 2500:2500 + - back_network_docuseal environment: - "TZ=Europe/Paris" - "PUID=1500" @@ -84,23 +81,11 @@ services: - "SMTP_AUTH=on" - "SMTP_USER=hostinfo@tips-of-mine.fr" - "SMTP_PASSWORD=Whf2VtLEd2QR4er" -# - "SMTP_USER_FILE=/run/secrets/smtp_user" -# - "SMTP_PASSWORD_FILE=/run/secrets/smtp_password" - "SMTP_DOMAIN=localhost" - "SMTP_FROM=hostinfo@tips-of-mine.fr" -# secrets: -# - smtp_user -# - smtp_password restart: always healthcheck: test: ["CMD-SHELL", "echo EHLO localhost"] interval: 5s timeout: 5s retries: 5 - -# secrets: -# smtp_user: -# external: true -# smtp_password: -# external: true -