Refactor auth-service to iam-service and update related documentation

- Renamed auth-service to iam-service across various files for consistency.
- Updated Dockerfiles, deployment configurations, and documentation to reflect the service name change.
- Enhanced testing commands in documentation to point to the new iam-service.
- Removed outdated auth-service files and configurations to streamline the project structure.
- Improved bilingual documentation for clarity on the new service structure and usage.
This commit is contained in:
Ho Ngoc Hai
2025-12-30 20:54:21 +07:00
parent 7a4bda8da7
commit b104fafa85
246 changed files with 35630 additions and 2867 deletions

View File

@@ -15,7 +15,8 @@ version: '3.8'
#
# Access Points:
# - Traefik Dashboard: http://localhost:8080
# - Auth Service: http://localhost/api/v1/auth
# - IAM Service: http://localhost/api/v1/auth (backward compatible)
# - IAM Service: http://localhost/api/v1/identity, /api/v1/access, /api/v1/governance
# - Web Admin: http://admin.localhost
# - Web Client: http://localhost
#
@@ -77,18 +78,18 @@ services:
# BACKEND SERVICES
# ===========================================================================
# Auth Service - Authentication and Authorization
auth-service:
# IAM Service - Identity and Access Management
iam-service:
build:
context: ../..
dockerfile: services/auth-service/Dockerfile
container_name: auth-service-local
dockerfile: services/iam-service/Dockerfile
container_name: iam-service-local
env_file:
- .env.local
environment:
# Service-specific
- PORT=5001
- SERVICE_NAME=auth-service
- SERVICE_NAME=iam-service
- API_VERSION=${API_VERSION:-v1}
# Shared from .env.local (explicit for clarity)
@@ -123,11 +124,11 @@ services:
labels:
# Traefik service discovery
- "traefik.enable=true"
- "traefik.http.routers.auth-service.rule=PathPrefix(`/api/v1/auth`) || PathPrefix(`/api/v1/users`)"
- "traefik.http.routers.auth-service.entrypoints=web"
- "traefik.http.services.auth-service.loadbalancer.server.port=5001"
- "traefik.http.services.auth-service.loadbalancer.healthcheck.path=/health/live"
- "traefik.http.services.auth-service.loadbalancer.healthcheck.interval=10s"
- "traefik.http.routers.iam-service.rule=PathPrefix(`/api/v1/auth`) || PathPrefix(`/api/v1/users`) || PathPrefix(`/api/v1/identity`) || PathPrefix(`/api/v1/access`) || PathPrefix(`/api/v1/governance`) || PathPrefix(`/api/v1/rbac`) || PathPrefix(`/api/v1/mfa`) || PathPrefix(`/api/v1/sessions`)"
- "traefik.http.routers.iam-service.entrypoints=web"
- "traefik.http.services.iam-service.loadbalancer.server.port=5001"
- "traefik.http.services.iam-service.loadbalancer.healthcheck.path=/health/live"
- "traefik.http.services.iam-service.loadbalancer.healthcheck.interval=10s"
# ===========================================================================
# FRONTEND APPLICATIONS (Temporarily disabled)
@@ -146,7 +147,7 @@ services:
# ports:
# - "3000:3000"
# depends_on:
# - auth-service
# - iam-service
# - traefik
# networks:
# - microservices-network
@@ -170,7 +171,7 @@ services:
# ports:
# - "3001:3000"
# depends_on:
# - auth-service
# - iam-service
# - traefik
# networks:
# - microservices-network

View File

@@ -1,7 +1,7 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: auth-service-config
name: iam-service-config
namespace: production
data:
NODE_ENV: "production"
@@ -9,7 +9,7 @@ data:
API_VERSION: "v1"
CORS_ORIGIN: "https://goodgo.vn"
LOG_LEVEL: "warn"
SERVICE_NAME: "auth-service"
SERVICE_NAME: "iam-service"
TRACING_ENABLED: "true"
# Note: DATABASE_URL is stored in secrets (auth-service-secrets)
# Note: DATABASE_URL is stored in secrets (iam-service-secrets)
# DATABASE_URL should point to Neon production branch

View File

