add brain
This commit is contained in:
@@ -0,0 +1,367 @@
|
||||
{
|
||||
"schema_version": "2.0",
|
||||
"database": "user_management_v2",
|
||||
"tables": {
|
||||
"users": {
|
||||
"columns": {
|
||||
"id": {
|
||||
"type": "bigint",
|
||||
"nullable": false,
|
||||
"primary_key": true,
|
||||
"auto_increment": true
|
||||
},
|
||||
"username": {
|
||||
"type": "varchar",
|
||||
"length": 50,
|
||||
"nullable": false,
|
||||
"unique": true
|
||||
},
|
||||
"email": {
|
||||
"type": "varchar",
|
||||
"length": 320,
|
||||
"nullable": false,
|
||||
"unique": true
|
||||
},
|
||||
"password_hash": {
|
||||
"type": "varchar",
|
||||
"length": 255,
|
||||
"nullable": false
|
||||
},
|
||||
"first_name": {
|
||||
"type": "varchar",
|
||||
"length": 100,
|
||||
"nullable": true
|
||||
},
|
||||
"last_name": {
|
||||
"type": "varchar",
|
||||
"length": 100,
|
||||
"nullable": true
|
||||
},
|
||||
"created_at": {
|
||||
"type": "timestamp",
|
||||
"nullable": false,
|
||||
"default": "CURRENT_TIMESTAMP"
|
||||
},
|
||||
"updated_at": {
|
||||
"type": "timestamp",
|
||||
"nullable": false,
|
||||
"default": "CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"
|
||||
},
|
||||
"is_active": {
|
||||
"type": "boolean",
|
||||
"nullable": false,
|
||||
"default": true
|
||||
},
|
||||
"phone": {
|
||||
"type": "varchar",
|
||||
"length": 20,
|
||||
"nullable": true
|
||||
},
|
||||
"email_verified_at": {
|
||||
"type": "timestamp",
|
||||
"nullable": true,
|
||||
"comment": "When email was verified"
|
||||
},
|
||||
"phone_verified_at": {
|
||||
"type": "timestamp",
|
||||
"nullable": true,
|
||||
"comment": "When phone was verified"
|
||||
},
|
||||
"two_factor_enabled": {
|
||||
"type": "boolean",
|
||||
"nullable": false,
|
||||
"default": false
|
||||
},
|
||||
"last_login_at": {
|
||||
"type": "timestamp",
|
||||
"nullable": true
|
||||
}
|
||||
},
|
||||
"constraints": {
|
||||
"primary_key": ["id"],
|
||||
"unique": [
|
||||
"username",
|
||||
"email"
|
||||
],
|
||||
"foreign_key": [],
|
||||
"check": [
|
||||
"email LIKE '%@%'",
|
||||
"LENGTH(password_hash) >= 60",
|
||||
"phone IS NULL OR LENGTH(phone) >= 10"
|
||||
]
|
||||
},
|
||||
"indexes": [
|
||||
{
|
||||
"name": "idx_users_email",
|
||||
"columns": ["email"],
|
||||
"unique": true
|
||||
},
|
||||
{
|
||||
"name": "idx_users_username",
|
||||
"columns": ["username"],
|
||||
"unique": true
|
||||
},
|
||||
{
|
||||
"name": "idx_users_created_at",
|
||||
"columns": ["created_at"]
|
||||
},
|
||||
{
|
||||
"name": "idx_users_email_verified",
|
||||
"columns": ["email_verified_at"]
|
||||
},
|
||||
{
|
||||
"name": "idx_users_last_login",
|
||||
"columns": ["last_login_at"]
|
||||
}
|
||||
]
|
||||
},
|
||||
"user_profiles": {
|
||||
"columns": {
|
||||
"id": {
|
||||
"type": "bigint",
|
||||
"nullable": false,
|
||||
"primary_key": true,
|
||||
"auto_increment": true
|
||||
},
|
||||
"user_id": {
|
||||
"type": "bigint",
|
||||
"nullable": false
|
||||
},
|
||||
"bio": {
|
||||
"type": "text",
|
||||
"nullable": true
|
||||
},
|
||||
"avatar_url": {
|
||||
"type": "varchar",
|
||||
"length": 500,
|
||||
"nullable": true
|
||||
},
|
||||
"birth_date": {
|
||||
"type": "date",
|
||||
"nullable": true
|
||||
},
|
||||
"location": {
|
||||
"type": "varchar",
|
||||
"length": 100,
|
||||
"nullable": true
|
||||
},
|
||||
"website": {
|
||||
"type": "varchar",
|
||||
"length": 255,
|
||||
"nullable": true
|
||||
},
|
||||
"privacy_level": {
|
||||
"type": "varchar",
|
||||
"length": 20,
|
||||
"nullable": false,
|
||||
"default": "public"
|
||||
},
|
||||
"timezone": {
|
||||
"type": "varchar",
|
||||
"length": 50,
|
||||
"nullable": true,
|
||||
"default": "UTC"
|
||||
},
|
||||
"language": {
|
||||
"type": "varchar",
|
||||
"length": 10,
|
||||
"nullable": false,
|
||||
"default": "en"
|
||||
},
|
||||
"created_at": {
|
||||
"type": "timestamp",
|
||||
"nullable": false,
|
||||
"default": "CURRENT_TIMESTAMP"
|
||||
},
|
||||
"updated_at": {
|
||||
"type": "timestamp",
|
||||
"nullable": false,
|
||||
"default": "CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"
|
||||
}
|
||||
},
|
||||
"constraints": {
|
||||
"primary_key": ["id"],
|
||||
"unique": [],
|
||||
"foreign_key": [
|
||||
{
|
||||
"columns": ["user_id"],
|
||||
"references": "users(id)",
|
||||
"on_delete": "CASCADE"
|
||||
}
|
||||
],
|
||||
"check": [
|
||||
"privacy_level IN ('public', 'private', 'friends_only')",
|
||||
"bio IS NULL OR LENGTH(bio) <= 2000",
|
||||
"language IN ('en', 'es', 'fr', 'de', 'it', 'pt', 'ru', 'ja', 'ko', 'zh')"
|
||||
]
|
||||
},
|
||||
"indexes": [
|
||||
{
|
||||
"name": "idx_user_profiles_user_id",
|
||||
"columns": ["user_id"],
|
||||
"unique": true
|
||||
},
|
||||
{
|
||||
"name": "idx_user_profiles_privacy",
|
||||
"columns": ["privacy_level"]
|
||||
},
|
||||
{
|
||||
"name": "idx_user_profiles_language",
|
||||
"columns": ["language"]
|
||||
}
|
||||
]
|
||||
},
|
||||
"user_sessions": {
|
||||
"columns": {
|
||||
"id": {
|
||||
"type": "varchar",
|
||||
"length": 128,
|
||||
"nullable": false,
|
||||
"primary_key": true
|
||||
},
|
||||
"user_id": {
|
||||
"type": "bigint",
|
||||
"nullable": false
|
||||
},
|
||||
"ip_address": {
|
||||
"type": "varchar",
|
||||
"length": 45,
|
||||
"nullable": true
|
||||
},
|
||||
"user_agent": {
|
||||
"type": "text",
|
||||
"nullable": true
|
||||
},
|
||||
"expires_at": {
|
||||
"type": "timestamp",
|
||||
"nullable": false
|
||||
},
|
||||
"created_at": {
|
||||
"type": "timestamp",
|
||||
"nullable": false,
|
||||
"default": "CURRENT_TIMESTAMP"
|
||||
},
|
||||
"last_activity": {
|
||||
"type": "timestamp",
|
||||
"nullable": false,
|
||||
"default": "CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"
|
||||
},
|
||||
"session_type": {
|
||||
"type": "varchar",
|
||||
"length": 20,
|
||||
"nullable": false,
|
||||
"default": "web"
|
||||
},
|
||||
"is_mobile": {
|
||||
"type": "boolean",
|
||||
"nullable": false,
|
||||
"default": false
|
||||
}
|
||||
},
|
||||
"constraints": {
|
||||
"primary_key": ["id"],
|
||||
"unique": [],
|
||||
"foreign_key": [
|
||||
{
|
||||
"columns": ["user_id"],
|
||||
"references": "users(id)",
|
||||
"on_delete": "CASCADE"
|
||||
}
|
||||
],
|
||||
"check": [
|
||||
"session_type IN ('web', 'mobile', 'api', 'admin')"
|
||||
]
|
||||
},
|
||||
"indexes": [
|
||||
{
|
||||
"name": "idx_user_sessions_user_id",
|
||||
"columns": ["user_id"]
|
||||
},
|
||||
{
|
||||
"name": "idx_user_sessions_expires",
|
||||
"columns": ["expires_at"]
|
||||
},
|
||||
{
|
||||
"name": "idx_user_sessions_type",
|
||||
"columns": ["session_type"]
|
||||
}
|
||||
]
|
||||
},
|
||||
"user_preferences": {
|
||||
"columns": {
|
||||
"id": {
|
||||
"type": "bigint",
|
||||
"nullable": false,
|
||||
"primary_key": true,
|
||||
"auto_increment": true
|
||||
},
|
||||
"user_id": {
|
||||
"type": "bigint",
|
||||
"nullable": false
|
||||
},
|
||||
"preference_key": {
|
||||
"type": "varchar",
|
||||
"length": 100,
|
||||
"nullable": false
|
||||
},
|
||||
"preference_value": {
|
||||
"type": "json",
|
||||
"nullable": true
|
||||
},
|
||||
"created_at": {
|
||||
"type": "timestamp",
|
||||
"nullable": false,
|
||||
"default": "CURRENT_TIMESTAMP"
|
||||
},
|
||||
"updated_at": {
|
||||
"type": "timestamp",
|
||||
"nullable": false,
|
||||
"default": "CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"
|
||||
}
|
||||
},
|
||||
"constraints": {
|
||||
"primary_key": ["id"],
|
||||
"unique": [
|
||||
["user_id", "preference_key"]
|
||||
],
|
||||
"foreign_key": [
|
||||
{
|
||||
"columns": ["user_id"],
|
||||
"references": "users(id)",
|
||||
"on_delete": "CASCADE"
|
||||
}
|
||||
],
|
||||
"check": []
|
||||
},
|
||||
"indexes": [
|
||||
{
|
||||
"name": "idx_user_preferences_user_key",
|
||||
"columns": ["user_id", "preference_key"],
|
||||
"unique": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"views": {
|
||||
"active_users": {
|
||||
"definition": "SELECT u.id, u.username, u.email, u.first_name, u.last_name, u.email_verified_at, u.last_login_at FROM users u WHERE u.is_active = true",
|
||||
"columns": ["id", "username", "email", "first_name", "last_name", "email_verified_at", "last_login_at"]
|
||||
},
|
||||
"verified_users": {
|
||||
"definition": "SELECT u.id, u.username, u.email FROM users u WHERE u.is_active = true AND u.email_verified_at IS NOT NULL",
|
||||
"columns": ["id", "username", "email"]
|
||||
}
|
||||
},
|
||||
"procedures": [
|
||||
{
|
||||
"name": "cleanup_expired_sessions",
|
||||
"parameters": [],
|
||||
"definition": "DELETE FROM user_sessions WHERE expires_at < NOW()"
|
||||
},
|
||||
{
|
||||
"name": "get_user_with_profile",
|
||||
"parameters": ["user_id BIGINT"],
|
||||
"definition": "SELECT u.*, p.bio, p.avatar_url, p.privacy_level FROM users u LEFT JOIN user_profiles p ON u.id = p.user_id WHERE u.id = user_id"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,243 @@
|
||||
{
|
||||
"schema_version": "1.0",
|
||||
"database": "user_management",
|
||||
"tables": {
|
||||
"users": {
|
||||
"columns": {
|
||||
"id": {
|
||||
"type": "bigint",
|
||||
"nullable": false,
|
||||
"primary_key": true,
|
||||
"auto_increment": true
|
||||
},
|
||||
"username": {
|
||||
"type": "varchar",
|
||||
"length": 50,
|
||||
"nullable": false,
|
||||
"unique": true
|
||||
},
|
||||
"email": {
|
||||
"type": "varchar",
|
||||
"length": 255,
|
||||
"nullable": false,
|
||||
"unique": true
|
||||
},
|
||||
"password_hash": {
|
||||
"type": "varchar",
|
||||
"length": 255,
|
||||
"nullable": false
|
||||
},
|
||||
"first_name": {
|
||||
"type": "varchar",
|
||||
"length": 100,
|
||||
"nullable": true
|
||||
},
|
||||
"last_name": {
|
||||
"type": "varchar",
|
||||
"length": 100,
|
||||
"nullable": true
|
||||
},
|
||||
"created_at": {
|
||||
"type": "timestamp",
|
||||
"nullable": false,
|
||||
"default": "CURRENT_TIMESTAMP"
|
||||
},
|
||||
"updated_at": {
|
||||
"type": "timestamp",
|
||||
"nullable": false,
|
||||
"default": "CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"
|
||||
},
|
||||
"is_active": {
|
||||
"type": "boolean",
|
||||
"nullable": false,
|
||||
"default": true
|
||||
},
|
||||
"phone": {
|
||||
"type": "varchar",
|
||||
"length": 20,
|
||||
"nullable": true
|
||||
}
|
||||
},
|
||||
"constraints": {
|
||||
"primary_key": ["id"],
|
||||
"unique": [
|
||||
"username",
|
||||
"email"
|
||||
],
|
||||
"foreign_key": [],
|
||||
"check": [
|
||||
"email LIKE '%@%'",
|
||||
"LENGTH(password_hash) >= 60"
|
||||
]
|
||||
},
|
||||
"indexes": [
|
||||
{
|
||||
"name": "idx_users_email",
|
||||
"columns": ["email"],
|
||||
"unique": true
|
||||
},
|
||||
{
|
||||
"name": "idx_users_username",
|
||||
"columns": ["username"],
|
||||
"unique": true
|
||||
},
|
||||
{
|
||||
"name": "idx_users_created_at",
|
||||
"columns": ["created_at"]
|
||||
}
|
||||
]
|
||||
},
|
||||
"user_profiles": {
|
||||
"columns": {
|
||||
"id": {
|
||||
"type": "bigint",
|
||||
"nullable": false,
|
||||
"primary_key": true,
|
||||
"auto_increment": true
|
||||
},
|
||||
"user_id": {
|
||||
"type": "bigint",
|
||||
"nullable": false
|
||||
},
|
||||
"bio": {
|
||||
"type": "varchar",
|
||||
"length": 255,
|
||||
"nullable": true
|
||||
},
|
||||
"avatar_url": {
|
||||
"type": "varchar",
|
||||
"length": 500,
|
||||
"nullable": true
|
||||
},
|
||||
"birth_date": {
|
||||
"type": "date",
|
||||
"nullable": true
|
||||
},
|
||||
"location": {
|
||||
"type": "varchar",
|
||||
"length": 100,
|
||||
"nullable": true
|
||||
},
|
||||
"website": {
|
||||
"type": "varchar",
|
||||
"length": 255,
|
||||
"nullable": true
|
||||
},
|
||||
"privacy_level": {
|
||||
"type": "varchar",
|
||||
"length": 20,
|
||||
"nullable": false,
|
||||
"default": "public"
|
||||
},
|
||||
"created_at": {
|
||||
"type": "timestamp",
|
||||
"nullable": false,
|
||||
"default": "CURRENT_TIMESTAMP"
|
||||
},
|
||||
"updated_at": {
|
||||
"type": "timestamp",
|
||||
"nullable": false,
|
||||
"default": "CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"
|
||||
}
|
||||
},
|
||||
"constraints": {
|
||||
"primary_key": ["id"],
|
||||
"unique": [],
|
||||
"foreign_key": [
|
||||
{
|
||||
"columns": ["user_id"],
|
||||
"references": "users(id)",
|
||||
"on_delete": "CASCADE"
|
||||
}
|
||||
],
|
||||
"check": [
|
||||
"privacy_level IN ('public', 'private', 'friends_only')"
|
||||
]
|
||||
},
|
||||
"indexes": [
|
||||
{
|
||||
"name": "idx_user_profiles_user_id",
|
||||
"columns": ["user_id"],
|
||||
"unique": true
|
||||
},
|
||||
{
|
||||
"name": "idx_user_profiles_privacy",
|
||||
"columns": ["privacy_level"]
|
||||
}
|
||||
]
|
||||
},
|
||||
"user_sessions": {
|
||||
"columns": {
|
||||
"id": {
|
||||
"type": "varchar",
|
||||
"length": 128,
|
||||
"nullable": false,
|
||||
"primary_key": true
|
||||
},
|
||||
"user_id": {
|
||||
"type": "bigint",
|
||||
"nullable": false
|
||||
},
|
||||
"ip_address": {
|
||||
"type": "varchar",
|
||||
"length": 45,
|
||||
"nullable": true
|
||||
},
|
||||
"user_agent": {
|
||||
"type": "varchar",
|
||||
"length": 500,
|
||||
"nullable": true
|
||||
},
|
||||
"expires_at": {
|
||||
"type": "timestamp",
|
||||
"nullable": false
|
||||
},
|
||||
"created_at": {
|
||||
"type": "timestamp",
|
||||
"nullable": false,
|
||||
"default": "CURRENT_TIMESTAMP"
|
||||
},
|
||||
"last_activity": {
|
||||
"type": "timestamp",
|
||||
"nullable": false,
|
||||
"default": "CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"
|
||||
}
|
||||
},
|
||||
"constraints": {
|
||||
"primary_key": ["id"],
|
||||
"unique": [],
|
||||
"foreign_key": [
|
||||
{
|
||||
"columns": ["user_id"],
|
||||
"references": "users(id)",
|
||||
"on_delete": "CASCADE"
|
||||
}
|
||||
],
|
||||
"check": []
|
||||
},
|
||||
"indexes": [
|
||||
{
|
||||
"name": "idx_user_sessions_user_id",
|
||||
"columns": ["user_id"]
|
||||
},
|
||||
{
|
||||
"name": "idx_user_sessions_expires",
|
||||
"columns": ["expires_at"]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"views": {
|
||||
"active_users": {
|
||||
"definition": "SELECT u.id, u.username, u.email, u.first_name, u.last_name FROM users u WHERE u.is_active = true",
|
||||
"columns": ["id", "username", "email", "first_name", "last_name"]
|
||||
}
|
||||
},
|
||||
"procedures": [
|
||||
{
|
||||
"name": "cleanup_expired_sessions",
|
||||
"parameters": [],
|
||||
"definition": "DELETE FROM user_sessions WHERE expires_at < NOW()"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
{
|
||||
"type": "database",
|
||||
"pattern": "schema_change",
|
||||
"source": "PostgreSQL 13 Production Database",
|
||||
"target": "PostgreSQL 15 Cloud Database",
|
||||
"description": "Migrate user management system from on-premises PostgreSQL to cloud with schema updates",
|
||||
"constraints": {
|
||||
"max_downtime_minutes": 30,
|
||||
"data_volume_gb": 2500,
|
||||
"dependencies": [
|
||||
"user_service_api",
|
||||
"authentication_service",
|
||||
"notification_service",
|
||||
"analytics_pipeline",
|
||||
"backup_service"
|
||||
],
|
||||
"compliance_requirements": [
|
||||
"GDPR",
|
||||
"SOX"
|
||||
],
|
||||
"special_requirements": [
|
||||
"zero_data_loss",
|
||||
"referential_integrity",
|
||||
"performance_baseline_maintained"
|
||||
]
|
||||
},
|
||||
"tables_to_migrate": [
|
||||
{
|
||||
"name": "users",
|
||||
"row_count": 1500000,
|
||||
"size_mb": 450,
|
||||
"critical": true
|
||||
},
|
||||
{
|
||||
"name": "user_profiles",
|
||||
"row_count": 1500000,
|
||||
"size_mb": 890,
|
||||
"critical": true
|
||||
},
|
||||
{
|
||||
"name": "user_sessions",
|
||||
"row_count": 25000000,
|
||||
"size_mb": 1200,
|
||||
"critical": false
|
||||
},
|
||||
{
|
||||
"name": "audit_logs",
|
||||
"row_count": 50000000,
|
||||
"size_mb": 2800,
|
||||
"critical": false
|
||||
}
|
||||
],
|
||||
"schema_changes": [
|
||||
{
|
||||
"table": "users",
|
||||
"changes": [
|
||||
{
|
||||
"type": "add_column",
|
||||
"column": "email_verified_at",
|
||||
"data_type": "timestamp",
|
||||
"nullable": true
|
||||
},
|
||||
{
|
||||
"type": "add_column",
|
||||
"column": "phone_verified_at",
|
||||
"data_type": "timestamp",
|
||||
"nullable": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"table": "user_profiles",
|
||||
"changes": [
|
||||
{
|
||||
"type": "modify_column",
|
||||
"column": "bio",
|
||||
"old_type": "varchar(255)",
|
||||
"new_type": "text"
|
||||
},
|
||||
{
|
||||
"type": "add_constraint",
|
||||
"constraint_type": "check",
|
||||
"constraint_name": "bio_length_check",
|
||||
"definition": "LENGTH(bio) <= 2000"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"performance_requirements": {
|
||||
"max_query_response_time_ms": 100,
|
||||
"concurrent_connections": 500,
|
||||
"transactions_per_second": 1000
|
||||
},
|
||||
"business_continuity": {
|
||||
"critical_business_hours": {
|
||||
"start": "08:00",
|
||||
"end": "18:00",
|
||||
"timezone": "UTC"
|
||||
},
|
||||
"preferred_migration_window": {
|
||||
"start": "02:00",
|
||||
"end": "06:00",
|
||||
"timezone": "UTC"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,175 @@
|
||||
{
|
||||
"type": "service",
|
||||
"pattern": "strangler_fig",
|
||||
"source": "Legacy User Service (Java Spring Boot 2.x)",
|
||||
"target": "New User Service (Node.js + TypeScript)",
|
||||
"description": "Migrate legacy user management service to modern microservices architecture",
|
||||
"constraints": {
|
||||
"max_downtime_minutes": 0,
|
||||
"data_volume_gb": 50,
|
||||
"dependencies": [
|
||||
"payment_service",
|
||||
"order_service",
|
||||
"notification_service",
|
||||
"analytics_service",
|
||||
"mobile_app_v1",
|
||||
"mobile_app_v2",
|
||||
"web_frontend",
|
||||
"admin_dashboard"
|
||||
],
|
||||
"compliance_requirements": [
|
||||
"PCI_DSS",
|
||||
"GDPR"
|
||||
],
|
||||
"special_requirements": [
|
||||
"api_backward_compatibility",
|
||||
"session_continuity",
|
||||
"rate_limit_preservation"
|
||||
]
|
||||
},
|
||||
"service_details": {
|
||||
"legacy_service": {
|
||||
"endpoints": [
|
||||
"GET /api/v1/users/{id}",
|
||||
"POST /api/v1/users",
|
||||
"PUT /api/v1/users/{id}",
|
||||
"DELETE /api/v1/users/{id}",
|
||||
"GET /api/v1/users/{id}/profile",
|
||||
"PUT /api/v1/users/{id}/profile",
|
||||
"POST /api/v1/users/{id}/verify-email",
|
||||
"POST /api/v1/users/login",
|
||||
"POST /api/v1/users/logout"
|
||||
],
|
||||
"current_load": {
|
||||
"requests_per_second": 850,
|
||||
"peak_requests_per_second": 2000,
|
||||
"average_response_time_ms": 120,
|
||||
"p95_response_time_ms": 300
|
||||
},
|
||||
"infrastructure": {
|
||||
"instances": 4,
|
||||
"cpu_cores_per_instance": 4,
|
||||
"memory_gb_per_instance": 8,
|
||||
"load_balancer": "AWS ELB Classic"
|
||||
}
|
||||
},
|
||||
"new_service": {
|
||||
"endpoints": [
|
||||
"GET /api/v2/users/{id}",
|
||||
"POST /api/v2/users",
|
||||
"PUT /api/v2/users/{id}",
|
||||
"DELETE /api/v2/users/{id}",
|
||||
"GET /api/v2/users/{id}/profile",
|
||||
"PUT /api/v2/users/{id}/profile",
|
||||
"POST /api/v2/users/{id}/verify-email",
|
||||
"POST /api/v2/users/{id}/verify-phone",
|
||||
"POST /api/v2/auth/login",
|
||||
"POST /api/v2/auth/logout",
|
||||
"POST /api/v2/auth/refresh"
|
||||
],
|
||||
"target_performance": {
|
||||
"requests_per_second": 1500,
|
||||
"peak_requests_per_second": 3000,
|
||||
"average_response_time_ms": 80,
|
||||
"p95_response_time_ms": 200
|
||||
},
|
||||
"infrastructure": {
|
||||
"container_platform": "Kubernetes",
|
||||
"initial_replicas": 3,
|
||||
"max_replicas": 10,
|
||||
"cpu_request_millicores": 500,
|
||||
"cpu_limit_millicores": 1000,
|
||||
"memory_request_mb": 512,
|
||||
"memory_limit_mb": 1024,
|
||||
"load_balancer": "AWS ALB"
|
||||
}
|
||||
}
|
||||
},
|
||||
"migration_phases": [
|
||||
{
|
||||
"phase": "preparation",
|
||||
"description": "Deploy new service and configure routing",
|
||||
"estimated_duration_hours": 8
|
||||
},
|
||||
{
|
||||
"phase": "intercept",
|
||||
"description": "Configure API gateway to route to new service",
|
||||
"estimated_duration_hours": 2
|
||||
},
|
||||
{
|
||||
"phase": "gradual_migration",
|
||||
"description": "Gradually increase traffic to new service",
|
||||
"estimated_duration_hours": 48
|
||||
},
|
||||
{
|
||||
"phase": "validation",
|
||||
"description": "Validate new service performance and functionality",
|
||||
"estimated_duration_hours": 24
|
||||
},
|
||||
{
|
||||
"phase": "decommission",
|
||||
"description": "Remove legacy service after validation",
|
||||
"estimated_duration_hours": 4
|
||||
}
|
||||
],
|
||||
"feature_flags": [
|
||||
{
|
||||
"name": "enable_new_user_service",
|
||||
"description": "Route user service requests to new implementation",
|
||||
"initial_percentage": 5,
|
||||
"rollout_schedule": [
|
||||
{"percentage": 5, "duration_hours": 24},
|
||||
{"percentage": 25, "duration_hours": 24},
|
||||
{"percentage": 50, "duration_hours": 24},
|
||||
{"percentage": 100, "duration_hours": 0}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "enable_new_auth_endpoints",
|
||||
"description": "Enable new authentication endpoints",
|
||||
"initial_percentage": 0,
|
||||
"rollout_schedule": [
|
||||
{"percentage": 10, "duration_hours": 12},
|
||||
{"percentage": 50, "duration_hours": 12},
|
||||
{"percentage": 100, "duration_hours": 0}
|
||||
]
|
||||
}
|
||||
],
|
||||
"monitoring": {
|
||||
"critical_metrics": [
|
||||
"request_rate",
|
||||
"error_rate",
|
||||
"response_time_p95",
|
||||
"response_time_p99",
|
||||
"cpu_utilization",
|
||||
"memory_utilization",
|
||||
"database_connection_pool"
|
||||
],
|
||||
"alert_thresholds": {
|
||||
"error_rate": 0.05,
|
||||
"response_time_p95": 250,
|
||||
"cpu_utilization": 0.80,
|
||||
"memory_utilization": 0.85
|
||||
}
|
||||
},
|
||||
"rollback_triggers": [
|
||||
{
|
||||
"metric": "error_rate",
|
||||
"threshold": 0.10,
|
||||
"duration_minutes": 5,
|
||||
"action": "automatic_rollback"
|
||||
},
|
||||
{
|
||||
"metric": "response_time_p95",
|
||||
"threshold": 500,
|
||||
"duration_minutes": 10,
|
||||
"action": "alert_team"
|
||||
},
|
||||
{
|
||||
"metric": "cpu_utilization",
|
||||
"threshold": 0.95,
|
||||
"duration_minutes": 5,
|
||||
"action": "scale_up"
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user