Commit Graph

55 Commits

Author SHA1 Message Date
Ho Ngoc Hai
84f21a4d1c feat(deploy): full staging deployment - 1 replica, parallel Kaniko, all 26 services
Some checks failed
Build & Deploy to K8s / build-and-deploy (push) Failing after 6s
- Scale all 26 services from 2→1 replicas (fit 8.4 available cores)
- HPA min 2→1, max 4→2 for staging
- Rewrite Gitea Actions: batch parallel Kaniko builds (5 per batch)
- Secure credentials via secrets (REPO_PASSWORD, HARBOR_*)
- Kaniko clones from Gitea (already mirrored from GitHub)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 21:44:46 +07:00
Ho Ngoc Hai
31d24c8c4d fix(k8s): switch domains from goodgo.vn to techbi.org
All checks were successful
Build & Deploy to K8s / build-and-deploy (push) Successful in 33s
- api.techbi.org (backend API)
- platform.techbi.org (frontend POS)
- Update JWT Authority, CORS, IdentityServer IssuerUri
- Update TLS secret names

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 20:30:08 +07:00
Ho Ngoc Hai
b885da7cdb fix(cicd): skip namespace apply (already exists) + add patch permission
All checks were successful
Build & Deploy to K8s / build-and-deploy (push) Successful in 32s
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 20:18:02 +07:00
Ho Ngoc Hai
43f0c79478 fix(cicd): use Kaniko Jobs for building Docker images in Gitea Actions
Some checks failed
Build & Deploy to K8s / build-and-deploy (push) Failing after 10s
- Replace docker build with Kaniko Jobs (runner has no Docker daemon)
- Add batch/jobs RBAC for act_runner to create Kaniko Jobs
- Use MinIO ExternalName pointing to existing minio namespace
- Skip build when only K8s configs changed

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 20:15:20 +07:00
Ho Ngoc Hai
48bb30b009 feat(cicd): switch CI/CD from GitHub Actions to Gitea Actions
Some checks failed
Build & Deploy to K8s / build-and-deploy (push) Failing after 15s
- Add .gitea/workflows/deploy.yaml (detect changes → docker build → Harbor push → kubectl deploy)
- Add gitea-sync-cronjob.yaml (GitHub → Gitea mirror sync every 5 min)
- Add act-runner-rbac.yaml (RBAC for act_runner to deploy to staging namespace)
- Add setup-secrets.sh (one-time cluster secret setup script)
- Disable GitHub Actions deploy-staging.yml (CI/CD now via Gitea)

Flow: GitHub push → Gitea sync (5min) → Gitea Actions → Docker build → Harbor → K8s

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 20:03:19 +07:00
Ho Ngoc Hai
966f5412bd feat(k8s): add full K8s staging deployment for all 25 services
- Add 17 new K8s manifests (15 services + RabbitMQ + MinIO)
- Update secrets.yaml with 24 DB URLs for remote PostgreSQL
- Update configmap.yaml with 25 service discovery URLs
- Update ingress.yaml with routes for all services (Nginx + letsencrypt-prod)
- Update network-policy.yaml with all services + RabbitMQ/MinIO policies
- Update deploy-staging.yml CI/CD for all 25 services via Harbor registry
- Fix mkt-* Dockerfiles (add curl, JwtBearer NuGet package)
- Fix membership/ads-billing PendingModelChangesWarning
- Switch DB connections to remote PostgreSQL (212.28.186.239:30992)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 19:53:09 +07:00
Ho Ngoc Hai
6256db44b7 fix(staff): resolve password reset failures and validation issues
- Fix IAM 401: Change reset-password endpoint to [AllowAnonymous]
  (BFF already handles auth, IAM token validation fails across
  Docker container boundaries with Duende IdentityServer)
- Fix IAM 500: Add Npgsql.EnableLegacyTimestampBehavior switch to
  resolve DateTime Kind=Unspecified issue with Identity UserManager
- Fix handler: Use RemovePassword + AddPassword instead of
  ResetPasswordAsync to avoid timestamptz column errors
- Fix validation: Remove mandatory employee code check when editing
  (staff created via IAM may not have employeeCode set)
- Fix Dockerfile: Use root repo context to include blazor-ui package

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 10:55:50 +07:00
Ho Ngoc Hai
36a0a9c256 feat: Add functional tests for MktZaloService, new contract and load tests, and audit documentation, while removing a legacy infrastructure project and updating service configurations. 2026-03-25 15:00:05 +07:00
Ho Ngoc Hai
7b92332710 fix(devops): resolve 4 P2 DevOps improvements (Wave 3 — TEC-263)
- DEVOPS-W-01: Add oliver006/redis_exporter to docker-compose.yml so
  the existing prometheus.yml scrape job (redis-exporter:9121) resolves
- DEVOPS-W-04: Add redis-sentinel.yaml with Redis Sentinel HA setup
  (1 master StatefulSet + 2 replica StatefulSet + 3 sentinel pods)
  replacing the single-instance SPOF redis.yaml in staging K8s
- DEVOPS-W-05: Add network-policy.yaml with default-deny-all NetworkPolicy
  + explicit allow rules for inter-service, Traefik ingress, Redis access,
  Prometheus scrape, and external egress (Neon PostgreSQL, AMQP)
- DEVOPS-M-01: Add aquasecurity/trivy-action to docker-build.yml to scan
  every built image for CRITICAL/HIGH CVEs; results uploaded to GitHub
  Security tab via SARIF

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-03-23 09:54:32 +07:00
Ho Ngoc Hai
6d0ca5bee5 fix: resolve 4 P0 DevOps blockers — image tags, alertmanager, port conflicts
DEVOPS-C-01: Replace hardcoded :latest with IMAGE_TAG placeholder in all 8
production K8s manifests. Update deploy-production.yml to sed-replace
IMAGE_TAG with commit SHA before kubectl apply (remove now-redundant
kubectl set image step).

DEVOPS-C-02: Configure Alertmanager — create alertmanager.yml with Slack +
email receivers (critical/warning/infra routes, inhibition rules). Add
alertmanager:v0.27.0 service to both docker-compose.observability.yml and
deployments/local/docker-compose.yml. Enable prometheus.yml target
(alertmanager:9093).

DEVOPS-C-03: Remove :latest from docker-build.yml main branch push. Now
only SHA tag is pushed for main; :staging+SHA for develop.

DEVOPS-C-04: Add 4 mkt-* services to deployments/local/docker-compose.yml
with unique host ports (facebook:5021, whatsapp:5022, x:5023, zalo:5024)
to eliminate port 5000 conflicts. Add corresponding Traefik routers and
load-balancer entries in infra/traefik/dynamic/routes.yml
(/api/v1/mkt/{facebook,whatsapp,x,zalo}).

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-03-23 09:46:32 +07:00
Ho Ngoc Hai
76b5e6afd0 feat: Phase 2 close-out — multi-branch management, production K8s, revenue dashboard UI, responsive POS
Backend:
- Multi-branch shop management: SetDefaultShop, TransferShop commands, GetMerchantShops paginated query
- Shop aggregate: IsDefault field, SetAsDefault/ClearDefault/TransferOwnership behavior methods
- 2 new domain events: ShopSetAsDefaultDomainEvent, ShopTransferredDomainEvent

Frontend:
- Revenue Dashboard (MudChart line/donut/bar, 4 KPI cards, top products table)
- Staff Performance (sortable table, color-coded completion rates, CSV export)
- Customer QR Menu page (/menu/{ShopId}, mobile-first, Vietnamese labels)
- QR Code Generator admin page (batch generate, print-all, per-table QR)
- Responsive POS layout (collapsible sidebar, slide-out order drawer, touch-friendly CSS)
- ResponsiveOrderPanel component (desktop inline / tablet drawer / mobile overlay)

Infrastructure:
- Production K8s manifests: 8 services (3 replicas, 512Mi-1Gi, HPA min3/max10), Redis with persistence
- Production ingress: api.goodgo.vn, cert-manager TLS, rate-limit middleware
- Deploy script: pre-flight checks, dry-run, single-service deploy, rollback support
- CI/CD: deploy-production.yml with environment approval, commit SHA tags
- Prometheus full scrape config (11 targets), docker-compose observability stack
- Production deployment checklist (80+ items)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 19:58:40 +07:00
Ho Ngoc Hai
653322b26c fix: resolve 12 critical/high issues from code review across backend, frontend, and infra
Backend (7 fixes):
- wallet-service: remove conflicting EF Ignore() calls for mapped backing fields
- fnb-engine: remove KitchenTicket short constructor that set productId=orderItemId
- fnb-engine: replace fire-and-forget Task.Run with direct await for inventory deduction
- TenantMiddleware: implement PostgreSQL RLS SET LOCAL in 4 services (wallet, fnb, inventory, catalog)
- order-service: fix SQL injection pattern in TenantMiddleware with Guid.ToString("D")
- order-service: add ValidateShopAccess() authorization check in SignalR PosHub
- 4 services: register IDbConnection (NpgsqlConnection) in DI for RLS middleware