@@ -1,29 +1,29 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: auth-service
name: iam-service
namespace: production
spec:
replicas: 3
selector:
matchLabels:
app: auth-service
app: iam-service
template:
metadata:
labels:
app: auth-service
app: iam-service
spec:
containers:
- name: auth-service
image: goodgo/auth-service:latest
- name: iam-service
image: goodgo/iam-service:latest
imagePullPolicy: Always
ports:
- containerPort: 5001
envFrom:
- configMapRef:
name: auth-service-config
name: iam-service-config
- secretRef:
name: auth-service-secrets
name: iam-service-secrets
resources:
requests:
memory: "512Mi"
@@ -52,11 +52,11 @@ spec:
apiVersion: v1
kind: Service
metadata:
name: auth-service
name: iam-service
namespace: production
spec:
selector:
app: auth-service
app: iam-service
ports:
- protocol: TCP
port: 5001
@@ -67,13 +67,13 @@ spec:
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: auth-service-hpa
name: iam-service-hpa
namespace: production
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: auth-service
name: iam-service
minReplicas: 3
maxReplicas: 10
metrics:

View File

@@ -20,13 +20,55 @@ spec:
pathType: Prefix
backend:
service:
name: auth-service
name: iam-service
port:
number: 5001
- path: /api/v1/users
pathType: Prefix
backend:
service:
name: auth-service
name: iam-service
port:
number: 5001
- path: /api/v1/identity
pathType: Prefix
backend:
service:
name: iam-service
port:
number: 5001
- path: /api/v1/access
pathType: Prefix
backend:
service:
name: iam-service
port:
number: 5001
- path: /api/v1/governance
pathType: Prefix
backend:
service:
name: iam-service
port:
number: 5001
- path: /api/v1/rbac
pathType: Prefix
backend:
service:
name: iam-service
port:
number: 5001
- path: /api/v1/mfa
pathType: Prefix
backend:
service:
name: iam-service
port:
number: 5001
- path: /api/v1/sessions
pathType: Prefix
backend:
service:
name: iam-service
port:
number: 5001

View File

@@ -1,7 +1,7 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: auth-service-config
name: iam-service-config
namespace: staging
data:
NODE_ENV: "staging"
@@ -9,6 +9,6 @@ data:
API_VERSION: "v1"
CORS_ORIGIN: "https://staging.goodgo.vn"
LOG_LEVEL: "info"
SERVICE_NAME: "auth-service"
# Note: DATABASE_URL is stored in secrets (auth-service-secrets)
SERVICE_NAME: "iam-service"
# Note: DATABASE_URL is stored in secrets (iam-service-secrets)
# DATABASE_URL should point to Neon staging branch

View File

@@ -1,21 +1,21 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: auth-service
name: iam-service
namespace: staging
spec:
replicas: 2
selector:
matchLabels:
app: auth-service
app: iam-service
template:
metadata:
labels:
app: auth-service
app: iam-service
spec:
containers:
- name: auth-service
image: goodgo/auth-service:latest
- name: iam-service
image: goodgo/iam-service:latest
ports:
- containerPort: 5001
env:
@@ -24,12 +24,12 @@ spec:
- name: DATABASE_URL
valueFrom:
secretKeyRef:
name: auth-service-secrets
name: iam-service-secrets
key: database-url
- name: JWT_SECRET
valueFrom:
secretKeyRef:
name: auth-service-secrets
name: iam-service-secrets
key: jwt-secret
- name: REDIS_HOST
value: "redis-service"
@@ -57,11 +57,11 @@ spec:
apiVersion: v1
kind: Service
metadata:
name: auth-service
name: iam-service
namespace: staging
spec:
selector:
app: auth-service
app: iam-service
ports:
- protocol: TCP
port: 5001

View File

@@ -15,13 +15,55 @@ spec:
pathType: Prefix
backend:
service:
name: auth-service
name: iam-service
port:
number: 5001
- path: /api/v1/users
pathType: Prefix
backend:
service:
name: auth-service
name: iam-service
port:
number: 5001
- path: /api/v1/identity
pathType: Prefix
backend:
service:
name: iam-service
port:
number: 5001
- path: /api/v1/access
pathType: Prefix
backend:
service:
name: iam-service
port:
number: 5001
- path: /api/v1/governance
pathType: Prefix
backend:
service:
name: iam-service
port:
number: 5001
- path: /api/v1/rbac
pathType: Prefix
backend:
service:
name: iam-service
port:
number: 5001
- path: /api/v1/mfa
pathType: Prefix
backend:
service:
name: iam-service
port:
number: 5001
- path: /api/v1/sessions
pathType: Prefix
backend:
service:
name: iam-service
port:
number: 5001