Commit Graph

48 Commits

Author SHA1 Message Date
Agent Zero b3133abbc1 fix: Magic ENV SERVICE_FQDN_CRM_APP_8000 for auto domain + SSL 2026-08-05 22:29:41 +02:00
Agent Zero 549c11018c fix: domain with :443 port for SSL certificate 2026-08-05 22:24:57 +02:00
Agent Zero 2d25dc35e0 fix: docker_compose_domains + worker depends_on crm-app healthy 2026-08-05 22:18:12 +02:00
Agent Zero c278597757 fix: deploy.py --initial als einzelner docker-compose Stack + docker-compose.yaml rename 2026-08-05 22:11:29 +02:00
Agent Zero 0ebc411fd8 feat: Auto-seed admin user on container start
- prestart.sh: runs seed_admin.py after migrations
- seed_admin.py: reads ADMIN_EMAIL and ADMIN_PASSWORD from env vars
- Creates default tenant + admin role + admin user if not exists
2026-08-04 12:21:38 +02:00
Agent Zero 4b00204b63 feat: Domain-based app names + admin user seeding
- deploy.py: APP_NAME derived from APP_DOMAIN (e.g. crm.media-on.de → crm)
- deploy.py: seed_admin_user() runs seed_admin.py after deploy
- fast-deploy.sh: Same domain-based name derivation
- No hardcoded leocrm-api/leocrm-worker defaults
2026-08-04 12:17:01 +02:00
Agent Zero 7d3007b6c4 Fix: Remove hardcoded UUIDs and secrets from deploy scripts
- deploy.py: UUIDs from env vars or Coolify API lookup by name
- fast-deploy.sh: No hardcoded UUIDs, APP_DOMAIN from env
- docker-compose.yml: All secrets from env vars, no hardcoded values
- .env.example: All required vars documented
- Deleted obsolete fast-frontend-deploy.sh with hardcoded container name
2026-08-04 11:13:44 +02:00
Agent Zero 485fbd9877 Phase 8.3+8.4: Restore-Test Script und Coolify-Endabnahme
8.3 Restore-Test:
- restore_test.sh: PostgreSQL Backup restore, Migrationen, Data Integrity, RLS Re-test
- Prueft Alembic Version, Table Count, RLS >= 100, Contacts > 0
- RLS Re-test: 0 rows ohne/fake tenant context
- Erfordert TEST_DATABASE_URL (separate Test-DB)

8.4 Coolify-Endabnahme (live verifiziert):
- API healthy: DB up, Redis up, Worker up
- Worker healthy: running:healthy
- Login: admin@media-on.de, admin, Default Org
- Workspace Wechsel: 1 Workspace, Context modules mit is_visible
- DMS Upload + Download: HTTP 200, Content korrekt
- MCP Read: 1 Tool (call_crm_api), Auth api-token
- Outbox: 5 published events
- Token CRUD: Create, List, Revoke (204)
2026-08-03 15:50:11 +02:00
Agent Zero f4364f30e0 Phase 8.1+8.2: CI Pipeline und Migrations-Release-Gate
8.1 Merge-CI:
- Backend Tests und Frontend Tests zu ci_pipeline.sh hinzugefuegt
- Migration Hash Check (<=0092) mit check_migration_hashes.py
- npm ci --legacy-peer-deps in Forgejo Workflow und ci_pipeline.sh
- 93 Migration-Hashes generiert und verifiziert

8.2 Migrations-Release-Gate:
- migration_release_gate.sh: Fresh Install, Schema Snapshot, RLS/Grants Check, Cross-Tenant Test, Data Integrity
- Prueft leere DB Installation mit Alembic Head + Plugin-Migrationen
- Verifiziert RLS >= 100 Tabellen, 4 DB-Rollen, kein BYPASSRLS auf crm_api
- Cross-Tenant: 0 rows ohne/fake tenant context
2026-08-03 15:49:03 +02:00
Agent Zero 236f0d2a5d deploy.py: create_api_application ueber /applications/private-deploy-key (Git-basiert) 2026-08-03 02:18:23 +02:00
Agent Zero 95972d2cdd deploy.py: --initial mit API-UUID fuer Worker-Image und Deploy 2026-08-03 02:16:31 +02:00
Agent Zero 0c789f7660 deploy.py: create_api_application ueber /applications/dockerfile (base64) 2026-08-03 02:10:38 +02:00
Agent Zero cd48d99c65 deploy.py: --initial Modus fuer vollautomatische Erstinstallation ueber Coolify API 2026-08-03 02:05:19 +02:00
Agent Zero f775405a01 deploy.py: 409 Conflict Handling (POST -> PATCH bei existierenden ENVs) 2026-08-03 01:32:41 +02:00
Agent Zero 7e5e0dd8bd deploy.py: ENV-Variablen ueber Coolify API setzen, keine manuelle .env-Datei mehr 2026-08-03 01:30:03 +02:00
Agent Zero 8ac90e4dd6 deploy.py: .env nach update_service schreiben + _wait_service_healthy Bug fix 2026-08-03 01:22:44 +02:00
Agent Zero 5eec2fdde8 deploy.py: ENV-Variablen statt hardcoded Passwoerter + .env auf Server schreiben 2026-08-03 01:17:25 +02:00
Agent Zero c63ab9b45a Fix deploy.py: Use /deploy endpoint for Worker Service + connect_to_docker_network 2026-08-03 01:00:02 +02:00
Agent Zero 2b50f528f3 Fix deploy.py: head -1 statt tail -1 fuer Image-Tag (neuestes Image zuerst) 2026-08-03 00:47:30 +02:00
Agent Zero ceb06600c5 Fix deploy.py: Worker-Deploy repariert
- Tag :latest auf neuestes Commit-Image (Coolify taggt mit Hash, nicht latest)
- Verbinde Worker mit coolify Netzwerk nach Restart (für Redis/Postgres DNS)
- Kein update_service mehr (überschreibt Coolify-Konfiguration)
- Worker-Compose auf Server korrigiert (coolify Netzwerk in Service-Definition)
2026-08-03 00:12:00 +02:00
Agent Zero e2b3cf081b Fix deploy.py: Worker-Deploy war kaputt
- Bug 1: WORKER_COMPOSE_YAML hatte PW Platzhalter statt echter Passwörter
- Bug 2: deploy_worker rief deploy_application auf Service-UUID auf (falsche API)
- Bug 3: verify_worker_service akzeptierte nicht running:healthy Status
- Fix: Echte Passwörter, update_service+restart statt deploy_application, Status-Check korrigiert
2026-08-02 23:57:16 +02:00
Agent Zero a922408e49 fix: add Origin header to login test in deploy.py 2026-08-01 21:23:52 +02:00
Agent Zero b3f40bacd2 fix: deploy.py rewrite — everything via Coolify API, no manual docker 2026-08-01 21:22:55 +02:00
Agent Zero 89b775b9ef fix: legacy app.tenant_id policies on _old tables + seed_admin.py rewrite
- Migration 0090: Drop legacy tenant_isolation policies on companies_old,
  company_contacts_old, contacts_old that used app.tenant_id variable.
  Create new policies using app.current_tenant_id for crm_api/crm_worker.
- seed_admin.py: Rewrite to use migration engine (crm_migration) for
  bootstrap, set tenant context, create Tenant + Role + User + UserTenant.
  No longer passes tenant_id as User parameter.

Fixes: 3 legacy app.tenant_id policies found in Gate 2 verification.
Fixes: seed_admin.py incompatible with current User model.
2026-07-31 22:23:38 +02:00
Agent Zero b3cf4474be fix: fast-deploy.sh also cleans sw.js, registerSW.js, workbox-*.js 2026-07-30 09:43:29 +02:00
Agent Zero 84aab20256 fix: fast-deploy.sh clears old assets before copying to prevent stale JS files 2026-07-30 09:38:31 +02:00
Agent Zero 8d5f272ba5 fix: deploy.py RLS exclude list reduced to 35 system tables only 2026-07-30 01:00:59 +02:00
Agent Zero 7f872b8bfc fix: deploy.py exclude system tables from RLS enforcement 2026-07-30 00:51:16 +02:00
Agent Zero 3eeeeb6173 phase10: CI erweitert (Ruff, Cross-Tenant Test, Dependency Scan, Container Smoke Test, npm ci strict) + 15 total gates 2026-07-29 23:20:03 +02:00
Agent Zero 5088b4a735 phase9: migration test script + .gitignore cleanup + CI alembic migration gate 2026-07-29 23:17:03 +02:00
Agent Zero 9bd6936d17 ci: CI/CD pipeline with 10 quality gates + Forgejo Actions workflow 2026-07-29 13:05:14 +02:00
Agent Zero 24690fb674 sprint20-23: tests + documentation + guest access + infrastructure + migrations 0059 2026-07-29 02:53:37 +02:00
Agent Zero 5378372aba security: remove hardcoded credentials from scripts and docs 2026-07-28 00:35:09 +02:00
Agent Zero 106f888cb9 feat: add fast-deploy.sh for quick frontend-only deploys (~20s) 2026-07-28 00:03:31 +02:00
Agent Zero 98eb1d0d89 feat: Plugin-System Umbau — 6 Phasen komplett abgeschlossen
Check Cross-Plugin Imports / check (push) Has been cancelled
Phase 1: Contracts konsequent nutzen
- 12 neue contracts.py erstellt (alle 19 Plugins haben jetzt contracts)
- 4 bestehende contracts.py an zentrale ContractRegistry angepasst
- Alle 19 Plugins haben on_deactivate mit Contract-Unregister
- 0 echte problematische INTER-Plugin Imports

Phase 2: Hooks/Filters-System
- app/core/hooks.py (HookRegistry mit actions + filters)
- 15 Hook-Punkte in Core-Services (contact, auth, mail, calendar, user, dms)
- BasePlugin.on_deactivate meldet alle Hooks ab

Phase 3: Plugin-Isolation
- scripts/check_cross_plugin_imports.py (Linting-Regel)
- .github/workflows/check-cross-plugin-imports.yml (CI/CD)
- .pre-commit-cross-plugin.yaml (Pre-commit Hook)
- 155 Dateien geprueft, 0 Verstoesse

