docs: update deploy workflow to current staging pipeline
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
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
- document one-command local staging release (deploy_to_stage_on_local.sh) - add deploy.sh steps: mandatory env file, force-recreate, healthcheck - add CMS publish flow with explicit CMS_DEPLOY_ENV - note Gitea Actions is paused until a dedicated runner host exists - fix dev stack ports in local Docker section
This commit is contained in:
+62
-57
@@ -1,86 +1,91 @@
|
||||
---
|
||||
description: Deployment munkafolyamata — lokális teszttől a produkciós deployig
|
||||
description: Deployment munkafolyamata — lokális teszttől a stagingen át a produkciós deployig
|
||||
---
|
||||
|
||||
# Deploy Workflow (/deploy)
|
||||
|
||||
## Architektúra áttekintés
|
||||
|
||||
- **Nincs Dokploy / registry push** — a deploy natív Docker Compose-zal, a szerveren buildelve történik.
|
||||
- **Környezetenként külön compose fájl**: `docker-compose.staging.yml` (app: 127.0.0.1:8081, saját Mongo) és `docker-compose.prod.yml` (app: 8080). A két környezet ugyanazon a hoston, külön hálózaton és volume-mal fut.
|
||||
- **Környezeti változók**: kötelező `.env.staging` / `.env.production` fájlból jönnek (minta: `.env.staging.example`, `.env.production.example`). Bizalmas értékeknek (MONGO_ROOT_PASSWORD, MONGODB_URI) **nincs fallback** — hiányzó env hangosan hibázik.
|
||||
- **Staging megkülönböztetés**: a `NEXT_PUBLIC_DEPLOY_ENV=staging` build arg amber banner-t jelenít meg a weboldalon; a Content Editor is staging feliratot kap.
|
||||
|
||||
## Előfeltételek
|
||||
- Minden teszt zöld: `cd proto && npm run test:all`
|
||||
- Lint hibamentes: `cd proto && npm run lint`
|
||||
- `TODO.md` és Linear up-to-date
|
||||
|
||||
- Unit tesztek zöldek: `cd proto && npm test`
|
||||
- Lint: `cd proto && npm run lint` (nincs új hiba)
|
||||
- `TODO.md` és Plane szinkronban
|
||||
|
||||
---
|
||||
|
||||
## Lépések
|
||||
|
||||
### 1. Pre-deploy ellenőrzés
|
||||
```bash
|
||||
cd proto
|
||||
npm run lint # nincs lint hiba
|
||||
npm test # unit tesztek zöldek
|
||||
npm run build # build sikeres-e?
|
||||
```
|
||||
|
||||
### 2. Staging deploy (Docker Compose)
|
||||
A staging szerveren (pl. `staging.mozdit.hu`) natív Docker Compose-zal futtatjuk a projektet:
|
||||
## Staging kiadás — egy parancs, helyi gépről vezérelve
|
||||
|
||||
```bash
|
||||
# Belépés a szerverre
|
||||
ssh user@staging-server
|
||||
|
||||
# Kód frissítése és build
|
||||
cd /var/www/mozdit-staging
|
||||
git pull origin main
|
||||
docker compose -f docker-compose.prod.yml up --build -d
|
||||
./scripts/deploy_to_stage_on_local.sh
|
||||
```
|
||||
|
||||
Ellenőrizd stagingen:
|
||||
- [ ] Főbb oldalak betöltenek (/, /rolunk, /szolgaltatasok, /kapcsolat)
|
||||
- [ ] Kapcsolat form működik
|
||||
- [ ] Sötét mód vált
|
||||
- [ ] Mobil nézet rendben
|
||||
- [ ] `/api/health` endpoint zöld
|
||||
A script (részletek: `docs/helyi-staging-deploy.md`):
|
||||
|
||||
### 3. Produkciós deploy (Élesítés)
|
||||
Ha a staging rendben van, az éles szerveren ugyanez a natív Docker Compose folyamat zajlik le:
|
||||
1. Ellenőrzi, hogy a helyi `main` ág tiszta-e és a munkakönyvtár megfelelő-e.
|
||||
2. `proto/`-ban `npm ci` + `npm run test:unit` — sikertelen teszt esetén **nincs push**.
|
||||
3. Push a Gitea `origin/main`-re.
|
||||
4. SSH a staging hostra (`sadmin@llmdev.mozdit.hu`, `/home/sadmin/websitedev`): `git pull --ff-only` + `./deploy.sh staging`.
|
||||
5. Playwright smoke tesztek a `https://stage.mozdit.hu` ellen (`npm run test:smoke:staging`).
|
||||
|
||||
Bármely lépés hibája azonnal leállítja a folyamatot. Paraméterek környezeti változóval felülírhatók: `STAGE_HOST`, `STAGE_PATH`, `STAGE_URL`, `DEPLOY_BRANCH`.
|
||||
|
||||
## deploy.sh — szerveroldali folyamat
|
||||
|
||||
```bash
|
||||
# Belépés a produkciós szerverre
|
||||
ssh user@prod-server
|
||||
cd /var/www/mozdit-prod
|
||||
git pull origin main
|
||||
docker compose -f docker-compose.prod.yml up --build -d
|
||||
./deploy.sh staging # vagy production
|
||||
```
|
||||
|
||||
### 4. Post-deploy ellenőrzés
|
||||
- [ ] Minden oldal betölt production-ban
|
||||
- [ ] `/api/health` endpoint ellenőrzése
|
||||
- [ ] Lighthouse futtatás (≥90 minden kategóriában)
|
||||
- [ ] Logok ellenőrzése: `docker compose -f docker-compose.prod.yml logs -f app`
|
||||
1. Kötelező `.env.<env>` fájl betöltése (`--env-file` a compose-nak).
|
||||
2. `docker compose -f docker-compose.<env>.yml up --build --force-recreate -d` — a friss Dockerfile/build-arg változások is érvényesüljenek.
|
||||
3. Healthcheck: max 60s-ig kérdezi a `http://localhost:<port>/api/health`-t (staging: 8081, prod: 8080). Sikertelenség esetén app-logok kiírása + exit 1.
|
||||
|
||||
## CMS-ből történő publikálás
|
||||
|
||||
A Content Editor (`content-editor.js`) Publikálás gombja: commit + push (`content: frissítve a CMS-ből`), majd a `CMS_DEPLOY_ENV`-ben beállított környezet deployja a háttérben. **Soha nem deployol productionre implicit** — a `CMS_DEPLOY_ENV` kötelező, érvényes érték nélkül az editor el sem indul.
|
||||
|
||||
## Production deploy (élesítés)
|
||||
|
||||
A staging ellenőrzése után (fő oldalak, kapcsolat űrlap, dark mode, mobil nézet, `/api/health`):
|
||||
|
||||
```bash
|
||||
ssh <prod-host>
|
||||
cd <prod-path>
|
||||
./deploy.sh production
|
||||
```
|
||||
|
||||
## Post-deploy ellenőrzés
|
||||
|
||||
- [ ] Minden oldal betölt (`/`, `/rolunk`, `/szolgaltatasok`, `/kapcsolat`)
|
||||
- [ ] `/api/health` zöld
|
||||
- [ ] Smoke tesztek: `BASE_URL=<url> npm run test:smoke:staging` (proto/)
|
||||
- [ ] Logok: `docker compose -f docker-compose.<env>.yml logs -f app`
|
||||
|
||||
## Rollback (ha szükséges)
|
||||
|
||||
### 5. Rollback (ha szükséges)
|
||||
Hiba esetén az előző commitra könnyedén vissza lehet állni:
|
||||
```bash
|
||||
git checkout HEAD~1
|
||||
docker compose -f docker-compose.prod.yml up --build -d
|
||||
./deploy.sh <env>
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Docker lokális stack
|
||||
## CI — Gitea Actions (jelenleg szünetel)
|
||||
|
||||
A Gitea Actions workflow szünetel, mert nincs dedikált, biztonságosan elkülönített runner. A kiadásért a fejlesztő felel a fenti lokális scripttel. Ha később CI-host készül: `docs/gitea-runner-telepites.md` + `scripts/install-gitea-runner.sh`.
|
||||
|
||||
## Docker lokális dev stack
|
||||
|
||||
```bash
|
||||
# Teljes stack indítása (Next.js + MongoDB + Grafana + Loki)
|
||||
cd proto && npm run docker:dev
|
||||
|
||||
# Leállítás
|
||||
npm run docker:dev:down
|
||||
|
||||
# Logok követése
|
||||
npm run docker:dev:logs
|
||||
cd proto
|
||||
npm run docker:dev # indítás (docker-compose.dev.yml)
|
||||
npm run docker:dev:down # leállítás
|
||||
npm run docker:dev:logs # logok követése
|
||||
```
|
||||
|
||||
Elérhető szolgáltatások:
|
||||
- **Weboldal**: http://localhost:3000
|
||||
- **MongoDB UI**: http://localhost:8081 (admin/password123)
|
||||
- **Grafana**: http://localhost:3001 (admin/admin123)
|
||||
Szolgáltatások: weboldal http://localhost:8080, MongoDB (host port 27018), Mongo Express http://localhost:8081, Loki :3100, Grafana http://localhost:3001.
|
||||
|
||||
Reference in New Issue
Block a user