feat: Introduce ads-tracking-service-net with Docker Compose setup, admin API documentation, and a migration script, adjusting existing service ports.
This commit is contained in:
@@ -874,7 +874,7 @@ services:
|
||||
- Redis__Port=6379
|
||||
- Redis__Password=Velik@2026
|
||||
ports:
|
||||
- "5021:8080"
|
||||
- "5011:8080"
|
||||
depends_on:
|
||||
iam-service-net:
|
||||
condition: service_healthy
|
||||
@@ -925,7 +925,7 @@ services:
|
||||
- Redis__Port=6379
|
||||
- Redis__Password=Velik@2026
|
||||
ports:
|
||||
- "5011:8080"
|
||||
- "5015:8080"
|
||||
depends_on:
|
||||
iam-service-net:
|
||||
condition: service_healthy
|
||||
@@ -982,7 +982,7 @@ services:
|
||||
- RabbitMQ__Username=guest
|
||||
- RabbitMQ__Password=guest
|
||||
ports:
|
||||
- "5022:8080"
|
||||
- "5012:8080"
|
||||
depends_on:
|
||||
iam-service-net:
|
||||
condition: service_healthy
|
||||
@@ -1038,7 +1038,7 @@ services:
|
||||
- Jwt__Audience=goodgo-api
|
||||
- Jwt__RequireHttpsMetadata=false
|
||||
ports:
|
||||
- "5023:8080"
|
||||
- "5013:8080"
|
||||
depends_on:
|
||||
iam-service-net:
|
||||
condition: service_healthy
|
||||
@@ -1070,6 +1070,76 @@ services:
|
||||
- "traefik.http.routers.ads-billing-admin.entrypoints=web"
|
||||
- "traefik.http.routers.ads-billing-admin.service=ads-billing-service"
|
||||
|
||||
# Ads Tracking Service .NET - Pixel Tracking, Conversion Tracking & Attribution
|
||||
ads-tracking-service-net:
|
||||
build:
|
||||
context: ../../services/ads-tracking-service-net
|
||||
dockerfile: Dockerfile
|
||||
image: goodgo/ads-tracking-service-net:latest
|
||||
container_name: ads-tracking-service-net-local
|
||||
environment:
|
||||
- ASPNETCORE_ENVIRONMENT=Development
|
||||
- ASPNETCORE_URLS=http://+:8080
|
||||
# EN: Database - Neon PostgreSQL
|
||||
# VI: Cơ sở dữ liệu - Neon PostgreSQL
|
||||
- ConnectionStrings__DefaultConnection=Host=ep-holy-glitter-a4hongg7-pooler.us-east-1.aws.neon.tech;Port=5432;Database=ads_tracking_service;Username=neondb_owner;Password=npg_Ssfy6HKO0cXI;SSL Mode=Require
|
||||
# EN: IAM Service Communication
|
||||
# VI: Giao tiếp IAM Service
|
||||
- IamService__BaseUrl=http://iam-service-net:8080
|
||||
- IamService__ServiceName=ads-tracking-service
|
||||
# EN: JWT Configuration
|
||||
# VI: Cấu hình JWT
|
||||
- Jwt__Authority=http://iam-service-net:8080
|
||||
- Jwt__Audience=goodgo-api
|
||||
- Jwt__RequireHttpsMetadata=false
|
||||
# EN: Redis Cache (for high-volume event buffering)
|
||||
# VI: Cache Redis (cho buffering sự kiện lưu lượng cao)
|
||||
- Redis__Host=167.114.174.113
|
||||
- Redis__Port=6379
|
||||
- Redis__Password=Velik@2026
|
||||
# EN: RabbitMQ for event publishing
|
||||
# VI: RabbitMQ để publish sự kiện
|
||||
- RabbitMQ__Host=rabbitmq
|
||||
- RabbitMQ__Port=5672
|
||||
- RabbitMQ__Username=guest
|
||||
- RabbitMQ__Password=guest
|
||||
ports:
|
||||
- "5014:8080"
|
||||
depends_on:
|
||||
iam-service-net:
|
||||
condition: service_healthy
|
||||
traefik:
|
||||
condition: service_started
|
||||
networks:
|
||||
- microservices-network
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:8080/health/live"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 40s
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
# EN: Public API routes for pixel tracking (high traffic, no auth)
|
||||
# VI: Routes API công khai cho pixel tracking (lưu lượng cao, không auth)
|
||||
- "traefik.http.routers.ads-tracking-pixels.rule=PathPrefix(`/api/v1/pixels`)"
|
||||
- "traefik.http.routers.ads-tracking-pixels.entrypoints=web"
|
||||
- "traefik.http.services.ads-tracking-service.loadbalancer.server.port=8080"
|
||||
- "traefik.http.services.ads-tracking-service.loadbalancer.healthcheck.path=/health/live"
|
||||
- "traefik.http.services.ads-tracking-service.loadbalancer.healthcheck.interval=10s"
|
||||
# EN: Conversion tracking API routes
|
||||
# VI: Routes API cho conversion tracking
|
||||
- "traefik.http.routers.ads-tracking-conversions.rule=PathPrefix(`/api/v1/conversions`)"
|
||||
- "traefik.http.routers.ads-tracking-conversions.entrypoints=web"
|
||||
- "traefik.http.routers.ads-tracking-conversions.service=ads-tracking-service"
|
||||
# EN: Admin API routes for analytics and attribution
|
||||
# VI: Routes API Admin cho analytics và attribution
|
||||
- "traefik.http.routers.ads-tracking-admin.rule=PathPrefix(`/api/v1/admin/attribution`) || PathPrefix(`/api/v1/admin/tracking-stats`)"
|
||||
- "traefik.http.routers.ads-tracking-admin.entrypoints=web"
|
||||
- "traefik.http.routers.ads-tracking-admin.service=ads-tracking-service"
|
||||
|
||||
|
||||
# Jaeger - Distributed Tracing
|
||||
# jaeger:
|
||||
# image: jaegertracing/all-in-one:1.47
|
||||
|
||||
@@ -80,6 +80,33 @@ ads-tracking-service-net/
|
||||
| `GET` | `/api/v1/ads-tracking/conversions` | List conversions |
|
||||
| `GET` | `/api/v1/ads-tracking/conversions/{id}/attribution` | Attribution details |
|
||||
|
||||
## Admin Office APIs
|
||||
|
||||
### Admin Pixels Management
|
||||
|
||||
| Method | Endpoint | Description |
|
||||
|--------|----------|-------------|
|
||||
| `GET` | `/api/v1/admin/ads-tracking/pixels` | List all pixels (paginated) |
|
||||
| `GET` | `/api/v1/admin/ads-tracking/pixels/{id}/events` | Pixel event history |
|
||||
| `GET` | `/api/v1/admin/ads-tracking/pixels/{id}/stats` | Pixel statistics |
|
||||
| `PUT` | `/api/v1/admin/ads-tracking/pixels/{id}/activate` | Activate pixel |
|
||||
| `PUT` | `/api/v1/admin/ads-tracking/pixels/{id}/deactivate` | Deactivate pixel |
|
||||
|
||||
### Admin Conversions Analytics
|
||||
|
||||
| Method | Endpoint | Description |
|
||||
|--------|----------|-------------|
|
||||
| `GET` | `/api/v1/admin/ads-tracking/conversions` | List conversions (with filters) |
|
||||
| `GET` | `/api/v1/admin/ads-tracking/conversions/stats` | Conversion statistics |
|
||||
| `GET` | `/api/v1/admin/ads-tracking/conversions/{id}` | Conversion details |
|
||||
|
||||
### Admin Attribution Reports
|
||||
|
||||
| Method | Endpoint | Description |
|
||||
|--------|----------|-------------|
|
||||
| `GET` | `/api/v1/admin/ads-tracking/attribution/stats` | Attribution statistics by model |
|
||||
| `GET` | `/api/v1/admin/ads-tracking/attribution/campaigns/{id}` | Campaign attribution report |
|
||||
|
||||
## Integration
|
||||
|
||||
| Service | Integration |
|
||||
|
||||
11
services/ads-tracking-service-net/scripts/apply-migration.sh
Executable file
11
services/ads-tracking-service-net/scripts/apply-migration.sh
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
# Apply migration for ads-tracking-service-net
|
||||
|
||||
export ConnectionStrings__DefaultConnection="Host=ep-holy-glitter-a4hongg7-pooler.us-east-1.aws.neon.tech;Port=5432;Database=ads_tracking_service;Username=neondb_owner;Password=npg_Ssfy6HKO0cXI;SSL Mode=Require;Channel Binding=require"
|
||||
|
||||
cd "$(dirname "$0")/../src/AdsTrackingService.Infrastructure"
|
||||
|
||||
echo "Applying migration to ads_tracking_service database..."
|
||||
dotnet ef database update --startup-project ../AdsTrackingService.API --context AdsTrackingServiceContext
|
||||
|
||||
echo "Migration complete!"
|
||||
Reference in New Issue
Block a user