docs: update MFE infra docs with api-gateway-mfe-dev deployment
Document completed Terraform provisioning of api-gateway-mfe-dev (IP 10.110.198.250), VCN peering requirements, LB routing plan, updated Variable Group info, and checklist status. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
72cfe3edf1
commit
8da89ddd25
5 changed files with 307 additions and 191 deletions
|
|
@ -49,17 +49,105 @@
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Frontends Estáticos (Buckets)
|
## Gateway 3: api-gateway-mfe-dev (Terraform-managed)
|
||||||
|
|
||||||
| Bucket | URL | Descrição |
|
| Propriedade | Valor |
|
||||||
|
|-------------|-------|
|
||||||
|
| Nome | api-gateway-mfe-dev |
|
||||||
|
| Tipo | PRIVATE |
|
||||||
|
| OCID | `ocid1.apigateway.oc1.sa-saopaulo-1.amaaaaaasks3yliabdiquogy2pqyohas4wjopizv2xzgzrclmsvsh4x7ewea` |
|
||||||
|
| Hostname | `guhal72tzyekzchzamhhi3lvgi.apigateway.sa-saopaulo-1.oci.customer-oci.com` |
|
||||||
|
| IP | 10.110.198.250 |
|
||||||
|
| VCN | vcn-oke (10.110.0.0/16) |
|
||||||
|
| Subnet | sbn-api-gateway (10.110.192.0/20) |
|
||||||
|
| Compartment | DEV (`ocid1.compartment.oc1..aaaaaaaa76x3nykkjwvctpr6px34dysu3pbg7p62h2r65fegt7fvbrioll3a`) |
|
||||||
|
| Estado | ACTIVE |
|
||||||
|
| Gerenciado por | Terraform (`tf_oci_clusters/modules/api_gateway_mfe`) |
|
||||||
|
| Criado em | 2026-02-22 (pipeline build #5964) |
|
||||||
|
|
||||||
|
### Deployments
|
||||||
|
|
||||||
|
| Nome | Path | Backend | Descrição |
|
||||||
|
|------|------|---------|-----------|
|
||||||
|
| deploy-mfe-user-dev | / | Object Storage `nexus-mfe-user-development` | SPA Angular - index.html |
|
||||||
|
| deploy-mfe-user-dev | /{path*} | Object Storage `nexus-mfe-user-development` | Arquivos estáticos (JS/CSS/assets) |
|
||||||
|
|
||||||
|
### Acesso
|
||||||
|
|
||||||
|
| Tipo | URL |
|
||||||
|
|------|-----|
|
||||||
|
| Direto (privado) | `https://guhal72tzyekzchzamhhi3lvgi.apigateway.sa-saopaulo-1.oci.customer-oci.com/` |
|
||||||
|
| Planejado (DNS) | `https://mfe-user-dev.invista.com.br` (pendente VCN peering + LB + Cloudflare) |
|
||||||
|
|
||||||
|
### Terraform
|
||||||
|
|
||||||
|
```hcl
|
||||||
|
# environments/dev/api_gateway_mfe.tf
|
||||||
|
module "api_gateway_mfe" {
|
||||||
|
source = "../../modules/api_gateway_mfe"
|
||||||
|
compartment_id = local.compartment_id
|
||||||
|
subnet_id = module.network.api_gateway_subnet_id
|
||||||
|
env_name = var.env_name
|
||||||
|
display_name = "api-gateway-mfe"
|
||||||
|
mfe_deployments = [{
|
||||||
|
name = "mfe-user"
|
||||||
|
bucket_name = "nexus-mfe-user-development"
|
||||||
|
region = "sa-saopaulo-1"
|
||||||
|
object_namespace = var.mfe_object_namespace # grbb7qzeuoag
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Pendencias
|
||||||
|
|
||||||
|
- [ ] VCN Peering: Attach dev VCN ao DRG-Invista-Shared
|
||||||
|
- [ ] Rota no LB Test_Crivo_Dev: backend set apontando para 10.110.198.250:443
|
||||||
|
- [ ] Routing policy: hostname `mfe-user-dev.invista.com.br`
|
||||||
|
- [ ] DNS Cloudflare: CNAME `mfe-user-dev` -> LB IP (via Cloudflare proxy)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Frontends Estaticos (Buckets)
|
||||||
|
|
||||||
|
| Bucket | URL | Descricao |
|
||||||
|--------|-----|-----------|
|
|--------|-----|-----------|
|
||||||
| app-front-insign-teste | Cloudflare + OCI | Site estático de teste |
|
| app-front-insign-teste | Cloudflare + OCI | Site estatico de teste |
|
||||||
| front | - | Ícones SVG |
|
| front | - | Icones SVG |
|
||||||
| nexus-mfe-shell-development | - | Shell MFE Angular |
|
| nexus-mfe-shell-development | - | Shell MFE Angular |
|
||||||
| nexus-mfe-auth-development | - | MFE Auth |
|
| nexus-mfe-auth-development | - | MFE Auth |
|
||||||
| nexus-mfe-user-development | - | MFE User |
|
| nexus-mfe-user-development | API Gateway MFE dev | MFE User (servido via api-gateway-mfe-dev) |
|
||||||
| nexus-mfe-person-development | - | MFE Person |
|
| nexus-mfe-person-development | - | MFE Person |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
*Atualizado em: 2026-02-21*
|
## Conectividade de Rede
|
||||||
|
|
||||||
|
### VCNs envolvidas
|
||||||
|
|
||||||
|
| VCN | CIDR | Componentes |
|
||||||
|
|-----|------|-------------|
|
||||||
|
| VCN-Shared | 10.8.0.0/16 | LB Test_Crivo_Dev (10.8.4.127) |
|
||||||
|
| vcn-oke (dev) | 10.110.0.0/16 | API Gateway MFE (10.110.198.250), OKE clusters |
|
||||||
|
|
||||||
|
### DRG (Dynamic Routing Gateway)
|
||||||
|
|
||||||
|
| Propriedade | Valor |
|
||||||
|
|-------------|-------|
|
||||||
|
| Nome | DRG-Invista-Shared |
|
||||||
|
| OCID | `ocid1.drg.oc1.sa-saopaulo-1.aaaaaaaazuiluiavm3zcrzelqs2f3k3sdy3fka5yytwjua37a2ksn446deza` |
|
||||||
|
| VCN-Shared | Attached |
|
||||||
|
| vcn-oke (dev) | **Pendente** - necessario para LB acessar API Gateway |
|
||||||
|
|
||||||
|
### Fluxo de rede planejado
|
||||||
|
|
||||||
|
```
|
||||||
|
Browser -> Cloudflare (mfe-user-dev.invista.com.br)
|
||||||
|
-> LB Test_Crivo_Dev (10.8.4.127, VCN-Shared)
|
||||||
|
-> DRG-Invista-Shared (VCN peering)
|
||||||
|
-> API Gateway MFE (10.110.198.250, vcn-oke)
|
||||||
|
-> Object Storage (nexus-mfe-user-development)
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
*Atualizado em: 2026-02-23*
|
||||||
|
|
|
||||||
|
|
@ -87,13 +87,31 @@ Total: **34 Load Balancers ativos**
|
||||||
| Certificado | `*.invista.com.br` (Cloudflare Origin CA) |
|
| Certificado | `*.invista.com.br` (Cloudflare Origin CA) |
|
||||||
| Protocolo | HTTPS (TLS 1.2/1.3) |
|
| Protocolo | HTTPS (TLS 1.2/1.3) |
|
||||||
|
|
||||||
**Domínios roteados:**
|
**Dominios roteados (routing policy `crivo_routes`):**
|
||||||
|
|
||||||
| Domínio | Backend |
|
| Dominio | Backend |
|
||||||
|---------|---------|
|
|---------|---------|
|
||||||
| crivo-dev.invista.com.br | 10.4.0.116:80 |
|
| crivo-dev.invista.com.br | 10.4.0.116:80 |
|
||||||
| crivo-dev-adm.invista.com.br | 10.4.0.116:84 |
|
| crivo-dev-adm.invista.com.br | 10.4.0.116:84 |
|
||||||
|
|
||||||
|
**Planejado (pendente VCN peering):**
|
||||||
|
|
||||||
|
| Dominio | Backend | Status |
|
||||||
|
|---------|---------|--------|
|
||||||
|
| mfe-user-dev.invista.com.br | 10.110.198.250:443 (api-gateway-mfe-dev) | Pendente DRG attachment |
|
||||||
|
|
||||||
|
### Requisito: VCN Peering
|
||||||
|
|
||||||
|
O LB `Test_Crivo_Dev` esta na VCN-Shared (10.8.0.0/16).
|
||||||
|
O API Gateway MFE esta na vcn-oke dev (10.110.0.0/16).
|
||||||
|
|
||||||
|
Para o LB acessar o API Gateway, e necessario:
|
||||||
|
1. Attach vcn-oke dev ao DRG `DRG-Invista-Shared`
|
||||||
|
2. Configurar route tables em ambas VCNs
|
||||||
|
3. Ajustar security lists
|
||||||
|
|
||||||
|
Ver detalhes em [API-GATEWAY.md](./API-GATEWAY.md#conectividade-de-rede).
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Comandos OCI CLI
|
## Comandos OCI CLI
|
||||||
|
|
@ -111,4 +129,4 @@ oci lb certificate list --load-balancer-id "<OCID>" --region sa-saopaulo-1
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
*Atualizado em: 2026-02-21*
|
*Atualizado em: 2026-02-23*
|
||||||
|
|
|
||||||
|
|
@ -97,48 +97,84 @@ routes:
|
||||||
url: "https://grbb7qzeuoag.objectstorage.sa-saopaulo-1.oci.customer-oci.com/n/grbb7qzeuoag/b/nexus-mfe-user-dev/o/${request.path[req]}"
|
url: "https://grbb7qzeuoag.objectstorage.sa-saopaulo-1.oci.customer-oci.com/n/grbb7qzeuoag/b/nexus-mfe-user-dev/o/${request.path[req]}"
|
||||||
```
|
```
|
||||||
|
|
||||||
## Configuração via Terraform
|
## Configuracao via Terraform (Implementado)
|
||||||
|
|
||||||
### Módulo API Gateway
|
O API Gateway MFE e provisionado via Terraform no repositorio `tf_oci_clusters`.
|
||||||
|
|
||||||
|
### Repositorio: `tf_oci_clusters`
|
||||||
|
|
||||||
|
```
|
||||||
|
tf_oci_clusters/
|
||||||
|
├── modules/
|
||||||
|
│ ├── api_gateway_mfe/ # Modulo API Gateway MFE
|
||||||
|
│ │ ├── main.tf # Gateway + Deployment (rotas SPA)
|
||||||
|
│ │ ├── variables.tf # Inputs
|
||||||
|
│ │ ├── outputs.tf # gateway_id, ip, hostname, endpoints
|
||||||
|
│ │ └── versions.tf # oracle/oci ~> 7.0
|
||||||
|
│ └── network/
|
||||||
|
│ └── main.tf # Subnet sbn-api-gateway (condicional)
|
||||||
|
├── environments/
|
||||||
|
│ └── dev/
|
||||||
|
│ ├── main.tf # enable_api_gateway_subnet
|
||||||
|
│ ├── api_gateway_mfe.tf # Integracao do modulo
|
||||||
|
│ └── terraform.ci.tfvars # enable_api_gateway_mfe = true
|
||||||
|
```
|
||||||
|
|
||||||
|
### Uso do modulo
|
||||||
|
|
||||||
```hcl
|
```hcl
|
||||||
module "api_gateway" {
|
# environments/dev/api_gateway_mfe.tf
|
||||||
source = "./modules/api_gateway"
|
module "api_gateway_mfe" {
|
||||||
|
count = var.enable_api_gateway_mfe ? 1 : 0
|
||||||
compartment_id = var.compartment_id
|
source = "../../modules/api_gateway_mfe"
|
||||||
subnet_id = var.subnet_id
|
compartment_id = local.compartment_id
|
||||||
name = "nexus-mfe-user"
|
subnet_id = module.network.api_gateway_subnet_id
|
||||||
environment = "dev"
|
env_name = var.env_name
|
||||||
}
|
display_name = "api-gateway-mfe"
|
||||||
|
|
||||||
module "api_gateway_deployment" {
|
mfe_deployments = [
|
||||||
source = "./modules/api_gateway_deployment"
|
{
|
||||||
|
name = "mfe-user"
|
||||||
gateway_id = module.api_gateway.gateway_id
|
bucket_name = "nexus-mfe-user-development"
|
||||||
bucket_name = "nexus-mfe-user-dev"
|
region = "sa-saopaulo-1"
|
||||||
namespace = "grbb7qzeuoag"
|
object_namespace = var.mfe_object_namespace # grbb7qzeuoag
|
||||||
region = "sa-saopaulo-1"
|
},
|
||||||
|
# Adicionar mais MFEs aqui:
|
||||||
|
# { name = "mfe-shell", bucket_name = "nexus-mfe-shell-development", ... },
|
||||||
|
# { name = "mfe-auth", bucket_name = "nexus-mfe-auth-development", ... },
|
||||||
|
]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## Pipeline Azure DevOps - Fluxo
|
### Rotas SPA (Angular)
|
||||||
|
|
||||||
|
O deployment cria duas rotas para cada MFE:
|
||||||
|
|
||||||
|
1. **`/`** (GET) -> `index.html` no Object Storage (SPA entry point)
|
||||||
|
2. **`/{path*}`** (GET) -> arquivos estaticos no Object Storage (JS, CSS, assets)
|
||||||
|
|
||||||
|
### Pipeline CI/CD
|
||||||
|
|
||||||
```
|
```
|
||||||
┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐
|
Push to main (tf_oci_clusters)
|
||||||
│ Build │ ─► │ Upload │ ─► │ CreatePAR │ ─► │ Deploy API │
|
-> Bootstrap (init + validate)
|
||||||
│ (npm build)│ │ (OCI OS) │ │ (OCI) │ │ (Gateway) │
|
-> Detect Changes (diff por environment)
|
||||||
└─────────────┘ └─────────────┘ └─────────────┘ └─────────────┘
|
-> Plan (terraform plan -var-file=terraform.ci.tfvars)
|
||||||
|
-> Manual Approval
|
||||||
|
-> Apply (terraform apply)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Pipeline: `terraform-tf_oci_clusters` (ID 51)
|
||||||
|
Variable Group: `oci-terraform` (ID 34)
|
||||||
|
|
||||||
## URLs de Acesso
|
## URLs de Acesso
|
||||||
|
|
||||||
### Por Ambiente
|
### DEV
|
||||||
|
|
||||||
| Ambiente | URL API Gateway |
|
| Tipo | URL |
|
||||||
|----------|----------------|
|
|------|-----|
|
||||||
| Dev | `https://gateway-ocid.apigateway.sa-saopaulo-1.oci.customer-oci.com` |
|
| API Gateway (privado) | `https://guhal72tzyekzchzamhhi3lvgi.apigateway.sa-saopaulo-1.oci.customer-oci.com/` |
|
||||||
| HML | `https://gateway-ocid.apigateway.sa-saopaulo-1.oci.customer-oci.com` |
|
| Planejado (publico) | `https://mfe-user-dev.invista.com.br` (pendente) |
|
||||||
| PROD | `https://gateway-ocid.apigateway.sa-saopaulo-1.oci.customer-oci.com` |
|
|
||||||
|
|
||||||
## Troubleshooting
|
## Troubleshooting
|
||||||
|
|
||||||
|
|
@ -188,3 +224,7 @@ oci os preauth-request delete \
|
||||||
|
|
||||||
- [OCI API Gateway Docs](https://docs.oracle.com/en-us/iaas/Content/APIGateway/apigateway.htm)
|
- [OCI API Gateway Docs](https://docs.oracle.com/en-us/iaas/Content/APIGateway/apigateway.htm)
|
||||||
- [Static Website Hosting](https://docs.oracle.com/en/learn/oci-api-gateway-web-hosting/index.html)
|
- [Static Website Hosting](https://docs.oracle.com/en/learn/oci-api-gateway-web-hosting/index.html)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
*Atualizado em: 2026-02-23*
|
||||||
|
|
|
||||||
|
|
@ -18,130 +18,105 @@
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Estado Atual da Infraestrutura OCI (verificado em 2026-02-17)
|
## Estado Atual da Infraestrutura OCI (atualizado em 2026-02-23)
|
||||||
|
|
||||||
### VCNs Existentes (Dev)
|
### VCNs Existentes (Dev)
|
||||||
|
|
||||||
| Nome | CIDR | OCID |
|
| Nome | CIDR | OCID |
|
||||||
|------|------|------|
|
|------|------|------|
|
||||||
|
| VCN-Shared | 10.8.0.0/16 | (compartment cmp-shared-inv) |
|
||||||
|
| vcn-oke (dev) | 10.110.0.0/16 | `ocid1.vcn.oc1.sa-saopaulo-1.amaaaaaasks3yliapqrmikfzagpgqohuzjqik3hx63w7r2uajiqv5krvxkda` |
|
||||||
| vcn-oke | 10.120.0.0/16 | `ocid1.vcn.oc1.sa-saopaulo-1.amaaaaaasks3yliatayztbyd6doyk5oglrmrc57jekltu3xnnena6fvruwba` |
|
| vcn-oke | 10.120.0.0/16 | `ocid1.vcn.oc1.sa-saopaulo-1.amaaaaaasks3yliatayztbyd6doyk5oglrmrc57jekltu3xnnena6fvruwba` |
|
||||||
| vcn-oke | 10.110.0.0/16 | (múltiplas) |
|
|
||||||
|
|
||||||
### Subnets Existentes (VCN 10.120.0.0/16)
|
### Subnets - vcn-oke dev (10.110.0.0/16) - Terraform managed
|
||||||
|
|
||||||
| Nome | CIDR | Tipo | OCID |
|
| Nome | CIDR | Tipo | OCID |
|
||||||
|------|------|------|------|
|
|------|------|------|------|
|
||||||
| sbn-workers-1 | 10.120.0.0/20 | Workers | `ocid1.subnet.oc1.sa-saopaulo-1.aaaaaaaazfomdghi4x4jpluyjooy7ajvsf5y57jq2xcqwf35guodkcn2wrwq` |
|
| sbn-workers-1 | 10.110.0.0/20 | Workers | (Terraform) |
|
||||||
| sbn-workers-2 | 10.120.16.0/20 | Workers | `ocid1.subnet.oc1.sa-saopaulo-1.aaaaaaaahaqguwt67kzs2dad2vyz3zpjl5ac7ximeqg55gmsnd33c2qikija` |
|
| sbn-workers-2 | 10.110.16.0/20 | Workers | (Terraform) |
|
||||||
| sbn-workers-3 | 10.120.32.0/20 | Workers | `ocid1.subnet.oc1.sa-saopaulo-1.aaaaaaaafzhmhvz2scr6sfsygixz2gjfnecggiirh3rvyhjcmfn3ohmohj6a` |
|
| sbn-workers-3 | 10.110.32.0/20 | Workers | (Terraform) |
|
||||||
| sbn-lb-1 | 10.120.128.0/20 | Load Balancer | `ocid1.subnet.oc1.sa-saopaulo-1.aaaaaaaa2ezw57uocis6s2eioypdsnt2p4pwm4fwnjz5jdaqigrm6jaqexeq` |
|
| sbn-lb-1 | 10.110.128.0/20 | Load Balancer | (Terraform) |
|
||||||
| sbn-lb-2 | 10.120.144.0/20 | Load Balancer | `ocid1.subnet.oc1.sa-saopaulo-1.aaaaaaaav7qtnmgil2qdt3lz6fnqkdcbymjd2dtjjeyo6y7z3s2omq4uvcqa` |
|
| sbn-lb-2 | 10.110.144.0/20 | Load Balancer | (Terraform) |
|
||||||
|
| sbn-api-gateway | 10.110.192.0/20 | API Gateway | `ocid1.subnet.oc1.sa-saopaulo-1.aaaaaaaaooiy6bmikuaohtxyz2o3sjrjp2iqob3rim4j66vw4rzit7jcqjfa` |
|
||||||
|
|
||||||
### API Gateways
|
### API Gateways
|
||||||
|
|
||||||
| Nome | Status |
|
| Nome | IP | Status | Gerenciado |
|
||||||
|------|--------|
|
|------|-----|--------|-----------|
|
||||||
| - | ❌ Nenhum criado |
|
| api-gateway-mfe-dev | 10.110.198.250 | ACTIVE | Terraform (`tf_oci_clusters`) |
|
||||||
|
|
||||||
### Buckets (Object Storage)
|
### Buckets (Object Storage)
|
||||||
|
|
||||||
| Nome | Status |
|
| Nome | Status | Uso |
|
||||||
|------|--------|
|
|------|--------|-----|
|
||||||
| - | ❌ Nenhum criado |
|
| nexus-mfe-user-development | ACTIVE | MFE User (Angular SPA) |
|
||||||
|
| nexus-mfe-shell-development | ACTIVE | Shell MFE Angular |
|
||||||
|
| nexus-mfe-auth-development | ACTIVE | MFE Auth |
|
||||||
|
| nexus-mfe-person-development | ACTIVE | MFE Person |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Recomendação: Usar Subnet Existente
|
## Infraestrutura Terraform (Concluido)
|
||||||
|
|
||||||
Para o API Gateway, podemos usar a subnet de Load Balancer existente:
|
O API Gateway MFE e provisionado automaticamente via Terraform no repositorio `tf_oci_clusters`.
|
||||||
- **sbn-lb-1**: `ocid1.subnet.oc1.sa-saopaulo-1.aaaaaaaa2ezw57uocis6s2eioypdsnt2p4pwm4fwnjz5jdaqigrm6jaqexeq`
|
|
||||||
|
|
||||||
## Atividades Necessárias para Completar o Setup OCI
|
### Modulo: `modules/api_gateway_mfe/`
|
||||||
|
|
||||||
### 🔴 Crítico - Infraestrutura OCI
|
Arquivos:
|
||||||
|
- `main.tf` - Gateway + Deployment com rotas SPA (index.html fallback + static files)
|
||||||
|
- `variables.tf` - Inputs (compartment_id, subnet_id, env_name, mfe_deployments list)
|
||||||
|
- `outputs.tf` - gateway_id, gateway_ip, gateway_hostname, deployment_endpoints
|
||||||
|
- `versions.tf` - oracle/oci ~> 7.0
|
||||||
|
|
||||||
#### 1. Criar/Configurar VCN (Virtual Cloud Network)
|
### Subnet dedicada (adicionada ao modulo network)
|
||||||
- **Descrição**: API Gateway precisa de uma VCN com subnets
|
|
||||||
- **Status**: ❌ Precisa ser criado via Terraform
|
|
||||||
- **Responsável**: Infraestrutura
|
|
||||||
|
|
||||||
#### 2. Obter Subnet OCID para API Gateway
|
A subnet `sbn-api-gateway` foi criada automaticamente pelo Terraform no modulo `network`:
|
||||||
- **Descrição**: Cada API Gateway precisa de uma subnet dedicada
|
- CIDR: 10.110.192.0/20 (cidrsubnet index 12)
|
||||||
- **Status**: ❌ Variável `OCI_SUBNET_OCID` não existe no Variable Group
|
- Route table: NAT + Service Gateway (privada)
|
||||||
|
- Security list: ingress 80/443 da VCN, egress all
|
||||||
|
- Toggle: `enable_api_gateway_subnet` (bool)
|
||||||
|
|
||||||
#### 3. Criar Variable Group `oci-terraform` no Azure DevOps
|
### Pipeline CI/CD
|
||||||
- **Variáveis necessárias**:
|
|
||||||
- `OCI_USER_OCID`
|
|
||||||
- `OCI_TENANCY_OCID`
|
|
||||||
- `OCI_REGION`
|
|
||||||
- `OCI_FINGERPRINT`
|
|
||||||
- `OCI_PRIVATE_KEY_B64`
|
|
||||||
- `OCI_COMPARTMENT_OCID`
|
|
||||||
- `OCI_SUBNET_OCID` ← **NOVO**
|
|
||||||
|
|
||||||
---
|
- **Pipeline**: `terraform-tf_oci_clusters` (definition ID 51)
|
||||||
|
- **YAML**: `.azure/azure-pipelines-pr-selective.yml`
|
||||||
|
- **Variable Group**: `oci-terraform` (ID 34)
|
||||||
|
- **Build de sucesso**: #5964 (todas as stages passaram)
|
||||||
|
|
||||||
### 🟡 Pipeline - Melhorias Necessárias
|
## Atividades Restantes
|
||||||
|
|
||||||
#### 4. Melhorar Routes do API Gateway (SPAs)
|
### Conectividade de Rede (Pendente)
|
||||||
|
|
||||||
A pipeline atual usa rota única:
|
#### 1. VCN Peering via DRG
|
||||||
```yaml
|
|
||||||
routes:
|
|
||||||
- path: /{req.*}
|
|
||||||
methods: [GET]
|
|
||||||
backend:
|
|
||||||
type: HTTP
|
|
||||||
url: "${PAR_URL}"
|
|
||||||
```
|
|
||||||
|
|
||||||
**Problema**: Não funciona bem para SPAs (Angular) que precisam de:
|
O LB `Test_Crivo_Dev` esta na VCN-Shared (10.8.0.0/16) e o API Gateway esta na vcn-oke dev (10.110.0.0/16).
|
||||||
- `/` → retorna `index.html`
|
Para que o LB consiga rotear trafego para o API Gateway, e necessario:
|
||||||
- `/route1` → retorna `index.html` (SPA routing)
|
|
||||||
- `*.js` → retorna JavaScript
|
|
||||||
- `*.css` → retorna CSS
|
|
||||||
- `*.html` → retorna HTML
|
|
||||||
|
|
||||||
**Solução**: Implementar rotas múltiplas conforme documentação:
|
1. **Attach vcn-oke dev ao DRG-Invista-Shared**
|
||||||
|
- DRG OCID: `ocid1.drg.oc1.sa-saopaulo-1.aaaaaaaazuiluiavm3zcrzelqs2f3k3sdy3fka5yytwjua37a2ksn446deza`
|
||||||
|
- VCN dev OCID: `ocid1.vcn.oc1.sa-saopaulo-1.amaaaaaasks3yliapqrmikfzagpgqohuzjqik3hx63w7r2uajiqv5krvxkda`
|
||||||
|
|
||||||
```yaml
|
2. **Configurar Route Tables**
|
||||||
routes:
|
- Na VCN-Shared: rota 10.110.0.0/16 -> DRG
|
||||||
# Rota default - index.html para SPA
|
- Na vcn-oke dev: rota 10.8.0.0/16 -> DRG (para retorno)
|
||||||
- path: /{req.*}
|
|
||||||
methods: [GET]
|
|
||||||
backend:
|
|
||||||
type: HTTP
|
|
||||||
url: "${PAR_URL}/${request.path[req]}"
|
|
||||||
|
|
||||||
# Regras específicas por tipo de arquivo
|
3. **Security Lists**
|
||||||
- path: /{ext}.js
|
- Permitir trafego entre 10.8.0.0/16 e 10.110.192.0/20 (subnet API GW)
|
||||||
methods: [GET]
|
|
||||||
backend:
|
|
||||||
type: HTTP
|
|
||||||
url: "https://{namespace}.objectstorage.{region}.oci.customer-oci.com/n/{bucket}/o/${request.path[req]}"
|
|
||||||
|
|
||||||
# wildcard *.js, *.css, etc.
|
#### 2. Load Balancer - Backend e Routing
|
||||||
```
|
|
||||||
|
|
||||||
#### 5. Suporte a Múltiplos Ambientes
|
No LB `Test_Crivo_Dev` (IP 10.8.4.127):
|
||||||
|
|
||||||
| Ambiente | Bucket | API Gateway |
|
1. **Criar backend set** `bs-mfe-user-dev` apontando para `10.110.198.250:443`
|
||||||
|----------|--------|-------------|
|
2. **Adicionar routing rule** no routing policy `crivo_routes` para hostname `mfe-user-dev.invista.com.br`
|
||||||
| Dev | `nexus-{mfe}-dev` | `{mfe}-dev-gateway` |
|
3. **Health check** na rota `/` do API Gateway
|
||||||
| HML | `nexus-{mfe}-hml` | `{mfe}-hml-gateway` |
|
|
||||||
| PROD | `nexus-{mfe}-prod` | `{mfe}-prod-gateway` |
|
|
||||||
|
|
||||||
#### 6. Tratar Variáveis por Ambiente
|
#### 3. DNS Cloudflare
|
||||||
|
|
||||||
```yaml
|
Criar registro DNS em `invista.com.br`:
|
||||||
parameters:
|
- Tipo: CNAME (proxied)
|
||||||
- name: environment
|
- Nome: `mfe-user-dev`
|
||||||
type: string
|
- Target: endpoint Cloudflare tunnel ou A record para IP do LB
|
||||||
values:
|
|
||||||
- dev
|
|
||||||
- hml
|
|
||||||
- prod
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
@ -158,83 +133,68 @@ parameters:
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 🔧 Variable Group `oci-terraform`
|
## Variable Group `oci-terraform` (ID 34)
|
||||||
|
|
||||||
O Variable Group **`oci-terraform`** no Azure DevOps contém as credenciais OCI usadas tanto pelo Terraform (para criar infraestrutura) quanto pelas pipelines de deploy MFE.
|
O Variable Group **`oci-terraform`** no Azure DevOps contem as credenciais OCI usadas pelo Terraform e pipelines MFE.
|
||||||
|
|
||||||
### Variáveis Existentes (usadas pelo Terraform)
|
**Ultima atualizacao**: 2026-02-22 (S3 credentials atualizadas para usuario `danilo.duarte`)
|
||||||
|
|
||||||
| Variável | Tipo | Descrição |
|
### Variaveis
|
||||||
|
|
||||||
|
| Variavel | Tipo | Descricao |
|
||||||
|----------|------|-----------|
|
|----------|------|-----------|
|
||||||
| `OCI_TENANCY_OCID` | Secret | OCID da Tenancy OCI |
|
| `OCI_TENANCY_OCID` | Plain | OCID da Tenancy OCI |
|
||||||
| `OCI_USER_OCID` | Secret | OCID do Usuário OCI |
|
| `OCI_USER_OCID` | Plain | OCID do Usuario OCI (danilo.duarte) |
|
||||||
| `OCI_FINGERPRINT` | Secret | Fingerprint da chave pública (~47 chars) |
|
| `OCI_FINGERPRINT` | Plain | Fingerprint da chave publica |
|
||||||
| `OCI_PRIVATE_KEY_B64` | Secret | Chave privada (Base64 ou PEM) |
|
| `OCI_PRIVATE_KEY_B64` | Plain | Chave privada Base64 |
|
||||||
| `OCI_REGION` |普通 | Região OCI (ex: sa-saopaulo-1) |
|
| `OCI_REGION` | Plain | sa-saopaulo-1 |
|
||||||
| `COMPARTMENT_PARENT_OCID` | Secret | OCID do compartment pai |
|
| `OCI_PRIVATE_KEY_PATH` | Plain | ./config/oci_api_key.pem |
|
||||||
|
| `TF_STATE_ACCESS_KEY` | Secret | S3-compatible access key (danilo.duarte) |
|
||||||
|
| `TF_STATE_SECRET_KEY` | Secret | S3-compatible secret key (danilo.duarte) |
|
||||||
|
| `TF_VAR_compartment_parent_ocid` | Secret | OCID do compartment pai |
|
||||||
|
| `EXISTING_COMPARTMENT_ID` | Plain | Compartment DEV |
|
||||||
|
| `ARGOCD_REPO_PAT` | Secret | PAT para ArgoCD |
|
||||||
|
| `CLOUDFLARE_API_TOKEN` | Secret | Token Cloudflare |
|
||||||
|
| `SSH_PUBLIC_KEY` / `SSH_PUBLIC_KEY_B64` | Secret | Chave SSH para nodes/bastion |
|
||||||
|
| `TLS_CERT_B64` / `TLS_KEY_B64` | Secret | Certificados TLS |
|
||||||
|
|
||||||
### Variáveis FALTANDO para API Gateway (precisam ser adicionadas)
|
### Historico de problemas
|
||||||
|
|
||||||
| Variável | Tipo | Descrição |
|
- **2026-02-22**: S3 credentials (`TF_STATE_ACCESS_KEY`/`SECRET_KEY`) atualizadas.
|
||||||
|----------|------|-----------|
|
As credenciais anteriores pertenciam ao usuario `william.dias` que estava desabilitado para S3.
|
||||||
| `OCI_SUBNET_OCID` | Secret | **OCID da Subnet** para API Gateway |
|
Criado novo Customer Secret Key para `danilo.duarte` via OCI CLI.
|
||||||
|
|
||||||
### Onde o `oci-terraform` é usado
|
|
||||||
|
|
||||||
1. **Terraform OCI** (`tf_oci_clusters`):
|
|
||||||
- Criar VCNs, Subnets, OKE Clusters
|
|
||||||
- Criar Buckets (se necessário via Terraform)
|
|
||||||
|
|
||||||
2. **Pipelines MFE OCI**:
|
|
||||||
- `mfe-user/azure-pipelines-oci.yml` ← usa este grupo
|
|
||||||
- Upload de arquivos para Object Storage
|
|
||||||
- Criar PAR (Pre-Authenticated Request)
|
|
||||||
- Deploy no API Gateway
|
|
||||||
|
|
||||||
### Fluxo Completo
|
|
||||||
|
|
||||||
```
|
|
||||||
┌─────────────────────────────────────────────────────────────────┐
|
|
||||||
│ 1. Terraform (tf_oci_clusters) usa oci-terraform │
|
|
||||||
│ └── Cria: VCN, Subnets, OKE Clusters, Buckets │
|
|
||||||
└─────────────────────────────────────────────────────────────────┘
|
|
||||||
│
|
|
||||||
▼
|
|
||||||
┌─────────────────────────────────────────────────────────────────┐
|
|
||||||
│ 2. Pipeline MFE usa oci-terraform │
|
|
||||||
│ └── Upload → Object Storage │
|
|
||||||
│ └── Create PAR │
|
|
||||||
│ └── Deploy → API Gateway │
|
|
||||||
└─────────────────────────────────────────────────────────────────┘
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Checklist de Atividades
|
## Checklist de Atividades
|
||||||
|
|
||||||
### Infraestrutura (Terraform)
|
### Infraestrutura Terraform (Concluido)
|
||||||
- [x] VCN já existe (`vcn-oke` 10.120.0.0/16)
|
- [x] VCN vcn-oke dev (10.110.0.0/16) criada via Terraform
|
||||||
- [x] Subnets já existem (sbn-lb-1 pode ser usada para API Gateway)
|
- [x] Subnet dedicada `sbn-api-gateway` (10.110.192.0/20) criada via Terraform
|
||||||
- [ ] Criar subnet dedicada para API Gateway (opcional, pode usar sbn-lb-1)
|
- [x] Modulo `api_gateway_mfe` criado (`tf_oci_clusters/modules/api_gateway_mfe/`)
|
||||||
- [ ] Adicionar `OCI_SUBNET_OCID` ao Variable Group `oci-terraform`
|
- [x] API Gateway `api-gateway-mfe-dev` provisionado (IP 10.110.198.250)
|
||||||
|
- [x] Deployment MFE User com rotas SPA (index.html + static files)
|
||||||
|
- [x] Pipeline CI/CD `terraform-tf_oci_clusters` funcionando (build #5964)
|
||||||
|
- [x] Variable Group `oci-terraform` atualizado (S3 credentials corrigidas)
|
||||||
|
|
||||||
### Azure DevOps
|
### Conectividade (Pendente)
|
||||||
- [ ] Adicionar `OCI_SUBNET_OCID` ao Variable Group `oci-terraform`
|
- [ ] Attach vcn-oke dev ao DRG-Invista-Shared
|
||||||
- **Valor sugerido**: `ocid1.subnet.oc1.sa-saopaulo-1.aaaaaaaa2ezw57uocis6s2eioypdsnt2p4pwm4fwnjz5jdaqigrm6jaqexeq` (sbn-lb-1)
|
- [ ] Route tables entre VCN-Shared e vcn-oke dev
|
||||||
- [ ] Criar pipelines para todos os MFEs
|
- [ ] Security lists para trafego cross-VCN
|
||||||
|
|
||||||
### Pipeline mfe-user
|
### Load Balancer (Pendente)
|
||||||
- [ ] Testar pipeline existente
|
- [ ] Backend set no LB Test_Crivo_Dev -> 10.110.198.250:443
|
||||||
- [ ] Corrigir rotas para SPA (Angular)
|
- [ ] Routing rule para hostname mfe-user-dev.invista.com.br
|
||||||
- [ ] Adicionar suporte a múltiplos ambientes (dev/hml/prod)
|
- [ ] Health check configurado
|
||||||
- [ ] Tratar fallback para index.html
|
|
||||||
|
|
||||||
### Novos MFEs (criar pipelines)
|
### DNS (Pendente)
|
||||||
- [ ] mfe-shell → OCI
|
- [ ] Cloudflare: registro mfe-user-dev.invista.com.br
|
||||||
- [ ] mfe-auth → OCI
|
|
||||||
- [ ] mfe-person → OCI
|
### MFEs adicionais (Futuro)
|
||||||
- [ ] mfe-poc → OCI
|
- [ ] mfe-shell - adicionar ao mfe_deployments no Terraform
|
||||||
- [ ] mfe-formalization → OCI + AWS (primeira pipeline)
|
- [ ] mfe-auth - adicionar ao mfe_deployments no Terraform
|
||||||
|
- [ ] mfe-person - adicionar ao mfe_deployments no Terraform
|
||||||
|
- [ ] mfe-poc - adicionar ao mfe_deployments no Terraform
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
@ -256,9 +216,10 @@ oci api-gateway deployment get --deployment-id <id>
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Referências
|
## Referencias
|
||||||
|
|
||||||
- [Terraform OCI Clusters](../tf_oci_clusters/README.md)
|
- [API Gateways](./API-GATEWAY.md) - Todos os gateways (incluindo api-gateway-mfe-dev)
|
||||||
- [OCI - Visão Geral](./OCI.md)
|
- [Load Balancers](./LOAD-BALANCERS.md) - LBs e routing
|
||||||
- [Terraform - Importação](./OCI-TERRAFORM.md)
|
- [Terraform Importacao](./OCI-TERRAFORM.md) - Import de recursos
|
||||||
- [API Gateway](./OCI-API-GATEWAY.md)
|
- [API Gateway Config](./OCI-API-GATEWAY.md) - Setup manual
|
||||||
|
- [Cloudflare](./CLOUDFLARE.md) - DNS
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,15 @@ nexus/
|
||||||
- [OCI Connection](./azure-devops/OCI-CONNECTION.md)
|
- [OCI Connection](./azure-devops/OCI-CONNECTION.md)
|
||||||
- [MS-USER - Microservico de Usuarios](./MS-USER.md)
|
- [MS-USER - Microservico de Usuarios](./MS-USER.md)
|
||||||
|
|
||||||
|
### Infraestrutura OCI
|
||||||
|
|
||||||
|
- [API Gateways](./API-GATEWAY.md) - Todos os gateways OCI (nexus, insign, MFE)
|
||||||
|
- [Load Balancers](./LOAD-BALANCERS.md) - LBs OCI e routing
|
||||||
|
- [MFE Tasks](./OCI-MFE-TASKS.md) - Status e checklist do setup MFE
|
||||||
|
- [API Gateway Config](./OCI-API-GATEWAY.md) - Configuracao detalhada API GW
|
||||||
|
- [Terraform Import](./OCI-TERRAFORM.md) - Importacao de recursos
|
||||||
|
- [Cloudflare](./CLOUDFLARE.md) - DNS e proxy
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
*Projeto InventCloud - Invista FIDC*
|
*Projeto InventCloud - Invista FIDC*
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue