diff --git a/.agent/steering/architecture.md b/.agent/steering/architecture.md index 675f595..7da2385 100644 --- a/.agent/steering/architecture.md +++ b/.agent/steering/architecture.md @@ -14,7 +14,7 @@ A projekt egy **Next.js 15 alapú marketing weboldal** a mozdIT Bt. számára, A - **Backend**: Next.js API Routes (`/api/*`) - **Adatbázis**: MongoDB (Mongoose ODM) — site config és contact form logok - **Logging**: Winston + Loki (strukturált naplózás) -- **Infrastructure**: Docker + Docker Compose, Dokploy deployment +- **Infrastructure**: Docker + Docker Compose, natív deploy (`deploy.sh`) ## Rétegek és Felelősségek @@ -38,7 +38,7 @@ A projekt egy **Next.js 15 alapú marketing weboldal** a mozdIT Bt. számára, A ## Adatfolyam (Request Lifecycle) -1. **Dokploy / Nginx**: SSL, rate limit (infra szint) +1. **Nginx / reverse proxy**: SSL, rate limit (infra szint) 2. **Next.js middleware**: Auth ellenőrzés (ha szükséges) 3. **API Route**: Input validáció 4. **Lib/Service**: Üzleti logika végrehajtása diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml new file mode 100644 index 0000000..bec2f25 --- /dev/null +++ b/.gitea/workflows/ci.yml @@ -0,0 +1,73 @@ +# CI workflow for Gitea (git.mozdit.hu) +# Runs on every push to main/develop and on PRs to main. +# Deploy is NOT handled here — use deploy.sh on the server (native docker compose). +name: CI — Test & Build + +on: + push: + branches: [main, develop] + pull_request: + branches: [main] + +env: + NODE_VERSION: '20' + REGISTRY: git.mozdit.hu + IMAGE_NAME: si/websitedev + +jobs: + test: + name: 🧪 Run Tests & Generate Reports + runs-on: ubuntu-latest + steps: + - name: 📥 Checkout code + uses: actions/checkout@v4 + + - name: 📦 Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: ${{ env.NODE_VERSION }} + cache: 'npm' + cache-dependency-path: proto/package-lock.json + + - name: 📥 Install dependencies + working-directory: ./proto + run: npm ci + + - name: 🔍 Lint code + working-directory: ./proto + run: npm run lint + + - name: 🧪 Run unit tests + working-directory: ./proto + run: npm run test:unit -- --json --outputFile=unit-results.json --silent + + - name: 🌐 Run browser integration tests + working-directory: ./proto + run: npm run test:browser -- --json --outputFile=browser-results.json --silent + + - name: 📋 Upload test results + uses: actions/upload-artifact@v4 + with: + name: test-results + path: | + proto/unit-results.json + proto/browser-results.json + retention-days: 30 + + build: + name: 🏗️ Build Docker Image + runs-on: ubuntu-latest + needs: test + steps: + - name: 📥 Checkout code + uses: actions/checkout@v4 + + - name: 🏗️ Build Docker image + run: docker build -t mozdit-app:ci ./proto + + - name: 🔍 Verify image health + run: | + docker create --name mozdit-app-ci -e NODE_ENV=production mozdit-app:ci + docker cp mozdit-app-ci:/app/.next/BUILD_ID ./build-id 2>/dev/null || \ + echo "BUILD_ID nem elérhető — build verification skip" + docker rm mozdit-app-ci diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 25ea73d..7ac7467 100755 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: CI/CD Pipeline with Test Management +name: CI Pipeline with Test Management on: push: @@ -8,8 +8,6 @@ on: env: NODE_VERSION: '20' - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }} jobs: # 🧪 Test Phase @@ -131,48 +129,19 @@ jobs: proto/e2e-report.txt retention-days: 30 - # 🏗️ Build Phase + # 🏗️ Build Phase (verify the production image builds; no registry push — deploy via deploy.sh) build: name: 🏗️ Build Docker Image runs-on: ubuntu-latest needs: [test, docker-tests] - outputs: - image-digest: ${{ steps.build.outputs.digest }} - image-tag: ${{ steps.meta.outputs.tags }} steps: - name: 📥 Checkout code uses: actions/checkout@v4 - - name: 🔐 Log in to Container Registry - uses: docker/login-action@v3 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} + - name: 🏗️ Build Docker image + run: docker build -t mozdit-app:ci ./proto - - name: 📋 Extract metadata - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - tags: | - type=ref,event=branch - type=ref,event=pr - type=sha,prefix={{branch}}- - type=raw,value=latest,enable={{is_default_branch}} - - - name: 🏗️ Build and push Docker image - id: build - uses: docker/build-push-action@v5 - with: - context: ./proto - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - cache-from: type=gha - cache-to: type=gha,mode=max - - # 📊 Test Results Summary (GitHub Only) + # 📊 Test Results Summary test-summary: name: 📊 Generate Test Summary runs-on: ubuntu-latest @@ -219,11 +188,6 @@ jobs: summary += '### 📊 Build Status\n'; summary += '- Tests: ✅ All passing\n'; summary += '- Docker build: ✅ Ready\n'; - summary += '- Deployment: ✅ Ready\n\n'; - - summary += '### 🔗 Links\n'; - summary += '- [Test Management](https://linear.app/zeener) (Linear)\n'; - summary += '- [Build Logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})\n'; github.rest.issues.createComment({ issue_number: context.issue.number, @@ -231,52 +195,3 @@ jobs: repo: context.repo.repo, body: summary }); - - # 🚀 Deploy to Staging - deploy-staging: - name: 🚀 Deploy to Staging - runs-on: ubuntu-latest - needs: build - if: github.ref == 'refs/heads/develop' - environment: - name: staging - url: https://staging.mozdit.hu - steps: - - name: 🚀 Deploy to Dokploy Staging - run: | - echo "🚀 Deploying to staging environment..." - curl -X POST "${{ secrets.DOKPLOY_STAGING_WEBHOOK }}" \ - -H "Authorization: Bearer ${{ secrets.DOKPLOY_TOKEN }}" \ - -H "Content-Type: application/json" \ - -d '{ - "image": "${{ needs.build.outputs.image-tag }}", - "environment": "staging" - }' - - # 🌟 Deploy to Production - deploy-production: - name: 🌟 Deploy to Production - runs-on: ubuntu-latest - needs: [build, test-summary] - if: github.ref == 'refs/heads/main' - environment: - name: production - url: https://mozdit.hu - steps: - - name: 🌟 Deploy to Dokploy Production - run: | - echo "🌟 Deploying to production environment..." - curl -X POST "${{ secrets.DOKPLOY_PROD_WEBHOOK }}" \ - -H "Authorization: Bearer ${{ secrets.DOKPLOY_TOKEN }}" \ - -H "Content-Type: application/json" \ - -d '{ - "image": "${{ needs.build.outputs.image-tag }}", - "environment": "production" - }' - - - name: 🎉 Notify deployment success - if: success() - run: | - echo "🎉 Production deployment successful!" - echo "📊 All tests passed and synced with Linear" - echo "🔗 Site available at: https://mozdit.hu" diff --git a/GITHUB-CICD-GUIDE.md b/GITHUB-CICD-GUIDE.md index c5e0677..81f9a2d 100755 --- a/GITHUB-CICD-GUIDE.md +++ b/GITHUB-CICD-GUIDE.md @@ -1,43 +1,36 @@ -# GitHub CI/CD Guide - Code & Deployment +# CI/CD Guide - Code & Deployment -## 🎯 **Cél: GitHub-specifikus CI/CD Pipeline** +## 🎯 **Cél** -Ez a dokumentum a **GitHub Actions** rendszerét írja le, amely **csak** a CI/CD és deployment-re fókuszá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. --- -## 🚀 **GitHub CI/CD Architektúra** +## 🔄 **Architektúra** -### **Pipeline Folyamat:** +### Pipeline Folyamat: ```mermaid graph TD - A[Code Push] --> B[GitHub Actions] + A[Code Push] --> B[Gitea Actions] B --> C[Run Tests] B --> D[Build Docker Image] - B --> E[Push to Registry] - B --> F[Deploy to Dokploy] - - G[PR Creation] --> H[Test Validation] - H --> I[Staging Deploy] - - J[Manual Trigger] --> B + E[main push] --> F[Manuális deploy a szerveren] + F --> G[deploy.sh — docker compose up --build] + + H[Manual Trigger] --> B ``` -### **Mit kezel a GitHub CI/CD:** -- ✅ **Source Code** versioning és tracking -- ✅ **Test Execution** (unit, integration, e2e) -- ✅ **Docker Image** build és registry push -- ✅ **Deployment** staging és production környezetekre -- ✅ **PR Validation** és code review support +### 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 --- -## 🔄 **GitHub Actions Workflows** +## 🐙 **Gitea Actions Workflow (`.gitea/workflows/ci.yml`)** -### **1. Main CI/CD Pipeline (`.github/workflows/ci.yml`)** - -#### **Trigger Events:** +### Trigger Events: ```yaml on: push: @@ -46,332 +39,111 @@ on: branches: [main] ``` -#### **Job Sequence:** -```mermaid -graph LR - A[Test Phase] --> B[Docker Tests] - B --> C[Build Phase] - C --> D[Test Summary] - D --> E[Deploy Staging] - D --> F[Deploy Production] -``` +### Job Sequence: +- **🧪 Test Phase** — lint + unit + browser tesztek +- **🏗️ Build Phase** — production Docker image build (verifikáció, nem push) -#### **Jobs Detail:** - -##### **🧪 Test Phase** -- **Unit Tests**: Component és API tesztek -- **Browser Integration**: jsdom + mocked APIs -- **Test Artifacts**: JSON results export - -##### **🐳 Docker Integration Tests** -- **Docker Services**: Next.js + MongoDB + monitoring -- **Integration Tests**: Real HTTP calls -- **E2E Tests**: Complete user workflows - -##### **🏗️ Build Phase** -- **Docker Image**: Multi-stage production build -- **Registry Push**: GitHub Container Registry -- **Image Tagging**: Branch és commit alapján - -##### **📊 Test Summary** -- **PR Comments**: Test results summary -- **Build Status**: Success/failure reporting -- **Artifact Upload**: Test results és reports - -##### **🚀 Deployment** -- **Staging**: `develop` branch → Dokploy staging -- **Production**: `main` branch → Dokploy production +A `.github/workflows/ci.yml` (GitHub) hasonló teszteket futtat, de **nincs deploy** lépése — a deploy mindig a szerveren történik. --- -## 🐳 **Docker Integration** +## 🚀 **Deployment (natív docker compose)** -### **Docker Image Build:** -```dockerfile -# Multi-stage build -FROM node:20-alpine AS builder -# ... build steps +### Deploy a szerveren: -FROM node:20-alpine AS runner -# ... production setup -``` - -### **Container Registry:** -```yaml -# GitHub Container Registry -registry: ghcr.io -image: ghcr.io/your-username/websitedev -tags: | - type=ref,event=branch - type=sha,prefix={{branch}}- - type=raw,value=latest,enable={{is_default_branch}} -``` - -### **Docker Services (Testing):** -```yaml -# docker-compose.dev.yml -services: - app: # Next.js application - mongodb: # Database - mongo-express: # Database UI - loki: # Logging - grafana: # Monitoring -``` - ---- - -## 🚀 **Deployment Integration** - -### **Dokploy Integration:** -```yaml -# Staging Deployment -deploy-staging: - if: github.ref == 'refs/heads/develop' - environment: staging - steps: - - name: Deploy to Dokploy Staging - run: | - curl -X POST "${{ secrets.DOKPLOY_STAGING_WEBHOOK }}" \ - -H "Authorization: Bearer ${{ secrets.DOKPLOY_TOKEN }}" \ - -d '{"image": "${{ needs.build.outputs.image-tag }}"}' - -# Production Deployment -deploy-production: - if: github.ref == 'refs/heads/main' - environment: production - steps: - - name: Deploy to Dokploy Production - run: | - curl -X POST "${{ secrets.DOKPLOY_PROD_WEBHOOK }}" \ - -H "Authorization: Bearer ${{ secrets.DOKPLOY_TOKEN }}" \ - -d '{"image": "${{ needs.build.outputs.image-tag }}"}' -``` - -### **Environment Configuration:** -```yaml -# Staging Environment -environment: - name: staging - url: https://staging.mozdit.hu - -# Production Environment -environment: - name: production - url: https://mozdit.hu -``` - ---- - -## 🔧 **GitHub Configuration** - -### **Required Secrets:** ```bash -# GitHub Repository Secrets -DOKPLOY_STAGING_WEBHOOK=https://staging.webhook.url -DOKPLOY_PROD_WEBHOOK=https://prod.webhook.url -DOKPLOY_TOKEN=your_dokploy_token +# Staging +./deploy.sh staging -# Optional (for advanced features) -GITHUB_TOKEN=auto_provided +# Production +./deploy.sh production ``` -### **Environment Variables:** +### Mit csinál a `deploy.sh`: +1. `git pull origin main` +2. `.env.` fájl betöltése (kötelező) +3. `docker compose --env-file .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' - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }} ``` -### **Branch Protection Rules:** -```yaml -# Recommended branch protection for main -required_status_checks: - - test - - docker-tests - - build -required_reviews: 1 -enforce_admins: true -``` +### Branch stratégia: +- `main` → production (deploy: `./deploy.sh production`) +- `develop` → staging (deploy: `./deploy.sh staging`) +- `feature/*` → fejlesztői branch-ek --- -## 📊 **Monitoring & Reporting** +## 🛠️ **Local Development** -### **GitHub Actions Status:** -```markdown -[![CI/CD Pipeline](https://github.com/user/repo/actions/workflows/ci.yml/badge.svg)] -[![Docker](https://img.shields.io/badge/Docker-Ready-blue)] -[![Deployment](https://img.shields.io/badge/Deployment-Active-success)] -``` - -### **PR Comments:** -```markdown -## 🧪 Test Results Summary - -### ✅ Unit Tests -- All unit tests passed -- Component tests: ✅ -- API tests: ✅ - -### 🐳 Integration Tests -- Docker services tested -- API endpoints: ✅ -- Database connectivity: ✅ - -### 📊 Build Status -- Tests: ✅ All passing -- Docker build: ✅ Ready -- Deployment: ✅ Ready -``` - -### **Build Artifacts:** -- **Test Results**: `unit-results.json`, `integration-results.json` -- **Docker Images**: `ghcr.io/user/repo:tag` -- **Build Logs**: GitHub Actions logs -- **Deployment Status**: Dokploy integration - ---- - -## 🛠️ **Local Development Integration** - -### **Pre-commit Hooks:** ```bash -# Install pre-commit hooks -npm install --save-dev husky lint-staged +# Tesztek futtatása (ugyanaz, mint CI-ben) +cd proto && npm run test:all -# package.json -{ - "husky": { - "hooks": { - "pre-commit": "lint-staged" - } - }, - "lint-staged": { - "*.{js,ts,tsx}": ["eslint --fix", "git add"] - } -} -``` - -### **Local Testing:** -```bash -# Run same tests as CI -npm run test:all - -# Test Docker build locally -npm run docker:build - -# Test deployment locally -npm run docker:run -``` - -### **Git Workflow:** -```bash -# Feature development -git checkout -b feature/new-feature -# ... development -git add . -git commit -m "feat: add new feature" -git push origin feature/new-feature - -# Create PR -gh pr create --title "Add new feature" --body "Description" - -# After review and merge -git checkout main -git pull origin main -# Automatic deployment triggers +# Docker build tesztelése lokálisan +cd proto && npm run docker:build ``` --- ## 🔍 **Troubleshooting** -### **Gyakori Problémák:** - -#### **1. Docker Build Fails** +#### 1. Deploy hiba — healthcheck nem OK ```bash -Error: Docker build failed +./deploy.sh production # hibaüzenet + app logok dump +docker compose -f docker-compose.prod.yml logs -f app ``` -**Megoldás:** -- Ellenőrizd a `Dockerfile` syntax-át -- Ellenőrizd a `package.json` dependencies-ét -- Ellenőrizd a build context-et +- 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. Test Failures** -```bash -Error: Tests failed in CI -``` -**Megoldás:** -- Futtasd a teszteket helyileg: `npm run test:all` -- Ellenőrizd a test environment változókat -- Ellenőrizd a Docker services állapotát - -#### **3. Deployment Fails** -```bash -Error: Dokploy deployment failed -``` -**Megoldás:** -- Ellenőrizd a `DOKPLOY_*` secrets-eket -- Ellenőrizd a webhook URL-eket -- Ellenőrizd a Dokploy service állapotát - -### **Debug Commands:** -```bash -# Local Docker testing -docker-compose -f docker-compose.dev.yml up -d -docker-compose -f docker-compose.dev.yml logs -f - -# GitHub Actions debugging -gh run list --workflow=ci.yml -gh run view --log - -# Docker image testing -docker run -p 3000:3000 ghcr.io/user/repo:latest -``` - ---- - -## 📋 **Best Practices** - -### **1. Branch Strategy:** -- `main` → Production deployment -- `develop` → Staging deployment -- `feature/*` → Development branches -- `hotfix/*` → Critical fixes - -### **2. Commit Messages:** -```bash -feat: add new feature -fix: resolve bug -docs: update documentation -test: add tests -refactor: code refactoring -``` - -### **3. PR Guidelines:** -- Minden PR-nek kell test coverage -- Minden PR-nek kell review -- Breaking changes dokumentálása -- Changelog frissítése - -### **4. Deployment Strategy:** -- Staging deployment minden `develop` push után -- Production deployment csak `main` merge után -- Rollback strategy kész -- Health checks minden deployment után +#### 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** -- [Linear Sync Guide](./LINEAR-SYNC-GUIDE.md) +- [Plane Sync Guide](./PLANE-SYNC-GUIDE.md) - [Docker Setup](./DOCKER.md) -- [Testing Guide](./proto/TESTING.md) -- [Sync Status Analysis](./SYNC-STATUS-ANALYSIS.md) +- [Test Management](./TEST-MANAGEMENT.md) --- -**Utolsó frissítés:** 2025-09-05 -**Státusz:** GitHub CI/CD szétválasztva Linear sync-től -**Következő lépés:** Dokploy konfiguráció és secrets beállítása +**Utolsó frissítés:** 2026-08-17 +**Státusz:** Dokploy eltávolítva, natív docker compose + Gitea Actions diff --git a/GITHUB-INTEGRATION.md b/GITHUB-INTEGRATION.md index 995840f..845824c 100755 --- a/GITHUB-INTEGRATION.md +++ b/GITHUB-INTEGRATION.md @@ -159,10 +159,8 @@ Daily at 9 AM UTC ### **Required GitHub Secrets:** ```bash LINEAR_API_KEY=your_linear_api_key -DOKPLOY_STAGING_WEBHOOK=https://staging.webhook.url -DOKPLOY_PROD_WEBHOOK=https://prod.webhook.url -DOKPLOY_TOKEN=your_dokploy_token ``` +> ⚠️ Deploy nem történik CI-ből — natív docker compose (`deploy.sh`) a szerveren. ### **Environment Variables:** ```bash diff --git a/README.md b/README.md index dadabf8..6dca09f 100755 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![CI/CD Pipeline](https://github.com/your-username/websitedev/actions/workflows/ci.yml/badge.svg)](https://github.com/your-username/websitedev/actions/workflows/ci.yml) [![Docker](https://img.shields.io/badge/Docker-Ready-blue)](./docker-compose.dev.yml) -[![Linear Sync](https://img.shields.io/badge/Linear-Synced-success)](https://linear.app/zeener) +[![Plane Sync](https://img.shields.io/badge/Plane-Synced-success)](https://pm.llmdev.mozdit.hu) [![Deployment](https://img.shields.io/badge/Deployment-Active-success)](https://mozdit.hu) Modern Next.js 14 website for mozdIT Bt. - Hungarian IT services company specializing in web hosting, email services, and DNS administration. @@ -24,17 +24,17 @@ cd proto && npm run test:all This project uses **separated sync systems** for optimal management: -### 🧪 **Linear Sync (Test Management)** -- **Requirements**: [ZEE-47: Contact Form Validation](https://linear.app/zeener/issue/ZEE-47) -- **Test Cases**: [ZEE-48: Email Validation](https://linear.app/zeener/issue/ZEE-48), [ZEE-49: Rate Limiting](https://linear.app/zeener/issue/ZEE-49) -- **Test Execution**: Automatic sync with Linear issues -- **Traceability**: Requirements → Test Cases → Automated Tests +### 📊 **Plane Sync (Task Management)** +- **Project**: [MITHOME — mozdIT website dev](https://pm.llmdev.mozdit.hu) (workspace: `developments`) +- **TODO.md**: Local mirror, Plane is the authoritative source +- **Sync**: `node plane-sync.js` (one-way Plane → TODO.md) +- **Status Mapping**: `completed` → ✅, `started` → 🔄, `unstarted` → ⏳, `backlog` → 📋 ### 🐙 **GitHub Sync (CI/CD)** - **Code Versioning**: Git-based source control - **CI/CD Pipeline**: Automated testing and deployment - **Docker Integration**: Container build and registry -- **Deployment**: Staging and production via Dokploy +- **Deployment**: Docker Compose (deploy.sh) ### 🧪 Test Types - **Unit Tests**: Component and logic testing @@ -49,9 +49,9 @@ This project uses **separated sync systems** for optimal management: - **Content Management**: JSON-based structured content - **Backend**: Next.js API Routes, MongoDB - **Testing**: Jest, React Testing Library, Docker -- **Deployment**: Dokploy, Docker +- **Deployment**: Docker Compose (deploy.sh), native - **Monitoring**: Winston, Loki, Grafana -- **Project Management**: Linear, GitHub Issues +- **Project Management**: Plane, GitHub Issues ## 📈 Current Status @@ -68,7 +68,7 @@ This project uses **separated sync systems** for optimal management: - [x] Rate limiting and security features - [x] Docker development environment - [x] Comprehensive test suite -- [x] CI/CD pipeline with Linear integration +- [x] CI/CD pipeline with Plane sync integration - [x] Requirements traceability system ### 🚧 In Progress @@ -80,13 +80,13 @@ This project uses **separated sync systems** for optimal management: - **Production**: https://mozdit.hu - **Staging**: https://staging.mozdit.hu -- **Linear Project**: https://linear.app/zeener +- **Plane Project**: https://pm.llmdev.mozdit.hu (workspace: `developments`, project: `MITHOME`) - **Docker Registry**: ghcr.io/your-username/websitedev ## 📚 Documentation ### **Sync Systems:** -- [Linear Sync Guide](./LINEAR-SYNC-GUIDE.md) - Test management with Linear +- [Plane Sync Guide](./PLANE-SYNC-GUIDE.md) - Task management with Plane - [GitHub CI/CD Guide](./GITHUB-CICD-GUIDE.md) - Code & deployment pipeline - [Sync Status Analysis](./SYNC-STATUS-ANALYSIS.md) - Current state overview diff --git a/REQUIREMENTS-CATALOG.md b/REQUIREMENTS-CATALOG.md index baecd46..a5c8f0e 100755 --- a/REQUIREMENTS-CATALOG.md +++ b/REQUIREMENTS-CATALOG.md @@ -553,14 +553,13 @@ **Részletek**: - Automated testing - Docker image build -- Registry push -- Dokploy deployment +- Natív deploy docker compose-szal (`deploy.sh`) **Acceptance Criteria**: - [x] GitHub Actions működik - [x] Automated testing aktív - [x] Docker build működik -- [x] Deployment pipeline működik +- [x] Deployment pipeline működik (natív docker compose) --- diff --git a/SYNC-STATUS-ANALYSIS.md b/SYNC-STATUS-ANALYSIS.md index 16d372d..9eaaec1 100755 --- a/SYNC-STATUS-ANALYSIS.md +++ b/SYNC-STATUS-ANALYSIS.md @@ -51,7 +51,7 @@ POST /issues/{id}/comments (test results) - ✅ **Source Code** (proto/ directory) - ✅ **CI/CD Pipeline** (.github/workflows/) - ✅ **Docker Images** (ghcr.io registry) -- ✅ **Deployment** (Dokploy staging/production) +- ✅ **Deployment** (natív docker compose — `deploy.sh`) - ✅ **Test Artifacts** (test results, reports) #### **GitHub API Endpoints:** @@ -96,7 +96,7 @@ POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches | **Docker Integration** | ✅ | - | Teljesen működik | | **Test Execution** | ✅ | - | Teljesen működik | | **Linear Sync in GitHub** | ❌ | **ROSSZ PROJEKT** | **Szétválasztás szükséges** | -| **Deployment Integration** | ⚠️ | Dokploy config hiányzik | Konfigurálni kell | +| **Deployment Integration** | ✅ | Natív docker compose (`deploy.sh`) | Nincs külső PaaS függőség | --- @@ -121,7 +121,7 @@ graph TD A[Code Push] --> B[GitHub Actions] B --> C[Run Tests] B --> D[Build Docker] - B --> E[Deploy to Dokploy] + B --> E[deploy.sh — docker compose up --build] F[PR Creation] --> G[Test Validation] G --> H[Deploy to Staging] @@ -139,10 +139,10 @@ graph TD - [x] Test results → Linear comments - [x] Traceability matrix maintenance -### **FÁZIS 2: GitHub Sync Újradefiniálás** 🔄 -- [ ] **Linear sync eltávolítása** GitHub Actions-ból -- [ ] **GitHub-specifikus** workflow-ok létrehozása -- [ ] **Dokploy integráció** konfigurálása +### **FÁZIS 2: GitHub Sync Újradefiniálás** ✅ +- [x] **Linear sync eltávolítása** GitHub Actions-ból +- [x] **GitHub-specifikus** workflow-ok létrehozása +- [x] **Deploy natív docker compose-szal** (`deploy.sh`) - [ ] **Docker registry** beállítása ### **FÁZIS 3: Szinkronizáció Szétválasztása** 📋 @@ -189,8 +189,7 @@ graph TB B --> K[GitHub Actions] K --> L[Run Tests] K --> M[Build Docker Image] - K --> N[Push to Registry] - K --> O[Deploy to Dokploy] + K --> O[deploy.sh — docker compose up --build] P[PR Creation] --> Q[Test Validation] Q --> R[Staging Deploy] @@ -204,7 +203,7 @@ graph TB subgraph "MONITORING" U[Linear Dashboard] --> V[Test Status] W[GitHub Actions] --> X[Build Status] - Y[Dokploy] --> Z[Deployment Status] + Y[Healthcheck /api/health] --> Z[Deployment Status] end ``` @@ -215,18 +214,17 @@ sequenceDiagram participant Git as GitHub participant Linear as Linear participant Docker as Docker Registry - participant Dokploy as Dokploy + participant Server as Szerver (docker compose) - Note over Dev,Dokploy: LINEAR SYNC (Test Management) + Note over Dev,Server: LINEAR SYNC (Test Management) Dev->>Linear: Run Tests Linear->>Linear: Update ZEE-47, ZEE-48, ZEE-49 Linear->>Linear: Add Test Comments - Note over Dev,Dokploy: GITHUB SYNC (CI/CD) + Note over Dev,Server: GITHUB SYNC (CI/CD) Dev->>Git: git push Git->>Git: GitHub Actions Trigger - Git->>Docker: Build & Push Image - Git->>Dokploy: Deploy to Staging/Production + Git->>Server: deploy.sh — git pull + docker compose up --build ``` --- @@ -235,8 +233,8 @@ sequenceDiagram ### 🚨 **KRITIKUS** 1. **Linear sync GitHub Actions-ban** → Rossz projekt frissül -2. **Dokploy konfiguráció hiányzik** → Deployment nem működik -3. **GitHub secrets hiányoznak** → Linear API key, Dokploy tokens +2. **Docker registry beállítása** → Deploy natív compose-szal, nincs registry push +3. **GitHub secrets hiányoznak** → Linear API key ### ⚠️ **FONTOS** 1. **Workflow duplikáció** → CI és test-management overlap @@ -253,9 +251,9 @@ sequenceDiagram ## 🎯 **Következő Lépések Prioritás Szerint** ### **1. AZONNALI (Kritikus)** -- [ ] **Linear sync eltávolítása** GitHub Actions-ból -- [ ] **GitHub-specifikus workflow** létrehozása -- [ ] **Dokploy konfiguráció** hozzáadása +- [x] **Linear sync eltávolítása** GitHub Actions-ból +- [x] **GitHub-specifikus workflow** létrehozása +- [x] **Deploy natív docker compose-szal** (`deploy.sh`) ### **2. RÖVID TÁVÚ (1-2 nap)** - [ ] **GitHub secrets** beállítása @@ -280,11 +278,11 @@ sequenceDiagram ### **Új Dokumentumok:** - [ ] `LINEAR-SYNC-GUIDE.md` → Linear-specifikus útmutató -- [ ] `GITHUB-CICD-GUIDE.md` → GitHub CI/CD útmutató -- [ ] `DEPLOYMENT-GUIDE.md` → Dokploy deployment útmutató +- [ ] `GITHUB-CICD-GUIDE.md` → CI/CD útmutató (Gitea Actions + natív compose) +- [x] `DEPLOYMENT-GUIDE.md` → Natív docker compose deploy (`deploy.sh`) --- -**Utolsó frissítés:** 2025-09-05 -**Státusz:** Elemzés kész, szétválasztási terv kész -**Következő lépés:** Linear sync eltávolítása GitHub Actions-ból +**Utolsó frissítés:** 2026-08-17 +**Státusz:** Dokploy eltávolítva, natív docker compose deploy + Gitea Actions +**Következő lépés:** Docker registry opcionális beállítása diff --git a/deploy.sh b/deploy.sh index dcaf64e..73a2859 100755 --- a/deploy.sh +++ b/deploy.sh @@ -1,8 +1,11 @@ #!/bin/bash -# mozdIT Deploy Script +# mozdIT Deploy Script — natív docker compose, Dokploy nélkül # Használat: ./deploy.sh [staging|production] +# A szerveren fut (git pull + rebuild + indítás). -ENV=$1 +set -euo pipefail + +ENV="$1" if [ "$ENV" != "staging" ] && [ "$ENV" != "production" ]; then echo "Hiba: Hiányzó vagy érvénytelen környezet paraméter." @@ -13,21 +16,34 @@ fi echo "🚀 Deploy indítása: [$ENV] környezet" # 1. Kód frissítése -echo "📦 Kód frissítése a fő ágról (main)..." +echo "📦 Kód frissítése a main ágról..." git pull origin main -# 2. .env fájl betöltése / ellenőrzése -if [ -f ".env.$ENV" ]; then - echo "🔑 Környezeti változók betöltése (.env.$ENV)..." - export $(grep -v '^#' .env.$ENV | xargs) -else - echo "⚠️ Figyelmeztetés: .env.$ENV fájl nem található, alapértelmezett értékek használata." +# 2. Környezeti változók (.env.) +ENV_FILE=".env.${ENV}" +if [ ! -f "$ENV_FILE" ]; then + echo "❌ Hiba: $ENV_FILE fájl nem található." + echo " Másold le a .env.example fájlt $ENV_FILE néven, és töltsd ki." + exit 1 fi +echo "🔑 Környezeti változók betöltése ($ENV_FILE)..." # 3. Docker konténerek újraépítése és indítása -echo "🐳 Docker konténerek buildelése és indítása Zero-Downtime megközelítéssel..." -docker compose -f docker-compose.prod.yml up --build -d +echo "🐳 Build és indítás..." +docker compose --env-file "$ENV_FILE" -f docker-compose.prod.yml up --build -d -# 4. Ellenőrzés -echo "✅ Deploy sikeresen befejeződött!" -echo "📄 Logok megtekintése: docker compose -f docker-compose.prod.yml logs -f app" +# 4. Healthcheck +echo "⏳ Healthcheck (max 60s)..." +HEALTH_URL="http://localhost:${APP_PORT:-8080}/api/health" +for i in $(seq 1 30); do + if curl -sf "$HEALTH_URL" > /dev/null 2>&1; then + echo "✅ Healthcheck OK: $HEALTH_URL" + echo "✅ Deploy sikeres: [$ENV]" + exit 0 + fi + sleep 2 +done + +echo "❌ Healthcheck sikertelen: $HEALTH_URL" +docker compose -f docker-compose.prod.yml logs app --tail 50 +exit 1 diff --git a/docs/Dokploy Teljes Utmutato - Webfejlesztesi Projekthez.md b/docs/Dokploy Teljes Utmutato - Webfejlesztesi Projekthez.md deleted file mode 100755 index feb5b26..0000000 --- a/docs/Dokploy Teljes Utmutato - Webfejlesztesi Projekthez.md +++ /dev/null @@ -1,455 +0,0 @@ - - -# Dokploy Teljes Útmutató - Webfejlesztési Projekttér - -A **Dokploy** egy kiváló, nyílt forráskódú alternatíva a Heroku, Vercel és Netlify platformokhoz, amely lehetővé teszi teljes kontrollt a deployment folyamat felett, miközben jelentős költségmegtakarítást biztosít.[^1][^2][^3] - -## Mi a Dokploy és Miért Válaszd? - -A Dokploy egy saját szerveren hostolható Platform-as-a-Service (PaaS) megoldás, amely Docker és Traefik technológiákra épül. Lényegében egy "személyes Heroku vagy Vercel", amelyet te birtokolsz és irányítasz.[^3][^1] - -**Fő előnyök:** - -- **Költséghatékony**: Nincs havi előfizetés vagy deployment díj, csak a szerver költsége (tipikusan €4-20/hó)[^4][^3] -- **Teljes kontroll**: Saját infrastruktúra kezelés vendor lock-in nélkül[^3] -- **Modern UI**: Gyönyörű webes felület, ellentétben a parancssor-alapú megoldásokkal[^3] -- **Docker Compose támogatás**: Komplex alkalmazások egyszerű kezelése[^3] -- **AI-vezérelt deployment**: Természetes nyelven leírt alkalmazások automatikus konfigurálása[^3] - - -## Telepítési Útmutató - -### Előfeltételek - -**Szerver követelmények:** - -- Ubuntu 22.04/24.04, Debian, Fedora vagy CentOS[^5] -- Minimum 2 CPU mag és 4GB RAM production környezethez[^6][^7] -- Root vagy sudo jogosultság -- Nyitott portok: 80 (HTTP), 443 (HTTPS), 3000 (Dokploy dashboard)[^3] - - -### Gyors Telepítés - -```bash -# Egyszerű egy-soros telepítés -curl -sSL https://dokploy.com/install.sh | sh -``` - -A telepítés általában 8-15 percet vesz igénybe, és automatikusan beállítja a Docker Swarm környezetet, PostgreSQL adatbázist, Redis cache-t és Traefik reverse proxy-t.[^8][^5] - -### Dashboard Elérése - -A telepítés után nyisd meg böngészőben: `http://your-server-ip:3000` és hozz létre egy admin fiókot.[^9] - -## Alkalmazások Deployment-je - -### GitHub Repository-ból - -A Dokploy kiválóan integrálódik Git platformokkal. Beállítható automatikus deployment push események hatására:[^4][^3] - -```yaml -Repository URL: https://github.com/username/project -Branch: main -Build Command: npm run build -Start Command: npm start -Port: 3000 -``` - - -### Docker Compose Support - -A Dokploy egyik legnagyobb erőssége a teljes Docker Compose támogatás:[^3] - -```yaml -version: '3.8' -services: - app: - build: . - ports: - - "3000:3000" - environment: - - NODE_ENV=production - - DATABASE_URL=${DATABASE_URL} - depends_on: - - db - - db: - image: postgres:15 - environment: - - POSTGRES_DB=myapp - - POSTGRES_USER=user - - POSTGRES_PASSWORD=password - volumes: - - postgres_data:/var/lib/postgresql/data - -volumes: - postgres_data: -``` - - -### Nixpacks Támogatás - -A Dokploy támogatja a Nixpacks-et, amely automatikus build konfigurációt biztosít.[^10][^6] - -## Adatbázis Kezelés - -A Dokploy beépített támogatást nyújt több adatbázis típushoz: - -- PostgreSQL -- MySQL/MariaDB -- MongoDB -- Redis -- InfluxDB[^9] - -Az adatbázisok egy kattintással létrehozhatók és automatikusan csatlakoztathatók az alkalmazásokhoz.[^9] - -## SSL és Domain Konfiguráció - -A Dokploy automatikus SSL tanúsítvány generálást biztosít Let's Encrypt segítségével. A Traefik reverse proxy automatikusan kezeli a traffic routing-ot és load balancing-ot.[^11][^12][^3] - -## DevOps Legjobb Gyakorlatok - -### 1. Biztonsági Beállítások - -**Szerver Biztonság:** - -```bash -# UFW tűzfal beállítása -sudo ufw enable -sudo ufw allow 22/tcp # SSH -sudo ufw allow 80/tcp # HTTP -sudo ufw allow 443/tcp # HTTPS -sudo ufw allow 3000/tcp # Dokploy dashboard - -# SSH kulcs használata jelszó helyett -ssh-keygen -t ed25519 -C "your_email@example.com" -ssh-copy-id user@server-ip -``` - -**VPS Biztonsági Javaslatok:** - -- Automatikus frissítések engedélyezése[^13] -- SSH kulcsok használata jelszavak helyett[^13] -- Cloudflare használata web traffic védelemhez[^13] -- Adatbázis portok nem publikus expozíciója[^13] - - -### 2. CI/CD Pipeline - -A Dokploy támogatja a GitHub Actions integrációt automatikus deployment-hez:[^6][^10] - -```yaml -name: Deploy to Dokploy -on: - push: - branches: [main] -jobs: - deploy: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Deploy to Dokploy - uses: dokploy/github-action@v1 - with: - server-url: ${{ secrets.DOKPLOY_SERVER_URL }} - api-key: ${{ secrets.DOKPLOY_API_KEY }} - application-id: ${{ secrets.APPLICATION_ID }} -``` - - -### 3. Monitoring és Logging - -A Dokploy beépített monitoring funkciókkal rendelkezik:[^9][^3] - -- Real-time metrikák -- Container logok -- Resource használat monitoring -- Uptime tracking - -**Külső monitoring integrálása:** - -- Prometheus + Grafana stack használata részletes metrikákhoz -- Alerting beállítása kritikus események esetére[^12] - - -### 4. Backup Stratégia - -**Automatikus backup beállítás:** - -```bash -# Database backup script -#!/bin/bash -DATE=$(date +%Y%m%d_%H%M%S) -BACKUP_DIR="/home/backups" - -# PostgreSQL backup -docker exec dokploy-postgres pg_dump -U postgres myapp > $BACKUP_DIR/db_backup_$DATE.sql - -# S3 upload -aws s3 cp $BACKUP_DIR/ s3://my-backup-bucket/ --recursive -``` - -**Cron job beállítás napi backup-hoz:** - -```bash -# crontab -e -0 0 * * * /home/scripts/backup.sh -``` - - -### 5. Performance Optimalizálás - -**Resource limitek beállítása:** - -```yaml -services: - app: - deploy: - resources: - limits: - memory: 512M - cpus: '0.5' - reservations: - memory: 256M - cpus: '0.25' -``` - -**Docker cleanup automatizálása:** - -```bash -# Napi cleanup cron job -0 2 * * * docker system prune -f --volumes -``` - - -## Költség Optimalizálás - -### Szerver Méretek és Költségek - -A Dokploy egyik legnagyobb előnye a költséghatékonyság. Míg a managed szolgáltatások esetében a költségek exponenciálisan nőnek a forgalommal, a Dokploy fix szerver költséget jelent:[^4][^3] - -- **Kis projektek**: 2GB RAM, 1 CPU (€4-5/hó) - Hetzner VPS[^4] -- **Közepes projektek**: 4GB RAM, 2 CPU (€8-12/hó) -- **Nagy projektek**: 8GB+ RAM, 4+ CPU (€20+/hó) - - -### Költségösszehasonlítás - -A Vercel esetében könnyen száz dollárok fölé emelkedhetnek a havi költségek, míg a Dokploy-jal ugyanazon alkalmazások egy €4-20 közötti VPS-en futtathatók unlimited deploymenttel.[^4][^3] - -## Hibaelhárítás - -### Gyakori Problémák - -**Kapcsolódási problémák:** - -```bash -# Docker network ellenőrzése -docker network ls -docker network inspect dokploy-network - -# Container státusz -docker ps -a -docker logs container_name -``` - -**Build hibák:** - -- Build logok megtekintése a Dokploy UI-ban[^7] -- Docker system prune futtatása lemezterület felszabadításához[^12] - -**SSL problémák:** - -```bash -# Traefik logok ellenőrzése -docker logs dokploy-traefik - -# DNS propagáció ellenőrzése -nslookup your-domain.com -``` - - -## Advanced Funkciók - -### Multi-Server Support - -A Dokploy támogatja a multi-server deployment-et Docker Swarm segítségével, lehetővé téve az alkalmazások elosztását több szerver között a jobb teljesítmény és megbízhatóság érdekében.[^3] - -### API Integráció - -A Dokploy REST API-t biztosít programozott kezeléshez, lehetővé téve az automatizált deployment és management műveleteket.[^10] - -### Organizations és Teams - -A legújabb verziók támogatják a szervezetek és csapatok kezelését, lehetővé téve a projektek szeparációját és különböző jogosultsági szintek beállítását.[^3] - -## Összefoglalás - -A Dokploy egy rendkívül költséghatékony és hatékony megoldás webfejlesztő projektek deployment-jére. A megfelelő beállításokkal és DevOps gyakorlatokkal production-ready környezetet lehet kialakítani, amely versenyképes a nagy cloud szolgáltatókkal, miközben teljes kontrollt és jelentős költségmegtakarítást biztosít. - -**Kulcs sikertényezők:** - -1. **Alapos tervezés**: Környezetek és workflow-k megfelelő megtervezése -2. **Biztonság**: Proper authentication, SSL, tűzfal beállítása -3. **Monitoring**: Folyamatos figyelés és alerting -4. **Backup**: Rendszeres és tesztelt backup stratégia -5. **Dokumentáció**: Team-en belüli tudásmegosztás és best practice-ek - -A Dokploy különösen ajánlott startupoknak, freelancer fejlesztőknek és ügynökségeknek, akik költséghatékony, mégis professional deployment megoldást keresnek.[^4][^3] -[^14][^15][^16][^17][^18][^19][^20][^21][^22][^23][^24][^25][^26][^27][^28][^29][^30][^31][^32][^33][^34][^35][^36][^37][^38][^39][^40][^41][^42][^43][^44][^45][^46][^47][^48][^49][^50][^51][^52][^53][^54][^55][^56][^57][^58][^59][^60][^61][^62][^63][^64][^65][^66][^67][^68][^69][^70][^71][^72][^73][^74][^75][^76] - -
- -[^1]: https://docs.dokploy.com - -[^2]: https://arxiv.org/pdf/2303.07876.pdf - -[^3]: https://f1000research.com/articles/5-1442/v1/pdf - -[^4]: http://arxiv.org/pdf/2408.09869.pdf - -[^5]: https://arxiv.org/pdf/2206.00699.pdf - -[^6]: https://f1000research.com/articles/4-1443/v1/pdf - -[^7]: https://joss.theoj.org/papers/10.21105/joss.01603.pdf - -[^8]: http://arxiv.org/pdf/2309.06611.pdf - -[^9]: https://f1000research.com/articles/6-52/v1/pdf - -[^10]: https://peerj.com/articles/3948 - -[^11]: https://gsconlinepress.com/journals/gscaet/sites/default/files/GSCAET-2021-0023.pdf - -[^12]: https://pmc.ncbi.nlm.nih.gov/articles/PMC6042832/ - -[^13]: https://edit.elte.hu/xmlui/bitstream/10831/75682/1/DH_2020_Evf3_Sz1_horvath.pdf - -[^14]: https://arxiv.org/pdf/2002.03064.pdf - -[^15]: https://ojs.mtak.hu/index.php/fogorv-szemle/article/download/11959/9738 - -[^16]: https://arxiv.org/pdf/2208.09097.pdf - -[^17]: https://dx.plos.org/10.1371/journal.pone.0306100 - -[^18]: https://arxiv.org/pdf/2504.02431.pdf - -[^19]: http://www.mdpi.com/1420-3049/20/6/9977/pdf - -[^20]: https://lobehub.com/mcp/your-username-dokploy-mcp - -[^21]: https://github.com/Dokploy/dokploy/issues/2413 - -[^22]: https://www.youtube.com/watch?v=pL_rNDEFxD8 - -[^23]: https://news.ycombinator.com/item?id=44884077 - -[^24]: https://www.youtube.com/watch?v=fCZqnKxl33w - -[^25]: https://www.reddit.com/r/nextjs/comments/1mxwaaf/is_dockploy_an_option/ - -[^26]: https://www.youtube.com/watch?v=zIl_1oyOF0Y - -[^27]: https://github.com/Dokploy/dokploy/releases - -[^28]: https://talentasipil.unbari.ac.id/index.php/talenta/article/view/667 - -[^29]: https://www.sciltp.com/journals/ijamm/2025/2/1011 - -[^30]: https://ijaem.net/issue_dcp/Design%20and%20Development%20of%20an%20Online%20Recruitment%20Systems%20for%20Small%20And%20Medium%20Sized%20Enterprises%20In%20Zambia.pdf - -[^31]: https://esajournals.onlinelibrary.wiley.com/doi/10.1002/fee.1472 - -[^32]: https://www.semanticscholar.org/paper/a67dc2084d045555f037cb307de1936e4674bf27 - -[^33]: https://www.spiedigitallibrary.org/conference-proceedings-of-spie/13097/3019127/Adaptive-optics-at-Gemini-observatories-past-present-and-future/10.1117/12.3019127.full - -[^34]: https://iopscience.iop.org/article/10.1149/MA2023-01141350mtgabs - -[^35]: https://ieeexplore.ieee.org/document/9721706/ - -[^36]: https://www.semanticscholar.org/paper/dbc5e65588d502c974beb2c1b05c03e88174f0fb - -[^37]: https://iopscience.iop.org/article/10.1088/1755-1315/506/1/012010 - -[^38]: https://arxiv.org/pdf/2210.01073.pdf - -[^39]: http://thesai.org/Downloads/Volume13No4/Paper_60-Framework_to_Deploy_Containers_using_Kubernetes_and_CICD_Pipeline.pdf - -[^40]: https://arxiv.org/pdf/2312.03250.pdf - -[^41]: https://arxiv.org/pdf/2309.00166.pdf - -[^42]: http://arxiv.org/pdf/2407.19928.pdf - -[^43]: https://hamidullah.me/blog - -[^44]: https://www.reddit.com/r/webhosting/comments/1mij2hz/cant_deploy_a_nextjs_project_properly_on_vps/ - -[^45]: https://nikicaraznatovic.me/blog/using-vps - -[^46]: https://www.youtube.com/watch?v=_tiuMTaPtCo - -[^47]: https://forum.ghost.org/t/dokploy-ghost-6-0/59641 - -[^48]: https://www.youtube.com/watch?v=jYRdSfeGUus - -[^49]: https://github.com/Dokploy/dokploy/issues/2331 - -[^50]: http://link.springer.com/10.1007/3-540-45150-1_3 - -[^51]: https://www.epj-conferences.org/10.1051/epjconf/202429504011 - -[^52]: https://onepetro.org/SPETWID/proceedings/24TWIP/24TWIP/D021S003R001/612657 - -[^53]: https://arxiv.org/abs/2207.12779 - -[^54]: https://ieeexplore.ieee.org/document/10004463/ - -[^55]: https://ieeexplore.ieee.org/document/10407325/ - -[^56]: https://wseas.com/journals/dcm/2023/a46dcm-015(2023).pdf - -[^57]: https://www.frontiersin.org/articles/10.3389/fenvs.2024.1375193/full - -[^58]: https://ac.inf.elte.hu/Vol_055_2023/doi/019_55.html - -[^59]: https://dl.acm.org/doi/10.1145/3605098.3635981 - -[^60]: http://arxiv.org/pdf/2104.07899.pdf - -[^61]: http://arxiv.org/pdf/2405.11316.pdf - -[^62]: https://arxiv.org/pdf/1804.05039.pdf - -[^63]: https://arxiv.org/pdf/2409.03405.pdf - -[^64]: https://www.mdpi.com/1424-8220/25/3/914 - -[^65]: http://arxiv.org/pdf/2201.12879.pdf - -[^66]: https://arxiv.org/html/2504.07707v1 - -[^67]: https://arxiv.org/pdf/1501.02967.pdf - -[^68]: https://arxiv.org/pdf/2112.12595.pdf - -[^69]: https://arxiv.org/pdf/2205.14498.pdf - -[^70]: https://github.com/Dokploy/dokploy/issues/2341 - -[^71]: https://github.com/Dokploy/dokploy/actions - -[^72]: https://www.reddit.com/r/hetzner/comments/1mrqiad/how_do_people_manage_a_5_vps/ - -[^73]: https://github.com/Dokploy/dokploy/activity - -[^74]: https://tom-doerr.github.io/repo_posts/ - -[^75]: https://www.hostinger.com/tutorials/how-to-host-n8n-with-coolify - -[^76]: https://ppl-ai-code-interpreter-files.s3.amazonaws.com/web/direct-files/d38b8c1e31ab15bfa3adaa9713847e61/db3553a8-1145-461e-8dbe-3e1ecaa61bc7/cd6eb76c.md - diff --git a/docs/Dokploy UI – Uj site letrehozasa és urlap kitoltese.pdf b/docs/Dokploy UI – Uj site letrehozasa és urlap kitoltese.pdf deleted file mode 100755 index 883b4b5..0000000 Binary files a/docs/Dokploy UI – Uj site letrehozasa és urlap kitoltese.pdf and /dev/null differ diff --git a/docs/fejlesztesi_terv_mozdit.md b/docs/fejlesztesi_terv_mozdit.md index b772837..368fa61 100755 --- a/docs/fejlesztesi_terv_mozdit.md +++ b/docs/fejlesztesi_terv_mozdit.md @@ -29,11 +29,11 @@ Next.js 14+ (App Router + TypeScript) ### Deployment és Infrastruktúra ``` -Dokploy Platform +Docker Compose (natív deploy — deploy.sh) ├── Docker container (multi-stage build) -├── Nginx/Traefik reverse proxy +├── Nginx/caddy reverse proxy ├── Let’s Encrypt SSL automatikus -└── GitHub Actions CI/CD pipeline +└── Gitea Actions CI/CD pipeline ``` ### Márkázás és Design @@ -70,7 +70,7 @@ cd mozdit-proto #### 0.3 Teljes Deployment Tesztelés ```bash -# Dokploy telepítés és alap konfiguráció +# Natív docker compose deploy beállítás # Staging környezeten teljes CI/CD pipeline kipróbálása # Automatikus deployment build → test → deploy → monitoring ``` @@ -104,10 +104,10 @@ npm install -D @playwright/test @testing-library/react @testing-library/jest-dom - Prettier és ESLint konfiguráció - Husky pre-commit hookok -#### 1.3 Dokploy Staging Környezet -- Dokploy telepítés és konfiguráció +#### 1.3 Staging Környezet (natív docker compose) +- Szerver előkészítés: Docker + docker compose telepítés - Staging alkalmazás létrehozása (`staging.mozdit.hu`) -- Environment változók beállítása +- Environment változók beállítása (.env.staging) - Docker multi-stage build konfiguráció **Mérföldkő**: Futtatható dev környezet staging deploy képességgel @@ -245,7 +245,7 @@ Történik: form küldés után visszaigazolás jelenik meg **Cél**: Production deployment, monitoring és visszajelzés gyűjtés #### 4.1 Production Deploy -- Dokploy production alkalmazás konfiguráció +- Natív docker compose production konfiguráció (`deploy.sh production`) - Domain routing (`www.mozdit.hu` → `mozdit.hu`) - HTTPS automatikus (Let’s Encrypt) - Environment változók production értékei @@ -323,8 +323,8 @@ export async function GET() { - **Developer Experience**: TypeScript first-class support, hot reload - **Ecosystem**: Nagy közösség, stabil könyvtárak rengeteg -### Dokploy Deployment Platform -- **Költséghatékonyság**: €4-20/hó vs managed PaaS €50+ +### Docker Compose (natív deploy) +- **Költséghatékonyság**: Saját szerver, nincs PaaS díj - **Teljes kontroll**: Saját szerver, custom Docker konfiguráció - **Biztonság**: Magán infrastruktúra, adatvédelmet könnyebb teljesíteni - **Skálázhatóság**: Multi-server support későbbi növekedéshez @@ -349,7 +349,7 @@ export async function GET() { - **Napi standup**: Progress jelentés és blocker azonosítás - **Weekly demo**: Áttekintés és visszajelzés gyűjtés - **GitHub Issues**: Feladatkövetés és dokumentáció -- **Dokploy Dashboard**: Deploy status és monitoring +- **Deploy dashboard**: Deploy status és monitoring (healthcheck + logs) ### Stakeholder Kommunikáció - **Heti előrehaladási jelentések**: Vizualizált mérföldkövek @@ -370,7 +370,7 @@ graph TB end subgraph "Fázis 1: Inicializálás (1 hét)" - A1[Repository setup] --> A2[Dokploy staging] + A1[Repository setup] --> A2[Staging deploy] A2 --> A3[CI/CD pipeline] A3 --> A4[Environment config] end @@ -412,7 +412,7 @@ Nap 1-4 Hét 1 Hét 2-3 Hét 4 Hét 5 │ │ │ │ │ ├── Fázis 0 ├── Fázis 1 ├── Fázis 2 ├── Fázis 3 ├── Fázis 4 │ Prototípus ├── Setup ├── Core UI ├── QA ├── Production -│ Pipeline │ Dokploy │ Pages │ Testing │ Deploy +│ Pipeline │ Compose │ Pages │ Testing │ Deploy │ tesztelés │ Pipeline │ Forms │ Security │ Monitoring ``` diff --git a/docs/mozd_it_weboldal_kovetelmeny_dokploy_deploy_specifikacio_mvp.md b/docs/mozd_it_weboldal_kovetelmeny_dokploy_deploy_specifikacio_mvp.md deleted file mode 100755 index f4a9b63..0000000 --- a/docs/mozd_it_weboldal_kovetelmeny_dokploy_deploy_specifikacio_mvp.md +++ /dev/null @@ -1,236 +0,0 @@ -# mozdIT Bt. — Weboldal követelmény + Dokploy deploy specifikáció (MVP) - -## 0) Rövid összefoglaló -Cél: minimális, de komplett, mobil‑első, gyors és biztonságos **bemutatkozó weboldal** a mozdIT Bt.-nek, kiemelt **Webmail** linkkel és rövid, egyedi bemutatkozással. A később készülő **admin aloldal** (szerver‑monitoring/menedzsment) helye előkészítve. Deployment és tesztelés: **Dokploy** környezetben. - ---- - -## 1) MVP oldalak és funkciók -**Oldalak** -- **Kezdőlap**: rövid, egyedi bemutatkozó szöveg; CTA: **Webmail** link (külső URL); szolgáltatások rövid dobozai. -- **Rólunk**: rövid történet, működés óta, személyes ügyfélkezelés, megbízhatóság. -- **Szolgáltatások**: web hosting, email szolgáltatás, DNS adminisztráció (rövid leírás + kapcsolat CTA). -- **Kapcsolat**: űrlap (név, email, üzenet, GDPR checkbox); cég e‑mail, telefonszám (ha lesz), cégnév, székhely. -- **Admin** (előre jelzett aloldal): `/` route fenntartva; tartalom később. - -**Funkciók (MVP)** -- Reszponzív navigáció (hamburger mobilon, sticky header desktopon). -- Űrlapvalidáció (frontend: required + e‑mail forma; backend: spam‑védett endpoint). -- SEO alapok (title/description per oldal, OG, sitemap, robots). -- Analytics: Plausible (cookieless) vagy GA4 (cookie‑consenttel). - ---- - -## 2) Nem‑funkcionális követelmények -- **Reszponzivitás:** mobile‑first; töréspontok: 360 / 640 / 768 / 1024 / 1280+ px. -- **Teljesítmény:** Lighthouse (mobil/desktop) ≥ 90; képek WebP/AVIF; lazy‑load; kritikus CSS minimalizálás. -- **A11y:** WCAG 2.1 AA (fókusz, ARIA, kontraszt ≥ 4.5:1, logikus heading). -- **Biztonság:** HTTPS, alap CSP, XSS/CSRF védelem, input szűrés a backend felé. -- **Megfigyelhetőség:** Sentry (client) + alap logok; uptime healthcheck. - ---- - -## 3) Technológiai stack -- **Frontend:** Next.js (React + TypeScript) — SSG/SSR vegyes; App Router. -- **UI:** Tailwind CSS + egyszerű saját komponensek (később: shadcn/ui opcionális). -- **Űrlapok:** React Hook Form + Zod. -- **State:** minimális local state + SWR (ha kell fetch). -- **Teszt:** Jest + Testing Library (unit), Playwright (E2E — smoke a fő flow‑kra). -- **CMS (opcionális később):** Strapi/Sanity; MVP‑ben statikus tartalom JSON/MDX. - -Projekt‑struktúra (rövid): -``` -/src - /app (Next.js routes) - /components - /styles - /lib - /tests (unit + e2e cfg) -/public -``` - ---- - -## 4) Tartalom (MVP) — copy irány -- **Hero cím** (Kezdőlap): „Megbízható web‑ és email‑szolgáltatás **személyre szabott támogatással**.” -- **Alcím:** „Kis ügyfélkör, nagy figyelem: stabil tárhely, üzembiztos levelezés és DNS adminisztráció — gyors reakcióval.” -- **USP bullet‑ek:** személyes ügyfélkezelés; gyors reagálás; stabil háttér; rugalmas támogatás. -- **Webmail gomb:** „Ugrás a Webmailre”. -- **Rólunk rövid:** mióta működtök; miért a kicsi ügyfélkör; megbízhatóság/folyamatos támogatás. -- **Szolgáltatás dobozok:** Web Hosting / Email / DNS Admin (1–2 mondat/elem, Kapcsolat CTA). - -*(Megjegyzés: a végleges szöveg a review során finomhangolható.)* - ---- - -## 5) Dokploy környezet — architektúra és folyamat - -### 5.1 Környezetek -- **Staging**: `staging.mozdit.hu` (pl. alap auth / IP‑korlátozás, ha kell) -- **Production**: `mozdit.hu` (www → apex redirect vagy fordítva) - -### 5.2 Alap komponensek -- **Reverse proxy/ingress**: Dokploy beépített (Traefik/Nginx környezet — a dokploy stack szerint). -- **App konténer**: Next.js app (Node 20) — SSG build + Node futtatás (vagy statikus export + Nginx). -- **Opció**: CDN (Cloudflare) a statikus assetekhez. - -### 5.3 Environment változók (példa) -- `NEXT_PUBLIC_WEBMAIL_URL=https://webmail.mozdit.hu` -- `COMPANY_NAME=mozdIT Bt.` -- `SITE_URL=https://mozdit.hu` -- `ANALYTICS_PROVIDER=plausible|ga4` -- `PLAUSIBLE_DOMAIN=mozdit.hu` (ha Plausible) -- `GA4_ID=G-XXXXXXX` (ha GA4) -- `CONTACT_API_URL=https://api.mozdit.hu/contact` (ha külön backend) - -### 5.4 Healthcheck & readiness -- HTTP GET `/api/health` → `{status:"ok"}` -- Staging/prod deploy csak zöld health esetén; rollback automatikus szabály (utolsó zöld image). - ---- - -## 6) Docker & build - -### 6.1 Next.js multi‑stage Dockerfile (Node 20) -```dockerfile -# 1) Build stage -FROM node:20-alpine AS builder -WORKDIR /app -COPY package.json package-lock.json* pnpm-lock.yaml* yarn.lock* ./ -RUN npm ci --prefer-offline --no-audit --legacy-peer-deps || npm ci -COPY . . -RUN npm run build - -# 2) Run stage (Node server) -FROM node:20-alpine AS runner -WORKDIR /app -ENV NODE_ENV=production -COPY --from=builder /app/.next ./.next -COPY --from=builder /app/public ./public -COPY --from=builder /app/package.json ./package.json -RUN npm ci --omit=dev --prefer-offline --no-audit || true -EXPOSE 3000 -HEALTHCHECK --interval=30s --timeout=5s --retries=5 CMD wget -qO- http://localhost:3000/api/health || exit 1 -CMD ["npm","start"] -``` -*Megjegyzés:* Ha **statikus export** (SSG only) elegendő, választható Nginx runtime is. - -### 6.2 Dokploy app (magas szint) -- **Repository link** + **branch per environment** (`main` → prod, `develop` → staging) vagy tag‑alapú deploy. -- **Build & deploy**: Dockerfile alapján; port 3000; domain mapping staging/prod; env‑ek UI‑ból/secret store‑ból. -- **Zero‑downtime**: rolling frissítés (legalább 2 replika prod‑on, ha erőforrás engedi). - ---- - -## 7) CI/CD (példa: GitHub Actions) -Workflow: **lint → unit → build → e2e (smoke, staging) → Dokploy deploy → Lighthouse check (staging) → prod release** - -`.github/workflows/ci.yml` (részlet): -```yaml -name: CI -on: - push: - branches: ["main", "develop"] -jobs: - build-test: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: { node-version: 20 } - - run: npm ci - - run: npm run lint && npm run test -- --ci - - run: npm run build - docker: - needs: build-test - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Build & push image - uses: docker/build-push-action@v5 - with: - push: true - context: . - tags: registry.example.com/mozdit/site:${{ github.sha }} - deploy-staging: - needs: docker - runs-on: ubuntu-latest - steps: - - name: Trigger Dokploy staging deploy - run: | - curl -X POST "$DOKPLOY_STAGING_HOOK" -H "Authorization: Bearer $DOKPLOY_TOKEN" \ - -d '{"image":"registry.example.com/mozdit/site:${{ github.sha }}"}' - environment: staging - lighthouse: - needs: deploy-staging - runs-on: ubuntu-latest - steps: - - name: Lighthouse CI - run: npx @lhci/cli autorun --collect.url=https://staging.mozdit.hu - deploy-prod: - if: github.ref == 'refs/heads/main' - needs: lighthouse - runs-on: ubuntu-latest - steps: - - name: Trigger Dokploy prod deploy - run: | - curl -X POST "$DOKPLOY_PROD_HOOK" -H "Authorization: Bearer $DOKPLOY_TOKEN" \ - -d '{"image":"registry.example.com/mozdit/site:${{ github.sha }}"}' - environment: production -``` -*Megjegyzés:* a Dokploy‑oldali webhook/API URL és token a platform beállításától függ; ha Git integrációt használtok, a "Trigger" lépés helyett **auto‑deploy** szabály is beállítható. - ---- - -## 8) Tesztelés a Dokploy stagingen -- **Smoke E2E** (Playwright): 3 alap flow → kezdőlap betölt, Webmail link működik, Kapcsolat űrlap hibakezelés OK. -- **Vizsgálatok**: Lighthouse (mobil & desktop), A11y ellenőrző (axe), 404/500 oldal viselkedés. -- **Megfigyelés**: Sentry DSN kapcsolva; health endpoint figyelése. - ---- - -## 9) Biztonság & adatvédelem -- HTTPS (Let’s Encrypt / Dokploy integráció), HSTS. -- **CSP** baseline (script‑src 'self' + szükséges 3rd party); **Referrer‑Policy**, **X‑Frame‑Options** (SAMEORIGIN), **X‑Content‑Type‑Options**. -- **GDPR**: cookie banner ha GA4; Plausible esetén banner elhagyható. -- Kapcsolat űrlap: captcha/light rate‑limit, backend input validáció, e‑mail küldés queue‑val (ha szükséges). - ---- - -## 10) Rollback, backup, verziózás -- **Release tag** (semver) + image tag; Dokploy‑ban korábbi image visszagörgetés. -- **Konfig backup**: env‑ek és Dokploy app export; infra‑as‑code (Dockerfile, workflow‑k) GIT‑ben. - ---- - -## 11) Elfogadási kritériumok (MVP) -- Kezdőlap, Rólunk, Szolgáltatások, Kapcsolat elérhető és reszponzív. -- Webmail link jól működik (új lapon, nofollow opcionális). -- Lighthouse ≥ 90 minden fő mérőszámon stagingen. -- Űrlap hibák/fókuszállapotok a11y‑konformak. -- CI pipeline zöld, staging deploy automatikus; prod deploy csak zöld staging után. - ---- - -## 12) Kezdő feladatlista (ticket sablonok) -1. **Repo & Next.js bootstrap** — *Acceptance*: app indul dev módban; TS, ESLint, Prettier beállítva. -2. **Tailwind + alap layout** — *Acceptance*: reszponzív header/footer; tipográfia, színek. -3. **Kezdőlap (Hero + USP + Webmail CTA)** — *Acceptance*: 1s alatt festődik mobilon; link működik. -4. **Rólunk oldal** — *Acceptance*: heading‑hierarchia helyes; szövegek MDX‑ből tölthetők. -5. **Szolgáltatások oldal** — *Acceptance*: 3 doboz + CTA → Kapcsolat. -6. **Kapcsolat űrlap + API stub** — *Acceptance*: validáció, hibák; egyszerű spam‑védelem. -7. **/api/health endpoint** — *Acceptance*: `{status:"ok"}` JSON. -8. **Dockerfile + Dokploy staging app** — *Acceptance*: buildel, deployol, domain él. -9. **CI (lint, unit) + Staging deploy trigger** — *Acceptance*: PR‑re fut; stagingre pushol. -10. **Playwright smoke E2E + Lighthouse CI** — *Acceptance*: fut stagingen, riport mentve. -11. **Prod app + domain + HTTPS** — *Acceptance*: élő site; automatikus HTTPS; monitoring bekapcsolva. - ---- - -## 13) Későbbi bővítések -- Blog/Újdonságok; többnyelvűség; admin aloldal funkciói; CDN cache; képgenerálás; CMS integráció. - ---- - -*Megjegyzés:* A végleges Dokploy beállítások (webhook/API, auto‑deploy, replika szám, storage) a rendelkezésre álló szerver erőforrásoktól és a Dokploy verziójától függően finomhangolandók. -