- README.md: reescrito com 6 MFEs, 3 clusters OKE, 9 microservicos, links para novos docs tf_oci_clusters - OCI.md: corrige VCN CIDR (10.120 orphan deletado -> 10.110 ativo), atualiza 6 buckets mfe-*-dev, API Gateway PRIVATE em sbn-api-gateway, pipelines padronizadas - OCI-DEV-NEXUS.md: API Gateway com 6 deployments MFE, Object Storage com 6 buckets, corrige tipo PUBLIC->PRIVATE e subnet - API-GATEWAY.md: 6 deployments api-gateway-mfe-dev, 8 buckets na secao Frontends Estaticos, pendencias atualizadas - OCI-MFE-TASKS.md: VCN orphan marcada como deletada, 6 buckets mfe-*-dev, checklist atualizado Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
244 lines
9.6 KiB
Markdown
244 lines
9.6 KiB
Markdown
# Análise: OCI Web Hosting para MFEs
|
|
|
|
## Base: [Oracle Documentation](https://docs.oracle.com/en/learn/oci-api-gateway-web-hosting/index.html)
|
|
|
|
---
|
|
|
|
## Etapas da Documentação vs. Pipeline Atual
|
|
|
|
| Etapa | Documentação OCI | Status Pipeline mfe-user |
|
|
|-------|------------------|------------------------|
|
|
| 1 | Create Bucket | ✅ Parcial (cria se não existir) |
|
|
| 2 | Upload Files | ✅ Feito |
|
|
| 3 | Create PAR | ✅ Feito |
|
|
| 4 | Create API Gateway | ⚠️ Parcial (falta VCN/Subnet) |
|
|
| 5 | Setup Deployment | ⚠️ Parcial |
|
|
| 6 | Add Routes | ❌ Incompleto |
|
|
| 7 | Test | ❌ Não testado |
|
|
|
|
---
|
|
|
|
## Estado Atual da Infraestrutura OCI (atualizado em 2026-02-28)
|
|
|
|
### VCNs Existentes (Dev)
|
|
|
|
| Nome | CIDR | OCID | Status |
|
|
|------|------|------|--------|
|
|
| VCN-Shared | 10.8.0.0/16 | (compartment cmp-shared-inv) | ACTIVE |
|
|
| vcn-oke (dev) | 10.110.0.0/16 | `ocid1.vcn.oc1.sa-saopaulo-1.amaaaaaasks3yliapqrmikfzagpgqohuzjqik3hx63w7r2uajiqv5krvxkda` | ACTIVE (Terraform) |
|
|
| vcn-oke (orphan) | 10.120.0.0/16 | `ocid1.vcn.oc1.sa-saopaulo-1.amaaaaaasks3yliatayztbyd6doyk5oglrmrc57jekltu3xnnena6fvruwba` | **DELETADO** em 2026-02-25 |
|
|
|
|
### Subnets - vcn-oke dev (10.110.0.0/16) - Terraform managed
|
|
|
|
| Nome | CIDR | Tipo | OCID |
|
|
|------|------|------|------|
|
|
| sbn-workers-1 | 10.110.0.0/20 | Workers | (Terraform) |
|
|
| sbn-workers-2 | 10.110.16.0/20 | Workers | (Terraform) |
|
|
| sbn-workers-3 | 10.110.32.0/20 | Workers | (Terraform) |
|
|
| sbn-lb-1 | 10.110.128.0/20 | Load Balancer | (Terraform) |
|
|
| 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
|
|
|
|
| Nome | IP | Status | Gerenciado |
|
|
|------|-----|--------|-----------|
|
|
| api-gateway-mfe-dev | 10.110.198.250 | ACTIVE | Terraform (`tf_oci_clusters`) |
|
|
|
|
### Buckets (Object Storage)
|
|
|
|
6 buckets ativos no namespace `grbb7qzeuoag`, compartment `cmp-dev-nexus`. Criados pelas pipelines CI/CD (Azure DevOps).
|
|
|
|
| Nome | Status | Criado em |
|
|
|------|--------|-----------|
|
|
| `mfe-shell-dev` | ACTIVE | 2026-02-25 (pipeline) |
|
|
| `mfe-auth-dev` | ACTIVE | 2026-02-25 (pipeline) |
|
|
| `mfe-user-dev` | ACTIVE | 2026-02-25 (pipeline) |
|
|
| `mfe-person-dev` | ACTIVE | 2026-02-25 (pipeline) |
|
|
| `mfe-formalization-dev` | ACTIVE | 2026-02-25 (pipeline) |
|
|
| `mfe-poc-dev` | ACTIVE | 2026-02-25 (pipeline) |
|
|
|
|
---
|
|
|
|
## Infraestrutura Terraform (Concluido)
|
|
|
|
O API Gateway MFE e provisionado automaticamente via Terraform no repositorio `tf_oci_clusters`.
|
|
|
|
### Modulo: `modules/api_gateway_mfe/`
|
|
|
|
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
|
|
|
|
### Subnet dedicada (adicionada ao modulo network)
|
|
|
|
A subnet `sbn-api-gateway` foi criada automaticamente pelo Terraform no modulo `network`:
|
|
- CIDR: 10.110.192.0/20 (cidrsubnet index 12)
|
|
- Route table: NAT + Service Gateway (privada)
|
|
- Security list: ingress 80/443 da VCN, egress all
|
|
- Toggle: `enable_api_gateway_subnet` (bool)
|
|
|
|
### Pipeline CI/CD
|
|
|
|
- **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)
|
|
|
|
## Atividades Restantes
|
|
|
|
### Conectividade de Rede (Pendente)
|
|
|
|
#### 1. VCN Peering via DRG
|
|
|
|
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).
|
|
Para que o LB consiga rotear trafego para o API Gateway, e necessario:
|
|
|
|
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`
|
|
|
|
2. **Configurar Route Tables**
|
|
- Na VCN-Shared: rota 10.110.0.0/16 -> DRG
|
|
- Na vcn-oke dev: rota 10.8.0.0/16 -> DRG (para retorno)
|
|
|
|
3. **Security Lists**
|
|
- Permitir trafego entre 10.8.0.0/16 e 10.110.192.0/20 (subnet API GW)
|
|
|
|
#### 2. Load Balancer - Backend e Routing
|
|
|
|
No LB `Test_Crivo_Dev` (IP 10.8.4.127):
|
|
|
|
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`
|
|
3. **Health check** na rota `/` do API Gateway
|
|
|
|
#### 3. DNS Cloudflare
|
|
|
|
Criar registro DNS em `invista.com.br`:
|
|
- Tipo: CNAME (proxied)
|
|
- Nome: `mfe-user-dev`
|
|
- Target: endpoint Cloudflare tunnel ou A record para IP do LB
|
|
|
|
---
|
|
|
|
### 🟢 MFEs que Precisam de Pipeline OCI
|
|
|
|
| MFE | Pipeline AWS | Pipeline OCI | Prioridade | Status |
|
|
|-----|--------------|-------------|------------|--------|
|
|
| mfe-user | ✅ | ✅ Template OCI (devops) | Alta | **Concluído 2026-02-25** |
|
|
| mfe-shell | ✅ | ✅ Template OCI (devops) | Alta | **Concluído 2026-02-25** |
|
|
| mfe-auth | ✅ | ✅ Template OCI (devops) | Alta | **Concluído 2026-02-25** |
|
|
| mfe-person | ✅ | ✅ Template OCI (devops) | Média | **Concluído 2026-02-25** |
|
|
| mfe-poc | ✅ | ✅ Template OCI (devops) | Baixa | **Concluído 2026-02-25** |
|
|
| mfe-formalization | ❌ | ✅ Template OCI (devops) | Baixa | **Concluído 2026-02-25** |
|
|
|
|
**Padrão adotado (2026-02-25):**
|
|
- Template compartilhado: `azure-pipelines-templates/mfe/deploy-mfe-oci.yaml` (branch `main`)
|
|
- Cada MFE: `azure-pipelines.yml` na branch `devops` extendendo o template
|
|
- Trigger: branch `devops`
|
|
- Bucket: `mfe-<nome>-dev`
|
|
- Variable Group: `oci-terraform`
|
|
|
|
---
|
|
|
|
## Variable Group `oci-terraform` (ID 34)
|
|
|
|
O Variable Group **`oci-terraform`** no Azure DevOps contem as credenciais OCI usadas pelo Terraform e pipelines MFE.
|
|
|
|
**Ultima atualizacao**: 2026-02-22 (S3 credentials atualizadas para usuario `danilo.duarte`)
|
|
|
|
### Variaveis
|
|
|
|
| Variavel | Tipo | Descricao |
|
|
|----------|------|-----------|
|
|
| `OCI_TENANCY_OCID` | Plain | OCID da Tenancy OCI |
|
|
| `OCI_USER_OCID` | Plain | OCID do Usuario OCI (danilo.duarte) |
|
|
| `OCI_FINGERPRINT` | Plain | Fingerprint da chave publica |
|
|
| `OCI_PRIVATE_KEY_B64` | Plain | Chave privada Base64 |
|
|
| `OCI_REGION` | Plain | sa-saopaulo-1 |
|
|
| `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 |
|
|
|
|
### Historico de problemas
|
|
|
|
- **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.
|
|
Criado novo Customer Secret Key para `danilo.duarte` via OCI CLI.
|
|
|
|
---
|
|
|
|
## Checklist de Atividades
|
|
|
|
### Infraestrutura Terraform (Concluido)
|
|
- [x] VCN vcn-oke dev (10.110.0.0/16) criada via Terraform
|
|
- [x] Subnet dedicada `sbn-api-gateway` (10.110.192.0/20) criada via Terraform
|
|
- [x] Modulo `api_gateway_mfe` criado (`tf_oci_clusters/modules/api_gateway_mfe/`)
|
|
- [x] API Gateway `api-gateway-mfe-dev` provisionado (IP 10.110.198.250)
|
|
- [x] 6 deployments MFE (shell/auth/user/person/formalization/poc) 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)
|
|
- [x] 6 buckets `mfe-*-dev` criados e populados pelas pipelines Azure DevOps
|
|
|
|
### Conectividade (Pendente)
|
|
- [ ] Attach vcn-oke dev ao DRG-Invista-Shared
|
|
- [ ] Route tables entre VCN-Shared e vcn-oke dev
|
|
- [ ] Security lists para trafego cross-VCN
|
|
|
|
### Load Balancer (Pendente)
|
|
- [ ] Backend set no LB Test_Crivo_Dev -> 10.110.198.250:443
|
|
- [ ] Routing rules por hostname para cada MFE (6 rules: mfe-{name}-dev.invista.com.br)
|
|
- [ ] Health check configurado
|
|
|
|
### DNS (Pendente)
|
|
- [ ] Cloudflare: 6 registros CNAME `mfe-{name}-dev.invista.com.br`
|
|
|
|
### MFE Shell (Pendente)
|
|
- [ ] Atualizar `federation.manifest.json` com URLs OCI dos remotes (atualmente aponta para localhost)
|
|
- [ ] Migrar `EnvironmentService` de AWS API Gateway para OCI api-gateway-nexus-dev
|
|
|
|
### MFEs adicionais (Concluído 2026-02-25)
|
|
- [x] mfe-shell - adicionado ao mfe_deployments no Terraform
|
|
- [x] mfe-auth - adicionado ao mfe_deployments no Terraform
|
|
- [x] mfe-person - adicionado ao mfe_deployments no Terraform
|
|
- [x] mfe-formalization - adicionado ao mfe_deployments no Terraform
|
|
- [x] mfe-poc - adicionado ao mfe_deployments no Terraform
|
|
- [x] Template OCI compartilhado criado: `azure-pipelines-templates/mfe/deploy-mfe-oci.yaml`
|
|
- [x] azure-pipelines.yml atualizado em todos os 6 MFEs (branch `devops`)
|
|
|
|
---
|
|
|
|
## Comandos Úteis OCI
|
|
|
|
```bash
|
|
# Listar VCNs
|
|
oci network vcn list --compartment-id <compartment-id>
|
|
|
|
# Listar Subnets
|
|
oci network subnet list --compartment-id <compartment-id> --vcn-id <vcn-id>
|
|
|
|
# Listar API Gateways
|
|
oci api-gateway gateway list --compartment-id <compartment-id>
|
|
|
|
# Verificar deployment
|
|
oci api-gateway deployment get --deployment-id <id>
|
|
```
|
|
|
|
---
|
|
|
|
## Referencias
|
|
|
|
- [API Gateways](./API-GATEWAY.md) - Todos os gateways (incluindo api-gateway-mfe-dev)
|
|
- [Load Balancers](./LOAD-BALANCERS.md) - LBs e routing
|
|
- [Terraform Importacao](./OCI-TERRAFORM.md) - Import de recursos
|
|
- [API Gateway Config](./OCI-API-GATEWAY.md) - Setup manual
|
|
- [Cloudflare](./CLOUDFLARE.md) - DNS
|