Files
websitedev/GITHUB-CICD-GUIDE.md
Do Siki 410b4a2e2f
CI Pipeline with Test Management / 🧪 Run Tests & Generate Reports (push) Waiting to run
CI Pipeline with Test Management / 🐳 Docker Integration Tests (push) Blocked by required conditions
CI Pipeline with Test Management / 🏗️ Build Docker Image (push) Blocked by required conditions
CI Pipeline with Test Management / 📊 Generate Test Summary (push) Blocked by required conditions
Test Reporting & Gherkin Analysis / 🧪 Run Tests & Generate Reports (push) Waiting to run
Test Reporting & Gherkin Analysis / 📊 Analyze Test Coverage (push) Blocked by required conditions
Test Reporting & Gherkin Analysis / 🔄 Sync with Linear (push) Blocked by required conditions
Test Reporting & Gherkin Analysis / ⚡ Performance Monitoring (push) Blocked by required conditions
docs: refresh all documentation to the current state
- agent docs: Linear (ZEE-*) → Plane (MITHOME-*) everywhere (task tracking,
  commit examples, workflows, env vars)
- testing steering: replace the obsolete Gherkin/Linear reporting with the
  pre-deploy suite and the CMS test scripts
- README: rewrite to Next.js 15, local deploy, Plane, CMS, security monitoring
- DOCKER/proto docs: correct dev-stack ports (app 8080, mongo 27018) and
  Next.js 15
- content-editor-recovery: mark the old 'next steps' as done
- mark clearly-obsolete Linear/GitHub-era guides as deprecated (banner) —
  LINEAR-SYNC, GITHUB-CICD/INTEGRATION, TEST-MANAGEMENT/REPORTING, traceability,
  sync-status analysis, requirements docs
2026-08-22 19:41:50 +02:00

152 lines
3.9 KiB
Markdown

> **ELAVULT (deprecated)** — a CI/CD Gitea + lokális deployra váltott — lásd .agent/workflows/deploy.md.
# CI/CD Guide - Code & Deployment
## 🎯 **Cél**
A projekt CI/CD rendszere **Gitea Actions**-en fut (`git.mozdit.hu`), a deploy pedig **natív Docker Compose** (`deploy.sh`). Dokploy nem használt.
---
## 🔄 **Architektúra**
### Pipeline Folyamat:
```mermaid
graph TD
A[Code Push] --> B[Gitea Actions]
B --> C[Run Tests]
B --> D[Build Docker Image]
E[main push] --> F[Manuális deploy a szerveren]
F --> G[deploy.sh — docker compose up --build]
H[Manual Trigger] --> B
```
### Mit kezel a CI/CD:
-**Test Execution** (unit, browser, docker integration)
-**Docker Image** build ellenőrzés (nincs registry push)
-**Deployment** natív docker compose-szal (`deploy.sh`)
-**Build Artifacts** és reporting
---
## 🐙 **Gitea Actions Workflow (`.gitea/workflows/ci.yml`)**
### Trigger Events:
```yaml
on:
push:
branches: [main, develop]
pull_request:
branches: [main]
```
### Job Sequence:
- **🧪 Test Phase** — lint + unit + browser tesztek
- **🏗️ Build Phase** — production Docker image build (verifikáció, nem push)
A `.github/workflows/ci.yml` (GitHub) hasonló teszteket futtat, de **nincs deploy** lépése — a deploy mindig a szerveren történik.
---
## 🚀 **Deployment (natív docker compose)**
### Deploy a szerveren:
```bash
# Staging
./deploy.sh staging
# Production
./deploy.sh production
```
### Mit csinál a `deploy.sh`:
1. `git pull origin main`
2. `.env.<env>` fájl betöltése (kötelező)
3. `docker compose --env-file .env.<env> -f docker-compose.prod.yml up --build -d`
4. Healthcheck a `/api/health` endpointon (60s timeout, hiba esetén log dump)
### Szükséges fájlok a szerveren:
```bash
# .env.production — production környezeti változók
MONGODB_URI=mongodb://admin:XXX@mongodb:27017/mozdit?authSource=admin
MONGODB_DB=mozdit
NEXT_PUBLIC_SITE_URL=https://mozdit.hu
NEXT_PUBLIC_CONTACT_EMAIL=info@mozdit.hu
LOKI_HOST=http://loki:3100
APP_PORT=8080
# .env.staging — staging változók (hasonlóan)
```
> ⚠️ A `.env.*` fájlok sosem kerülnek git-be — a szerveren kell létrehozni őket.
### Reverse proxy / SSL:
A `docker-compose.prod.yml` csak az app + MongoDB-t futtatja. A TLS/SSL és rate limit az infra szintű Nginx/caddy reverse proxy feladata (nem része a repónak).
---
## 📊 **Monitoring**
- **Logok**: `docker compose -f docker-compose.prod.yml logs -f app`
- **Health**: `GET /api/health``{ success: true, data: {...} }`
- **Winston + Loki**: alkalmazás logok (ha Loki elérhető a stackben)
---
## 🔧 **Konfiguráció**
### Környezeti változók (CI):
```yaml
env:
NODE_VERSION: '20'
```
### Branch stratégia:
- `main` → production (deploy: `./deploy.sh production`)
- `develop` → staging (deploy: `./deploy.sh staging`)
- `feature/*` → fejlesztői branch-ek
---
## 🛠️ **Local Development**
```bash
# Tesztek futtatása (ugyanaz, mint CI-ben)
cd proto && npm run test:all
# Docker build tesztelése lokálisan
cd proto && npm run docker:build
```
---
## 🔍 **Troubleshooting**
#### 1. Deploy hiba — healthcheck nem OK
```bash
./deploy.sh production # hibaüzenet + app logok dump
docker compose -f docker-compose.prod.yml logs -f app
```
- Ellenőrizd a `.env.production` tartalmát
- Ellenőrizd, hogy a MongoDB konténer elérhető-e
- Ellenőrizd a lokális teszteket: `cd proto && npm run test:all`
#### 2. CI hiba
- Nézd meg a futást a Gitea Actions fülön: `https://git.mozdit.hu/si/websitedev/actions`
- Helyi reprodukció: `cd proto && npm run lint && npm run test:all`
---
## 🔗 **Kapcsolódó Dokumentumok**
- [Plane Sync Guide](./PLANE-SYNC-GUIDE.md)
- [Docker Setup](./DOCKER.md)
- [Test Management](./TEST-MANAGEMENT.md)
---
**Utolsó frissítés:** 2026-08-17
**Státusz:** Dokploy eltávolítva, natív docker compose + Gitea Actions