Phase 4: Plugin-Versioning
- app/plugins/semver.py (SemVer mit Parse, Compare, Pre-release)
- migration_runner.py erweitert: run_migration_down, rollback_to_version
- manifest.py: min_app_version Feld
- registry.py: App-Version-Compatibility-Check bei Installation
- GET /api/v1/plugins/updates Endpoint

Phase 5: Marketplace-Vorbereitung
- app/plugins/signature.py (Ed25519 Signatur-Validierung)
- app/plugins/quarantine.py (Plugin-Quarantine mit Validierung)
- app/models/plugin_allowlist.py + Migration 0046
- manifest.py: author, license, homepage, icon, screenshots, changelog, marketplace_tags, price
- registry.py: discover_external(), discover_all()
- POST /api/v1/plugins/install-marketplace (deaktiviert)

Phase 6: Manifest-Anpassung
- manifest.py: 12 neue Felder + SemVer/Hook-Name Validierung
- MANIFEST_SCHEMA_DOC aktualisiert
- Alle 19 Plugin-Manifeste aktualisiert
- Frontend PluginUiManifest Typ erweitert

Zusaetzliche Bug-Fixes:
- test_sample-Modul erstellt
- conftest.py Deadlock-Prevention
- SESSION_COOKIE_SECURE=true
- dump.rdb aus Git entfernt + .gitignore
- backup.py datetime.utcnow -> func.now()
- system_settings.py JSONB-Import nach oben
- tax.py Mapped[float] -> Mapped[Decimal]
- notification.py type_key-Laengen vereinheitlicht

Tests: 91 neue Tests, alle bestanden
2026-07-26 23:15:34 +02:00
Agent Zero 744d595cae Fix: deploy.py DB verification accepts alembic version >= 0045 2026-07-26 22:14:47 +02:00
Agent Zero b067369651 Fix: deploy.py status check — accept finished as success 2026-07-26 00:59:10 +02:00
Agent Zero 12220cc640 Deploy: portable volume config via Coolify DB, works on any instance 2026-07-25 23:50:06 +02:00
Agent Zero 745b634e7c Deploy automation: 8-step pipeline with volume mounting, multi-container docker-compose 2026-07-25 22:48:38 +02:00
Agent Zero 20e6545aa1 Add automated deploy script with RLS, worker, health checks 2026-07-25 22:42:05 +02:00
Agent Zero 387fc9fbaa feat(7.9): add AI test runner script with unified JSON/CSV reporting 2026-07-24 01:34:34 +02:00
Agent Zero 9cfc6bf3b0 Phase 5.15: Automated backup system with pg_dump, file backup, retention, restore, notifications 2026-07-23 22:48:19 +02:00
Agent Zero 3c1b2f227b Phase 5.13: CI/CD deploy script with build/test/deploy/rollback 2026-07-23 22:39:14 +02:00
Agent Zero d9c9ba6630 Phase 5.12: API health check script for KI 2026-07-23 22:37:25 +02:00
leocrm-bot 02a0fde2e8 fix: use admin@media-on.de instead of .local (invalid TLD for email-validator) 2026-07-04 19:39:36 +02:00
leocrm-bot 5dc4d6d4c0 fix: activate plugins on startup + register routes + seed admin script
- lifespan: load active plugins from DB, call on_activate, register routes
- Fixes: Calendar/Mail/DMS/Tags/Permissions routes returning 404
- scripts/seed_admin.py: creates default tenant + admin user
2026-07-02 13:02:38 +02:00
leocrm-bot 4c7f09c518 chore: ruff lint auto-fix — 9 errors fixed (import sorting, unused imports)
- I001: import block sorting in main.py, routes/__init__.py, companies.py, conftest.py, check_indexes.py
- F401: unused imports removed (asyncio, UTC, datetime, AsyncSession)
- 6 ASYNC240/230 warnings remain (os.path.exists in async, open() in test) — minor, non-blocking
2026-07-02 00:20:15 +02:00
leocrm-bot 69e91fd5d0 T10: Monitoring, Performance, Documentation & Environment Config — 38 tests, ruff clean, docs OK
- Extended health endpoint: DB+Redis+Storage+Worker checks with degraded status
- Prometheus metrics endpoint: admin-only, text/plain format
- Metrics: http_requests_total, db_pool_connections, arq_jobs_total
- Structured JSON logging (structlog): timestamp, level, method, path, status, duration_ms, tenant_id
- Performance: page_size max 100 enforced (422), streaming CSV export (StreamingResponse)
- Scripts: seed_perf_data.py, check_indexes.py
- Docs: admin-guide.md (Deploy, Backup, Restore, Env-Vars, Troubleshooting), api-overview.md
- README updated: prod setup, API section, env profiles, admin-guide link
- .env.example: added SECRET_KEY, STORAGE_PATH, SMTP_* vars
- 38 new tests, full regression 564/564 pass (0 failures)
- Ruff: all checks passed
2026-07-01 23:15:35 +02:00