Frontend (3 fixes):
- PosDataService: return Success=false (not true) when PayOrder response parsing fails
- QrPayment: add _disposed guard to prevent timer race condition after component disposal
- BFF OrderController: add [Authorize] attribute to require JWT for all endpoints

Infrastructure (3 fixes):
- docker-compose: upgrade PostgreSQL 15-alpine to 16-alpine per project spec
- init-databases.sh: add 4 missing marketing service databases (mkt_*)
- Traefik routes: add wallet, catalog, booking routers and /api/v1/stock path

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 16:22:08 +07:00
Ho Ngoc Hai
1d12a7980b feat: add order lifecycle integration tests (29 tests) and staging K8s deployment manifests
Testing (P0-7):
- 29 functional tests for order-service API (create/pay/complete/cancel lifecycle)
- CustomWebApplicationFactory with InMemory DB, mocked wallet/SignalR/tenant
- TestAuthHandler for JWT auth in tests
- Full lifecycle tests: cash flow and online payment flow end-to-end

Staging Deployment (P0-8):
- K8s manifests for 8 MVP services + Redis + POS web (namespace, configmap, secrets)
- Traefik Ingress with path-based routing and TLS via cert-manager
- HPA auto-scaling (2-4 replicas, CPU/memory thresholds)
- deploy-staging.sh script with --dry-run and --service flags
- CI/CD: deploy-staging.yml and docker-build.yml with matrix strategy
- Consistent patterns: port 8080, 3 health probes, RollingUpdate

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 13:56:03 +07:00
Ho Ngoc Hai
b041ba5449 feat(web-client-tpos): integrate StorageService API and adapt client data handling while removing multi-vertical architecture plan documentation. 2026-03-05 04:25:53 +07:00
Ho Ngoc Hai
028ef4c1cd feat: implement user-based wallet and transaction retrieval by parsing JWT sub claim and adjust JWT validation parameters across services. 2026-03-04 13:08:08 +07:00
Ho Ngoc Hai
710f87a94d chore(docker): replace BFF direct DB vars with microservice HTTP proxy URLs
- Remove BFF_DB_HOST/PORT/USER/PASS env vars (no more direct DB access)
- Add 9 {ServiceName}__BaseUrl env vars for HTTP proxy pattern
- BFF now communicates via internal Docker network to microservices
2026-03-04 10:13:42 +07:00
Ho Ngoc Hai
12be9737d9 feat(web-client-tpos): replace hardcoded store pages with real API data
- Rewrite StoreList.razor with real data from PosDataService
- Rewrite StoreDetail.razor with real shop data from BFF
- Rewrite StoreSettings.razor with editable form bound to real data
- Add GetShopByIdAsync to PosDataService and BFF endpoint
- Add UpdateShopAsync to MerchantApiService
- Add ShopUpdateDto to MerchantDtos
- Fix BFF DB connection: configurable via env vars (BFF_DB_HOST)
- Add BFF_DB env vars to docker-compose.yml
2026-02-28 04:23:11 +07:00
Ho Ngoc Hai
a1e27aca46 refactor(web-client-tpos): dashboard data-driven, 2-level sidebar, fix YARP 502 in Docker 2026-02-28 03:51:51 +07:00
Ho Ngoc Hai
f521cc0a91 chore: Remove the web-client application, add a local database initialization script, and update service Dockerfiles. 2026-02-28 00:41:17 +07:00
Cursor Agent
547902b407 chore: remove hardcoded local deployment secrets
Co-authored-by: Velik <hongochai10@users.noreply.github.com>
2026-02-23 12:11:58 +00:00
Ho Ngoc Hai
23c8514ca4 feat: Introduce ads-tracking-service-net with Docker Compose setup, admin API documentation, and a migration script, adjusting existing service ports. 2026-01-18 02:02:27 +07:00
Ho Ngoc Hai
73086b2186 feat: add Ads Billing Service to docker-compose and implement Admin Campaigns Controller in Ads Manager Service. 2026-01-18 01:42:43 +07:00
Ho Ngoc Hai
48c757282a feat: introduce comprehensive billing, analytics, manager, and tracking features with new controllers, commands, queries, DTOs, and infrastructure configurations. 2026-01-18 01:26:29 +07:00
Ho Ngoc Hai
b1931be440 feat: Implement initial entity configurations for ads billing, analytics, and serving, add catalog product and category commands/queries, and refine booking service infrastructure. 2026-01-18 01:15:51 +07:00
Ho Ngoc Hai
811ddd1e19 feat: Add functional tests for OrderService and update InventoryService command and idempotency logic. 2026-01-18 00:19:46 +07:00
Ho Ngoc Hai
803f510d07 feat: Add initial PromotionService solution structure including domain, API, and test projects. 2026-01-17 21:28:29 +07:00
Ho Ngoc Hai
35dac2e49e feat: Initialize MissionService database schema, add MiningService unit tests, and update deployment configurations. 2026-01-17 20:49:24 +07:00
Ho Ngoc Hai
07367b192e feat: Add Mission Service documentation and update Mining Service deployment, port, and database connection. 2026-01-17 17:55:18 +07:00
Ho Ngoc Hai
72601557e6 feat: Thêm các unit test cho các thành phần của ChatService như AIService, ChatHubClient và các sự kiện domain. 2026-01-16 00:37:45 +07:00
Ho Ngoc Hai
52432b4a9e feat: Khởi tạo ứng dụng MAUI thử nghiệm cho macOS Catalyst. 2026-01-15 23:51:03 +07:00
Ho Ngoc Hai
bcadf2b8e4 feat: Bổ sung các chức năng quản trị viên để quản lý ví và tài khoản điểm, bao gồm các lệnh điều chỉnh và truy vấn. 2026-01-15 22:17:55 +07:00
Ho Ngoc Hai
85bd4d6f58 feat: Thêm các controller và query quản trị cho Storage Service, cải tiến quản lý cấp độ thành viên với các bài kiểm tra mới, và cập nhật các controller cùng chính sách ủy quyền 2026-01-15 19:23:31 +07:00
Ho Ngoc Hai
2fef02d04a feat: Thêm các unit test cho iam-service-net, cập nhật Dockerfile của merchant-service-net để tăng cường bảo mật và cải thiện quy trình build, đồng thời sửa đổi các unit test hiện có trong storage-service-net. 2026-01-15 18:58:04 +07:00
Ho Ngoc Hai
580e074145 feat: Thêm dịch vụ MerchantService mới và cập nhật các tệp điều khiển thành viên trong MembershipService. 2026-01-15 18:14:13 +07:00
Ho Ngoc Hai
3756fe6e35 feat(membership): Introduce Membership Service with IAM integration
- Added the Membership Service configuration to the local docker-compose.yml, replacing the previous Social Service setup.
- Implemented IAM Service client with caching and health check capabilities in the Membership Service.
- Created Dependency Injection for IAM Service settings and registered the HttpClient for communication.
- Removed the outdated docker-compose.yml for the previous Social Service.
- Enhanced IAM Service client functionality to validate users, retrieve roles, and manage permissions.
2026-01-13 23:40:59 +07:00
Ho Ngoc Hai
5363d9ca5e feat(identity): Configure fixed issuer URI for IdentityServer
- Added a fixed issuer URI for inter-service communication in the docker-compose.yml and appsettings.json.
- Updated DependencyInjection to utilize the new issuer URI, ensuring consistency across hosts and containers.
2026-01-13 20:05:50 +07:00
Ho Ngoc Hai
ca18df6a2c feat(docker): Add Storage Service configuration to docker-compose
- Introduced the Storage Service .NET configuration in the local docker-compose.yml, enabling file storage management with external MinIO and Redis integration.
- Updated environment variables for database connection, storage provider, and IAM service communication.
- Configured health checks and Traefik routing for the new service.
2026-01-13 19:53:59 +07:00
Ho Ngoc Hai
e07a294f2d chore(docker): Update IAM service base URL in docker-compose and IamServiceClient
- Changed the IAM service base URL from "http://iam-service:5001" to "http://iam-service-net:8080" in both the local docker-compose.yml and the IamServiceClient class to ensure consistency across configurations.
2026-01-13 19:51:59 +07:00
Ho Ngoc Hai
312bf360ea chore(docker): Migrate IAM service configuration to main docker-compose file
- Added IAM service configuration to the local docker-compose.yml for streamlined deployment.
- Removed the separate docker-compose.yml file from the IAM service directory to consolidate service definitions.
2026-01-13 19:26:56 +07:00
Ho Ngoc Hai
77898d6e27 feat(deployments): Extend IAM service routing in Docker Compose for role management
- Updated `docker-compose.yml` to include a new path prefix for roles in the IAM service routing configuration, enhancing API endpoint coverage for role management.
2026-01-13 01:11:47 +07:00
Ho Ngoc Hai
56143ae669 feat(deployments): Revise local environment configuration and Docker Compose for improved service integration
- Updated `.env` file to enhance shared environment variables, including detailed comments in both English and Vietnamese.
- Modified `docker-compose.yml` to disable the storage service and MinIO configuration, streamlining local development setup.
- Adjusted IAM service environment variables to align with the new `.env` structure, ensuring consistent configuration across services.
- Enhanced observability settings and added feature flags for better control over application behavior during development.
- Cleaned up commented-out sections in the Docker Compose file for clarity and maintainability.
2026-01-13 01:08:47 +07:00
Ho Ngoc Hai
71a5d8d4ed feat(deployments): Update local environment configuration for IAM service and Redis integration
- Modified local `.env` and `.env.local` files to include external Redis configuration and IAM service database connection details.
- Updated `docker-compose.yml` to disable local Redis service in favor of an external Redis instance.
- Added JWT configuration parameters for the IAM service, enhancing security and token management.
- Revised example environment file to reflect new configuration options for external services.
- Enhanced documentation to clarify setup instructions for local development with external dependencies.
2026-01-13 01:03:33 +07:00
Ho Ngoc Hai
4a1a0ef79c feat(storage-service): Add Social Service to Docker Compose and enhance IAM service integration
- Introduced a new social-service in the Docker Compose configuration for local development, including build context, environment variables, and health checks.
- Updated architecture documentation to reflect the new storage service structure and its components, including user storage quotas and file management.
- Enhanced README files to provide clearer instructions on service setup, configuration, and API endpoints for file storage management.
- Implemented caching mechanisms in the IAM service client for improved performance and reduced latency in user information retrieval.
- Updated appsettings for development to include caching settings for IAM service interactions.
2026-01-13 00:28:41 +07:00
Ho Ngoc Hai
928a22fe3e feat(authentication): Implement email verification, two-factor authentication, and social login features
- Added endpoints for sending and confirming email verification, enhancing user account security.
- Integrated two-factor authentication (2FA) with TOTP support, including enabling, verifying, and disabling 2FA.
- Implemented social login functionality for Google and Facebook, allowing users to authenticate using their existing accounts.
- Updated dependency injection to include services for email, 2FA, and social login.
- Enhanced documentation to reflect new features and usage examples for email verification and 2FA.
2026-01-12 23:07:53 +07:00
Ho Ngoc Hai
96dc13c38a fix: Cấu hình thủ công Traefik và cập nhật phiên bản để khắc phục sự cố Docker provider cục bộ. 2026-01-04 14:52:30 +07:00
Ho Ngoc Hai
a383d8772e feat: Cấu hình lại ứng dụng IAM, cập nhật cấu trúc routes, tích hợp RBAC và thêm các bài kiểm tra tích hợp. 2026-01-04 14:27:41 +07:00
Ho Ngoc Hai
15a77a661b chore: Điều chỉnh đường dẫn script triển khai cục bộ và cập nhật chính sách kéo ảnh IAM service thành IfNotPresent. 2026-01-04 13:05:04 +07:00
Ho Ngoc Hai
300b79ead8 feat: Thêm cấu hình và script triển khai Kubernetes cục bộ cho dịch vụ IAM. 2026-01-04 12:37:59 +07:00
Ho Ngoc Hai
202b99873a feat: Thêm cấu hình môi trường cục bộ và hoàn thành các tác vụ tăng cường bảo mật cho IAM service, bao gồm tạo dịch vụ mã hóa. 2026-01-04 12:09:46 +07:00
Ho Ngoc Hai
7154c37a31 feat: Cải thiện dịch vụ mã hóa AES-256-GCM và tích hợp khóa mã hóa vào cấu hình môi trường để bảo vệ dữ liệu nhạy cảm. 2026-01-04 10:48:08 +07:00