docs: add OCI documentation and resolve merge conflicts

This commit is contained in:
Tiago Ribeiro 2026-02-18 14:37:28 -03:00
parent 3eead39ce8
commit 3a615e195c
7 changed files with 1434 additions and 0 deletions

365
MFE-USER-PIPELINE.md Normal file
View file

@ -0,0 +1,365 @@
# mfe-user - Pipeline Multi-Cloud
## Visão Geral
O repositório `mfe-user` possui uma pipeline unificada que suporta deploy para **AWS** e **OCI** (Oracle Cloud Infrastructure).
**Localização**: `C:\dev\C:devrepos_mfe\mfe-user\azure-pipelines.yml`
**Branch**: `devops`
---
## Como Executar a Pipeline
### Opção 1: Push na branch devops
```bash
cd mfe-user
git checkout devops
# fazer alterações
git add .
git commit -m "sua mensagem"
git push origin devops
```
A pipeline dispara automaticamente.
### Opção 2: Executar manualmente
1. Acesse Azure DevOps → Pipelines
2. Selecione `mfe-user`
3. Clique em **Run pipeline**
4. Selecione branch `devops`
5. Escolha `cloudProvider`:
- `aws` → Deploy AWS S3
- `oci` → Deploy OCI Object Storage + API Gateway
- `both` → Ambos
---
## Fluxo da Pipeline
### Diagrama Completo
```
┌──────────────────────────────────────────────────────────────┐
│ TRIGGER: Push na branch 'devops' │
└──────────────────────────────────────────────────────────────┘
┌──────────────────────────────────────────────────────────────┐
│ PARÂMETRO: cloudProvider │
│ ├── aws (padrão) │
│ ├── oci │
│ └── both │
└──────────────────────────────────────────────────────────────┘
┌──────────────────────────────────────────────────────────────┐
│ STAGE 1: BUILD (sempre executa) │
│ ├── Node.js 20.x │
│ ├── npm ci │
│ ├── npm run build:dev │
│ └── Publica artefato 'dist' │
└──────────────────────────────────────────────────────────────┘
┌───────────────┴───────────────┐
▼ ▼
┌─────────────────────────┐ ┌─────────────────────────────┐
│ DEPLOY_AWS │ │ UPLOADTOOCI │
│ (se aws ou both) │ │ (se oci ou both) │
│ ├── Download artefato │ │ ├── Instala OCI CLI │
│ ├── Sync S3 │ │ ├── Cria bucket │
│ └── Purge Cloudflare │ │ └── Upload arquivos │
└─────────────────────────┘ └─────────────────────────────┘
┌─────────────────────────────┐
│ CREATEPAR │
│ ├── Deleta PAR antigo │
│ └── Cria novo PAR (1 ano) │
└─────────────────────────────┘
┌─────────────────────────────┐
│ DEPLOYTOAPIGATEWAY │
│ ├── Cria gateway │
│ └── Cria deployment │
└─────────────────────────────┘
```
---
## O que é Criado na OCI
### 1. Bucket (Object Storage)
| Propriedade | Valor |
|-------------|-------|
| Nome | `mfe-user-dev` |
| Namespace | `grbb7qzeuoag` |
| Compartment | Dev (`ocid1.compartment.oc1..aaaaaaaa76x3nykkjwvctpr6px34dysu3pbg7p62h2r65fegt7fvbrioll3a`) |
| Storage Tier | Standard |
### 2. Pre-Authenticated Request (PAR)
| Propriedade | Valor |
|-------------|-------|
| Nome | `mfe-user-dev-par` |
| Access Type | ObjectRead |
| Validade | 1 ano (31536000 segundos) |
O PAR permite que o API Gateway acesse os arquivos do bucket sem autenticação.
### 3. API Gateway
| Propriedade | Valor |
|-------------|-------|
| Nome | `mfe-user-gateway` |
| Endpoint Type | PUBLIC |
| Subnet | `sbn-lb-1` (`ocid1.subnet.oc1.sa-saopaulo-1.aaaaaaaa2ezw57uocis6s2eioypdsnt2p4pwm4fwnjz5jdaqigrm6jaqexeq`) |
| Compartment | Dev |
### 4. API Gateway Deployment
| Propriedade | Valor |
|-------------|-------|
| Nome | `mfe-user-deployment` |
| Path Prefix | `/` |
| Authentication | Anonymous |
| Rota | `/{req.*}` → GET → PAR URL |
---
## Resultado Final
### URL de Acesso
Após o deploy bem-sucedido, o MFE estará disponível em:
```
https://<gateway-ocid>.apigateway.sa-saopaulo-1.oci.customer-oci.com/
```
### Como Obter a URL
```bash
oci api-gateway gateway list \
--compartment-id "ocid1.compartment.oc1..aaaaaaaa76x3nykkjwvctpr6px34dysu3pbg7p62h2r65fegt7fvbrioll3a"
```
Ou verificar no console OCI:
1. Acesse OCI Console
2. Developer Services → API Gateway
3. Selecione `mfe-user-gateway`
4. Copie o **Hostname**
---
## Pré-requisitos (Variable Groups)
### aws-credentials-dev
| Variável | Descrição |
|----------|-----------|
| `AWS_ACCESS_KEY_ID` | Access Key AWS |
| `AWS_SECRET_ACCESS_KEY` | Secret Key AWS |
| `AWS_REGION` | Região (ex: us-east-1) |
| `CLOUDFLARE_ZONE_ID` | Zone ID Cloudflare |
| `CLOUDFLARE_API_TOKEN` | Token Cloudflare |
### oci-terraform
| Variável | Descrição | Valor Exemplo |
|----------|-----------|---------------|
| `OCI_TENANCY_OCID` | OCID da Tenancy | `ocid1.tenancy.oc1..xxx` |
| `OCI_USER_OCID` | OCID do Usuário | `ocid1.user.oc1..xxx` |
| `OCI_FINGERPRINT` | Fingerprint da chave | `xx:xx:xx:xx:...` |
| `OCI_PRIVATE_KEY_B64` | Chave privada (base64) | (secret) |
| `OCI_REGION` | Região OCI | `sa-saopaulo-1` |
| `COMPARTMENT_PARENT_OCID` | Compartment Dev | `ocid1.compartment.oc1..aaaaaaaa76x3nykkjwvctpr6px34dysu3pbg7p62h2r65fegt7fvbrioll3a` |
| `OCI_SUBNET_OCID` | Subnet para API Gateway | `ocid1.subnet.oc1.sa-saopaulo-1.aaaaaaaa2ezw57uocis6s2eioypdsnt2p4pwm4fwnjz5jdaqigrm6jaqexeq` |
### mfe-credentials
| Variável | Descrição |
|----------|-----------|
| (variáveis específicas do MFE) | |
---
## Comparação: AWS vs OCI
| Aspecto | AWS | OCI |
|---------|-----|-----|
| Armazenamento | S3 Bucket | Object Storage Bucket |
| CDN/Proxy | CloudFront (opcional) | API Gateway |
| Cache | Cloudflare | - |
| Autenticação | AWS Access Key | OCI API Key |
| URL Final | S3 URL ou CloudFront | API Gateway URL |
| Custo | ~$0.023/GB + requests | ~$0.0255/GB + API Gateway |
---
## Troubleshooting
### O que acontece se disparar a pipeline sem infraestrutura?
#### Recursos Criados Automaticamente
| Recurso | Se não existir | Comportamento |
|---------|----------------|---------------|
| Bucket | ✅ Pipeline cria | `oci os bucket create` funciona |
| PAR | ✅ Pipeline cria | Cria automaticamente |
| API Gateway | ✅ Pipeline cria | Funciona SE subnet existir |
| Deployment | ✅ Pipeline cria | Funciona SE gateway existir |
#### Recursos que DEVEM Existir
| Recurso | Obrigatório | Motivo |
|---------|-------------|--------|
| VCN | ✅ Sim | API Gateway precisa de rede |
| Subnet | ✅ Sim | API Gateway precisa de subnet |
| Variable `OCI_SUBNET_OCID` | ✅ Sim | Pipeline precisa saber qual subnet usar |
#### Fluxo de Execução sem Infraestrutura
```
┌─────────────┐
│ BUILD │ → ✅ Sempre funciona
└─────────────┘
┌─────────────┐
│ UPLOADTOOCI│ → ✅ Cria bucket automaticamente
│ │ (se não existir)
└─────────────┘
┌─────────────┐
│ CREATEPAR │ → ✅ Cria PAR automaticamente
└─────────────┘
┌─────────────┐
│ DEPLOY API │ → ❌ FALHA se:
│ GATEWAY │ • OCI_SUBNET_OCID não configurado
│ │ • Subnet não existe
│ │ • VCN não existe
└─────────────┘
```
#### Erros Comuns
| Erro | Causa | Solução |
|------|-------|---------|
| `Variable OCI_SUBNET_OCID not found` | Variável não configurada | Adicionar no Variable Group `oci-terraform` |
| `Subnet not found` | OCID inválido ou subnet não existe | Verificar OCID da subnet |
| `VCN not found` | VCN não existe | Criar VCN via Terraform |
| `NotAuthorizedOrNotFound` | Permissões insuficientes | Verificar políticas OCI |
#### Cenário: Disparar sem OCI_SUBNET_OCID
**Resultado**:
- ✅ Bucket `mfe-user-dev` será criado
- ✅ PAR será criado
- ❌ API Gateway falhará
- ❌ Deployment não será criado
**Como recuperar**:
1. Adicionar `OCI_SUBNET_OCID` no Variable Group
2. Reexecutar a pipeline
3. API Gateway será criado
#### Cenário: Subnet Não Existe
**Resultado**:
- ✅ Bucket criado
- ✅ PAR criado
- ❌ API Gateway falha com erro de subnet
**Como recuperar**:
1. Criar subnet via Terraform ou Console OCI
2. Atualizar `OCI_SUBNET_OCID` com novo OCID
3. Reexecutar pipeline
### Pipeline falha no Build
| Erro | Solução |
|------|---------|
| `npm ci` falha | Verificar `package-lock.json` |
| `npm run build:dev` falha | Verificar script no `package.json` |
| Artefato vazio | Verificar se `dist/` foi gerado |
### Pipeline falha no Upload OCI
| Erro | Solução |
|------|---------|
| `OCI_PRIVATE_KEY_B64` inválido | Regenerar chave e atualizar Variable Group |
| `Authentication failed` | Verificar fingerprint e user OCID |
| `Compartment not found` | Verificar `COMPARTMENT_PARENT_OCID` |
### Pipeline falha no API Gateway
| Erro | Solução |
|------|---------|
| `OCI_SUBNET_OCID` não configurado | Adicionar variável no Variable Group |
| `Subnet not found` | Verificar se subnet existe |
| `Quota exceeded` | Verificar limites da tenancy |
### MFE não carrega no navegador
| Erro | Solução |
|------|---------|
| 403 Forbidden | PAR expirou, reexecutar pipeline |
| 404 Not Found | Verificar rotas do deployment |
| Arquivos JS não carregam | Verificar Content-Type no bucket |
---
## Comandos Úteis
### Verificar recursos OCI
```bash
# Listar buckets
oci os bucket list --compartment-id "ocid1.compartment.oc1..aaaaaaaa76x3nykkjwvctpr6px34dysu3pbg7p62h2r65fegt7fvbrioll3a"
# Listar objetos no bucket
oci os object list --namespace-name "grbb7qzeuoag" --bucket-name "mfe-user-dev"
# Listar API Gateways
oci api-gateway gateway list --compartment-id "ocid1.compartment.oc1..aaaaaaaa76x3nykkjwvctpr6px34dysu3pbg7p62h2r65fegt7fvbrioll3a"
# Ver deployment
oci api-gateway deployment list --gateway-id "<gateway-id>"
# Listar PARs
oci os preauth-request list --namespace-name "grbb7qzeuoag" --bucket-name "mfe-user-dev"
```
### Deletar recursos (se necessário)
```bash
# Deletar PAR
oci os preauth-request delete --namespace-name "grbb7qzeuoag" --bucket-name "mfe-user-dev" --par-id "<par-id>"
# Deletar bucket (vazio)
oci os bucket delete --namespace-name "grbb7qzeuoag" --bucket-name "mfe-user-dev"
# Deletar deployment
oci api-gateway deployment delete --deployment-id "<deployment-id>"
# Deletar gateway
oci api-gateway gateway delete --gateway-id "<gateway-id>"
```
---
## Referências
- [OCI-MFE-TASKS.md](./OCI-MFE-TASKS.md) - Checklist de atividades
- [OCI-MFE-STEPBYSTEP.md](./OCI-MFE-STEPBYSTEP.md) - Passo a passo
- [OCI-API-GATEWAY.md](./OCI-API-GATEWAY.md) - Configuração API Gateway
- [Oracle Documentation](https://docs.oracle.com/en/learn/oci-api-gateway-web-hosting/index.html)

190
OCI-API-GATEWAY.md Normal file
View file

@ -0,0 +1,190 @@
# OCI API Gateway - Configuração para MFEs
## Visão Geral
Este documento detalha como configurar o OCI API Gateway para servir Micro Frontends (MFEs) via Object Storage.
## Arquitetura
```
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
│ Usuário │ ───► │ API Gateway │ ───► │ Object Storage │
│ (navegador) │ │ (URL pública) │ │ (PAR URL) │
└─────────────────┘ └──────────────────┘ └─────────────────┘
```
## Fluxo Completo
### 1. Criar Bucket no Object Storage
```bash
# Via OCI CLI
oci os bucket create \
--namespace-name "grbb7qzeuoag" \
--name "mfe-user-dev" \
--compartment-id "ocid1.compartment.oc1..xxx" \
--storage-tier "Standard"
```
### 2. Fazer Upload dos Arquivos
```bash
# Upload via OCI CLI
cd dist/mfe-user/browser/
find . -type f | while read file; do
oci os object put \
--namespace-name "grbb7qzeuoag" \
--bucket-name "nexus-mfe-user-dev" \
--file "$file" \
--object-name "${file#./}" \
--content-type auto
done
```
### 3. Criar Pre-Authenticated Request (PAR)
```bash
# Criar PAR para acesso público
oci os preauth-request create \
--namespace-name "grbb7qzeuoag" \
--bucket-name "nexus-mfe-user-dev" \
--name "mfe-user-par" \
--access-type "ObjectRead" \
--time-expiry 31536000
```
### 4. Criar API Gateway
```bash
# Verificar/criar subnet
oci network subnet list \
--compartment-id "compartment-ocid" \
--vcn-id "vcn-ocid"
# Criar API Gateway
oci api-gateway gateway create \
--compartment-id "compartment-ocid" \
--display-name "nexus-mfe-user-gateway" \
--subnet-id "subnet-ocid" \
--endpoint-type "PUBLIC"
```
### 5. Criar Deployment com Rotas
O deployment precisa de rotas específicas para SPAs (Angular):
```yaml
routes:
# Rota principal - tudo para index.html (SPA)
- path: /{req.*}
methods: [GET]
backend:
type: HTTP
url: "${PAR_URL}/${request.path[req]}"
# Arquivos estáticos específicos
- path: /{ext}.js
methods: [GET]
backend:
type: HTTP
url: "https://grbb7qzeuoag.objectstorage.sa-saopaulo-1.oci.customer-oci.com/n/grbb7qzeuoag/b/nexus-mfe-user-dev/o/${request.path[req]}"
- path: /{ext}.css
methods: [GET]
backend:
type: HTTP
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
### Módulo API Gateway
```hcl
module "api_gateway" {
source = "./modules/api_gateway"
compartment_id = var.compartment_id
subnet_id = var.subnet_id
name = "nexus-mfe-user"
environment = "dev"
}
module "api_gateway_deployment" {
source = "./modules/api_gateway_deployment"
gateway_id = module.api_gateway.gateway_id
bucket_name = "nexus-mfe-user-dev"
namespace = "grbb7qzeuoag"
region = "sa-saopaulo-1"
}
```
## Pipeline Azure DevOps - Fluxo
```
┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Build │ ─► │ Upload │ ─► │ CreatePAR │ ─► │ Deploy API │
│ (npm build)│ │ (OCI OS) │ │ (OCI) │ │ (Gateway) │
└─────────────┘ └─────────────┘ └─────────────┘ └─────────────┘
```
## URLs de Acesso
### Por Ambiente
| Ambiente | URL API Gateway |
|----------|----------------|
| Dev | `https://gateway-ocid.apigateway.sa-saopaulo-1.oci.customer-oci.com` |
| HML | `https://gateway-ocid.apigateway.sa-saopaulo-1.oci.customer-oci.com` |
| PROD | `https://gateway-ocid.apigateway.sa-saopaulo-1.oci.customer-oci.com` |
## Troubleshooting
### Problema: Arquivos não carregam
1. Verificar se PAR está ativa
2. Verificar tipos de conteúdo (content-type)
3. Verificar rotas no deployment
### Problema: SPA routing não funciona
1. Garantir rota catch-all `/{req.*}`
2. Backend deve resolver para index.html
### Problema: 403 Forbidden
1. Verificar se PAR não expirou
2. Verificar se bucket está público ou PAR está válida
## Comandos Úteis
```bash
# Listar API Gateways
oci api-gateway gateway list --compartment-id <compartment-id>
# Ver deployment
oci api-gateway deployment get --deployment-id <deployment-id>
# Atualizar deployment
oci api-gateway deployment update \
--deployment-id <deployment-id> \
--spec file://deployment-spec.yaml
# Listar PARs
oci os preauth-request list \
--namespace-name "grbb7qzeuoag" \
--bucket-name "nexus-mfe-user-dev"
# Deletar PAR
oci os preauth-request delete \
--namespace-name "grbb7qzeuoag" \
--bucket-name "nexus-mfe-user-dev" \
--par-id <par-id>
```
## Referências
- [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)

191
OCI-MFE-STEPBYSTEP.md Normal file
View file

@ -0,0 +1,191 @@
# Passo a Passo: Deploy mfe-user para OCI
## Visão Geral
Este guia mostra como fazer o deploy do **mfe-user** (Micro Frontend) para a OCI usando:
- **Object Storage** para arquivos estáticos
- **API Gateway** para servir o MFE
- **OCI CLI** via Azure DevOps
---
## Estado Atual da Infraestrutura
| Recurso | Status | Ação Necessária |
|---------|--------|-----------------|
| VCN (Dev) | ✅ Existe | Nenhuma |
| Subnet (sbn-lb-1) | ✅ Existe | Nenhuma |
| API Gateway | ❌ Não existe | Pipeline cria |
| Bucket | ❌ Não existe | Pipeline cria |
| PAR | ❌ Não existe | Pipeline cria |
---
## Passo 1: Configurar Variable Group
No Azure DevOps: **Project Settings****Pipelines****Library** → **Variable Groups**
### Variáveis necessárias no `oci-terraform`
| Variável | Tipo | Valor |
|----------|------|-------|
| `OCI_TENANCY_OCID` | Secret | OCID da tenancy |
| `OCI_USER_OCID` | Secret | OCID do usuário |
| `OCI_FINGERPRINT` | Secret | Fingerprint da chave |
| `OCI_PRIVATE_KEY_B64` | Secret | Chave privada (base64) |
| `OCI_REGION` | 普通 | `sa-saopaulo-1` |
| `COMPARTMENT_PARENT_OCID` | Secret | `ocid1.compartment.oc1..aaaaaaaa76x3nykkjwvctpr6px34dysu3pbg7p62h2r65fegt7fvbrioll3a` |
| `OCI_SUBNET_OCID` | Secret | `ocid1.subnet.oc1.sa-saopaulo-1.aaaaaaaa2ezw57uocis6s2eioypdsnt2p4pwm4fwnjz5jdaqigrm6jaqexeq` |
---
## Passo 2: Executar Pipeline
A pipeline cria automaticamente:
1. Bucket `mfe-user-dev` no Object Storage
2. Upload dos arquivos do build
3. Pre-Authenticated Request (PAR)
4. API Gateway com deployment
### Via Azure DevOps
1. Vá no repositório `mfe-user`
2. Faça push para branch `devops`
3. Execute a pipeline `azure-pipelines.yml`
4. Parâmetro `cloudProvider`: `oci`
### Fluxo da Pipeline
```
┌─────────────┐
│ BUILD │ → npm ci + npm run build:dev
└─────────────┘
┌─────────────┐
│ UPLOAD │ → Upload para OCI Object Storage
│ (OCI) │ Bucket: mfe-user-dev
└─────────────┘
┌─────────────┐
│ CREATEPAR │ → Cria Pre-Authenticated Request
└─────────────┘
┌─────────────┐
│ DEPLOY API │ → Cria/Atualiza API Gateway
│ GATEWAY │ Gateway: mfe-user-gateway
└─────────────┘
```
---
## Passo 3: Obter URL do API Gateway
```bash
oci api-gateway gateway list \
--compartment-id "ocid1.compartment.oc1..aaaaaaaa76x3nykkjwvctpr6px34dysu3pbg7p62h2r65fegt7fvbrioll3a"
```
URL: `https://<gateway-ocid>.apigateway.sa-saopaulo-1.oci.customer-oci.com`
---
## Passo 4: Testar
Acesse no navegador:
```
https://<gateway-ocid>.apigateway.sa-saopaulo-1.oci.customer-oci.com/
```
---
## Ambientes
| Ambiente | Bucket | Subnet |
|----------|--------|--------|
| Dev | `mfe-user-dev` | sbn-lb-1 |
| HML | `mfe-user-hml` | (definir) |
| PROD | `mfe-user-prod` | (definir) |
---
## Troubleshooting
### O que acontece se disparar a pipeline sem configuração?
| Estágio | Se faltar configuração | Resultado |
|---------|------------------------|-----------|
| BUILD | - | ✅ Sempre funciona |
| UPLOADTOOCI | - | ✅ Bucket criado automaticamente |
| CREATEPAR | - | ✅ PAR criado automaticamente |
| DEPLOYTOAPIGW | `OCI_SUBNET_OCID` não configurado | ❌ ERRO |
| DEPLOYTOAPIGW | Subnet não existe | ❌ ERRO |
### Recursos Criados Automaticamente pela Pipeline
| Recurso | Criado Automaticamente? |
|---------|------------------------|
| Bucket `mfe-user-dev` | ✅ Sim |
| PAR `mfe-user-dev-par` | ✅ Sim |
| API Gateway `mfe-user-gateway` | ✅ Sim (se subnet existir) |
| Deployment `mfe-user-deployment` | ✅ Sim |
### Recursos Obrigatórios (devem existir antes)
| Recurso | Status Dev |
|---------|------------|
| VCN | ✅ Já existe |
| Subnet (sbn-lb-1) | ✅ Já existe |
| `OCI_SUBNET_OCID` no Variable Group | ❌ Precisa adicionar |
### Cenário: Disparar sem `OCI_SUBNET_OCID`
```
BUILD → ✅ Sucesso
UPLOADTOOCI → ✅ Sucesso (bucket criado)
CREATEPAR → ✅ Sucesso (PAR criado)
DEPLOYTOAPIGW → ❌ ERRO: subnet não encontrada
```
**Resultado**: Bucket e PAR criados, mas API Gateway falha.
**Solução**: Adicionar `OCI_SUBNET_OCID` e reexecutar a pipeline.
### Problemas Comuns
| Problema | Causa | Solução |
|----------|-------|---------|
| Pipeline falha no API Gateway | `OCI_SUBNET_OCID` não configurada | Adicionar no Variable Group |
| 403 Forbidden | PAR expirou | Executar pipeline novamente |
| Arquivos não carregam (404) | Rotas incorretas | Verificar rota `/{req.*}` |
---
## Comandos Úteis
```bash
# Listar buckets
oci os bucket list --compartment-id <compartment-id>
# Listar objetos no bucket
oci os object list --namespace-name "grbb7qzeuoag" --bucket-name "mfe-user-dev"
# Listar API Gateways
oci api-gateway gateway list --compartment-id <compartment-id>
# Ver deployment
oci api-gateway deployment get --deployment-id <deployment-id>
# Deletar PAR antigo
oci os preauth-request delete --namespace-name "grbb7qzeuoag" --bucket-name "mfe-user-dev" --par-id <par-id>
```
---
## Referências
- [OCI-MFE-TASKS.md](./OCI-MFE-TASKS.md)
- [OCI-API-GATEWAY.md](./OCI-API-GATEWAY.md)
- [Oracle Documentation](https://docs.oracle.com/en/learn/oci-api-gateway-web-hosting/index.html)

264
OCI-MFE-TASKS.md Normal file
View file

@ -0,0 +1,264 @@
# 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 (verificado em 2026-02-17)
### VCNs Existentes (Dev)
| Nome | CIDR | OCID |
|------|------|------|
| 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)
| Nome | CIDR | Tipo | OCID |
|------|------|------|------|
| sbn-workers-1 | 10.120.0.0/20 | Workers | `ocid1.subnet.oc1.sa-saopaulo-1.aaaaaaaazfomdghi4x4jpluyjooy7ajvsf5y57jq2xcqwf35guodkcn2wrwq` |
| sbn-workers-2 | 10.120.16.0/20 | Workers | `ocid1.subnet.oc1.sa-saopaulo-1.aaaaaaaahaqguwt67kzs2dad2vyz3zpjl5ac7ximeqg55gmsnd33c2qikija` |
| sbn-workers-3 | 10.120.32.0/20 | Workers | `ocid1.subnet.oc1.sa-saopaulo-1.aaaaaaaafzhmhvz2scr6sfsygixz2gjfnecggiirh3rvyhjcmfn3ohmohj6a` |
| sbn-lb-1 | 10.120.128.0/20 | Load Balancer | `ocid1.subnet.oc1.sa-saopaulo-1.aaaaaaaa2ezw57uocis6s2eioypdsnt2p4pwm4fwnjz5jdaqigrm6jaqexeq` |
| sbn-lb-2 | 10.120.144.0/20 | Load Balancer | `ocid1.subnet.oc1.sa-saopaulo-1.aaaaaaaav7qtnmgil2qdt3lz6fnqkdcbymjd2dtjjeyo6y7z3s2omq4uvcqa` |
### API Gateways
| Nome | Status |
|------|--------|
| - | ❌ Nenhum criado |
### Buckets (Object Storage)
| Nome | Status |
|------|--------|
| - | ❌ Nenhum criado |
---
## Recomendação: Usar Subnet Existente
Para o API Gateway, podemos usar a subnet de Load Balancer existente:
- **sbn-lb-1**: `ocid1.subnet.oc1.sa-saopaulo-1.aaaaaaaa2ezw57uocis6s2eioypdsnt2p4pwm4fwnjz5jdaqigrm6jaqexeq`
## Atividades Necessárias para Completar o Setup OCI
### 🔴 Crítico - Infraestrutura OCI
#### 1. Criar/Configurar VCN (Virtual Cloud 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
- **Descrição**: Cada API Gateway precisa de uma subnet dedicada
- **Status**: ❌ Variável `OCI_SUBNET_OCID` não existe no Variable Group
#### 3. Criar Variable Group `oci-terraform` no Azure DevOps
- **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 - Melhorias Necessárias
#### 4. Melhorar Routes do API Gateway (SPAs)
A pipeline atual usa rota única:
```yaml
routes:
- path: /{req.*}
methods: [GET]
backend:
type: HTTP
url: "${PAR_URL}"
```
**Problema**: Não funciona bem para SPAs (Angular) que precisam de:
- `/` → retorna `index.html`
- `/route1` → retorna `index.html` (SPA routing)
- `*.js` → retorna JavaScript
- `*.css` → retorna CSS
- `*.html` → retorna HTML
**Solução**: Implementar rotas múltiplas conforme documentação:
```yaml
routes:
# Rota default - index.html para SPA
- path: /{req.*}
methods: [GET]
backend:
type: HTTP
url: "${PAR_URL}/${request.path[req]}"
# Regras específicas por tipo de arquivo
- path: /{ext}.js
methods: [GET]
backend:
type: HTTP
url: "https://{namespace}.objectstorage.{region}.oci.customer-oci.com/n/{bucket}/o/${request.path[req]}"
# wildcard *.js, *.css, etc.
```
#### 5. Suporte a Múltiplos Ambientes
| Ambiente | Bucket | API Gateway |
|----------|--------|-------------|
| Dev | `nexus-{mfe}-dev` | `{mfe}-dev-gateway` |
| HML | `nexus-{mfe}-hml` | `{mfe}-hml-gateway` |
| PROD | `nexus-{mfe}-prod` | `{mfe}-prod-gateway` |
#### 6. Tratar Variáveis por Ambiente
```yaml
parameters:
- name: environment
type: string
values:
- dev
- hml
- prod
```
---
### 🟢 MFEs que Precisam de Pipeline OCI
| MFE | Pipeline AWS | Pipeline OCI | Prioridade |
|-----|--------------|-------------|------------|
| mfe-user | ✅ | ⚠️ Incompleta | Alta |
| mfe-shell | ✅ | ❌ Não existe | Alta |
| mfe-auth | ✅ | ❌ Não existe | Alta |
| mfe-person | ✅ | ❌ Não existe | Média |
| mfe-poc | ✅ | ❌ Não existe | Baixa |
| mfe-formalization | ❌ | ❌ Não existe | Baixa |
---
## 🔧 Variable Group `oci-terraform`
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.
### Variáveis Existentes (usadas pelo Terraform)
| Variável | Tipo | Descrição |
|----------|------|-----------|
| `OCI_TENANCY_OCID` | Secret | OCID da Tenancy OCI |
| `OCI_USER_OCID` | Secret | OCID do Usuário OCI |
| `OCI_FINGERPRINT` | Secret | Fingerprint da chave pública (~47 chars) |
| `OCI_PRIVATE_KEY_B64` | Secret | Chave privada (Base64 ou PEM) |
| `OCI_REGION` |普通 | Região OCI (ex: sa-saopaulo-1) |
| `COMPARTMENT_PARENT_OCID` | Secret | OCID do compartment pai |
### Variáveis FALTANDO para API Gateway (precisam ser adicionadas)
| Variável | Tipo | Descrição |
|----------|------|-----------|
| `OCI_SUBNET_OCID` | Secret | **OCID da Subnet** para API Gateway |
### 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
### Infraestrutura (Terraform)
- [x] VCN já existe (`vcn-oke` 10.120.0.0/16)
- [x] Subnets já existem (sbn-lb-1 pode ser usada para API Gateway)
- [ ] Criar subnet dedicada para API Gateway (opcional, pode usar sbn-lb-1)
- [ ] Adicionar `OCI_SUBNET_OCID` ao Variable Group `oci-terraform`
### Azure DevOps
- [ ] Adicionar `OCI_SUBNET_OCID` ao Variable Group `oci-terraform`
- **Valor sugerido**: `ocid1.subnet.oc1.sa-saopaulo-1.aaaaaaaa2ezw57uocis6s2eioypdsnt2p4pwm4fwnjz5jdaqigrm6jaqexeq` (sbn-lb-1)
- [ ] Criar pipelines para todos os MFEs
### Pipeline mfe-user
- [ ] Testar pipeline existente
- [ ] Corrigir rotas para SPA (Angular)
- [ ] Adicionar suporte a múltiplos ambientes (dev/hml/prod)
- [ ] Tratar fallback para index.html
### Novos MFEs (criar pipelines)
- [ ] mfe-shell → OCI
- [ ] mfe-auth → OCI
- [ ] mfe-person → OCI
- [ ] mfe-poc → OCI
- [ ] mfe-formalization → OCI + AWS (primeira pipeline)
---
## 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>
```
---
## Referências
- [Terraform OCI Clusters](../tf_oci_clusters/README.md)
- [OCI - Visão Geral](./OCI.md)
- [Terraform - Importação](./OCI-TERRAFORM.md)
- [API Gateway](./OCI-API-GATEWAY.md)

183
OCI-TERRAFORM.md Normal file
View file

@ -0,0 +1,183 @@
# Terraform OCI - Importação de Recursos
## Visão Geral
Este documento explica como importar recursos OCI criados manualmente (via console/CLI) para o Terraform.
## Por que Importar?
Recursos criados fora do Terraform podem ser gerenciados posteriormente com Terraform através da importação.
## Como Importar Recursos
### 1. Import via CLI
```bash
# Buckets
terraform import oci_objectstorage_bucket.bucket "compartment-ocid/bucket-name"
# API Gateway
terraform import oci_apigateway_gateway.gateway "gateway-ocid"
# API Gateway Deployment
terraform import oci_apigateway_deployment.deployment "gateway-ocid/deployment-ocid"
# VCN
terraform import oci_core_vcn.vcn "vcn-ocid"
# Subnet
terraform import oci_core_subnet.subnet "subnet-ocid"
# OKE Cluster
terraform import oci_containerengine_cluster.cluster "cluster-ocid"
# Load Balancer
terraform import oci_load_balancer_loadbalancer.lb "lb-ocid"
```
### 2. Estrutura do Código Terraform
#### Bucket
```hcl
resource "oci_objectstorage_bucket" "nexus_mfe_user_dev" {
# ID no formato: compartment-ocid/bucket-name
bucket_name = "nexus-mfe-user-dev"
compartment_id = var.compartment_id
namespace = "grbb7qzeuoag" # namespace OCI
storage_tier = "Standard"
# metadata = {}
}
```
#### API Gateway
```hcl
resource "oci_apigateway_gateway" "mfe_user_gateway" {
compartment_id = var.compartment_id
endpoint_type = "PUBLIC"
subnet_id = var.subnet_id
display_name = "nexus-mfe-user-gateway"
# certificate_id - opcional
timeouts {
create = "30m"
update = "30m"
delete = "30m"
}
}
```
#### API Gateway Deployment
```hcl
resource "oci_apigateway_deployment" "mfe_user_deployment" {
gateway_id = oci_apigateway_gateway.mfe_user_gateway.id
display_name = "nexus-mfe-user-deployment"
path_prefix = "/"
specification = jsonencode({
routes = [
{
path = "/{req.*}"
methods = ["GET"]
backend = {
type = "HTTP"
url = "https://namespace.objectstorage.region.oci.customer-oci.com/n/namespace/b/bucket/o"
}
}
]
})
}
```
## Pipeline de Import
Para importar recursos automaticamente via Azure DevOps:
```yaml
# azure-pipelines-import.yml
trigger: none
parameters:
- name: resourceType
type: string
displayName: Tipo de recurso
values:
- bucket
- api-gateway
- subnet
variables:
- group: oci-terraform
stages:
- stage: Import_Resource
jobs:
- job: Import
pool:
vmImage: ubuntu-latest
steps:
- task: Terraform@1
inputs:
provider: 'oci'
command: 'custom'
customCommand: 'import'
# Resource address no TF
resourceAddress: 'oci_objectstorage_bucket.bucket_name'
# ID do recurso no OCI
resourceId: '$(COMPARTMENT_ID)/bucket-name'
```
## Recursos que Podem Ser Importados
### Object Storage
| Recurso | Terraform Resource |
|---------|------------------|
| Bucket | `oci_objectstorage_bucket` |
| Object | `oci_objectstorage_object` |
| Pre-Auth Request | Não suportado (criar via pipeline) |
### API Gateway
| Recurso | Terraform Resource |
|---------|------------------|
| Gateway | `oci_apigateway_gateway` |
| Deployment | `oci_apigateway_deployment` |
### Networking
| Recurso | Terraform Resource |
|---------|------------------|
| VCN | `oci_core_vcn` |
| Subnet | `oci_core_subnet` |
| Security List | `oci_core_security_list` |
| Route Table | `oci_core_route_table` |
| Internet Gateway | `oci_core_internet_gateway` |
| NAT Gateway | `oci_core_nat_gateway` |
### Container Engine (OKE)
| Recurso | Terraform Resource |
|---------|------------------|
| Cluster | `oci_containerengine_cluster` |
| Node Pool | `oci_containerengine_node_pool` |
## Checklist de Importação
- [ ] Identificar recursos criados manualmente
- [ ] Criar código Terraform para o recurso
- [ ] Executar `terraform import`
- [ ] Executar `terraform plan` para validar
- [ ] Commit no repositório Terraform
## Referências
- [Terraform OCI Provider](https://registry.terraform.io/providers/hashicorp/oci/latest)
- [OCI CLI Import](https://docs.oracle.com/en-us/iaas/Content/Terraform/tf_import.htm)

200
OCI.md Normal file
View file

@ -0,0 +1,200 @@
# OCI - Oracle Cloud Infrastructure
Este documento documenta a configuração e deployments relacionados à Oracle Cloud Infrastructure (OCI) para os projetos **Invent Cloud** e **Nexus**.
## Projetos
### Invent Cloud
- **Empresa**: Invista
- **Projeto**: Invent Finance
- **Local**: `C:\dev\inventcloud\invent-finance\`
- **Repositório Azure DevOps**: Invent-finance
### Nexus (MFE - Micro Frontends)
- **Empresa**: Invista
- **Repositório Base**: `C:\dev\C:devrepos_mfe\`
- **Templates Pipeline**: `C:\dev\repos_mfe\azure-pipelines-templates\`
## Compartimentos OCI
| Ambiente | Compartment OCID |
|----------|------------------|
| Dev | `ocid1.compartment.oc1..aaaaaaaa76x3nykkjwvctpr6px34dysu3pbg7p62h2r65fegt7fvbrioll3a` |
| HML | `ocid1.compartment.oc1..aaaaaaaawc3hj6isbiibbiuokijw7le72ga3qa3qyblsdhrkj5gdygskzmwq` |
| PROD | `ocid1.compartment.oc1..aaaaaaaazjxk5dkwleol3hjq7huojevotvnjhvy5ngro4jtwcqx2fn2ujara` |
### Namespace OCI
- **Namespace**: `grbb7qzeuoag`
---
## Infraestrutura Existente (Dev)
### VCN - Virtual Cloud Network
| Nome | CIDR | OCID |
|------|------|------|
| vcn-oke | 10.120.0.0/16 | `ocid1.vcn.oc1.sa-saopaulo-1.amaaaaaasks3yliatayztbyd6doyk5oglrmrc57jekltu3xnnena6fvruwba` |
### Subnets
| Nome | CIDR | Tipo | OCID |
|------|------|------|------|
| sbn-lb-1 | 10.120.128.0/20 | Load Balancer | `ocid1.subnet.oc1.sa-saopaulo-1.aaaaaaaa2ezw57uocis6s2eioypdsnt2p4pwm4fwnjz5jdaqigrm6jaqexeq` |
| sbn-lb-2 | 10.120.144.0/20 | Load Balancer | `ocid1.subnet.oc1.sa-saopaulo-1.aaaaaaaav7qtnmgil2qdt3lz6fnqkdcbymjd2dtjjeyo6y7z3s2omq4uvcqa` |
| sbn-workers-1 | 10.120.0.0/20 | OKE Workers | `ocid1.subnet.oc1.sa-saopaulo-1.aaaaaaaazfomdghi4x4jpluyjooy7ajvsf5y57jq2xcqwf35guodkcn2wrwq` |
| sbn-workers-2 | 10.120.16.0/20 | OKE Workers | `ocid1.subnet.oc1.sa-saopaulo-1.aaaaaaaahaqguwt67kzs2dad2vyz3zpjl5ac7ximeqg55gmsnd33c2qikija` |
| sbn-workers-3 | 10.120.32.0/20 | OKE Workers | `ocid1.subnet.oc1.sa-saopaulo-1.aaaaaaaafzhmhvz2scr6sfsygixz2gjfnecggiirh3rvyhjcmfn3ohmohj6a` |
### Subnet para API Gateway
Usar **sbn-lb-1** para deploy do API Gateway:
```
OCI_SUBNET_OCID=ocid1.subnet.oc1.sa-saopaulo-1.aaaaaaaa2ezw57uocis6s2eioypdsnt2p4pwm4fwnjz5jdaqigrm6jaqexeq
```
---
## Buckets OCI
**Status**: ❌ Nenhum bucket criado ainda para MFEs
## API Gateways
**Status**: ❌ Nenhum API Gateway criado ainda
## API Gateways
**Status**: ❌ Nenhum API Gateway criado ainda.
## VCNs e Subnets (Dev)
### VCN Principal
- **Nome**: vcn-oke
- **CIDR**: 10.120.0.0/16
- **OCID**: `ocid1.vcn.oc1.sa-saopaulo-1.amaaaaaasks3yliatayztbyd6doyk5oglrmrc57jekltu3xnnena6fvruwba`
### Subnets Disponíveis
| Nome | CIDR | Uso | OCID |
|------|------|-----|------|
| sbn-lb-1 | 10.120.128.0/20 | Load Balancer (pode ser usada para API Gateway) | `ocid1.subnet.oc1.sa-saopaulo-1.aaaaaaaa2ezw57uocis6s2eioypdsnt2p4pwm4fwnjz5jdaqigrm6jaqexeq` |
| sbn-lb-2 | 10.120.144.0/20 | Load Balancer | `ocid1.subnet.oc1.sa-saopaulo-1.aaaaaaaav7qtnmgil2qdt3lz6fnqkdcbymjd2dtjjeyo6y7z3s2omq4uvcqa` |
| sbn-workers-1 | 10.120.0.0/20 | Workers OKE | `ocid1.subnet.oc1.sa-saopaulo-1.aaaaaaaazfomdghi4x4jpluyjooy7ajvsf5y57jq2xcqwf35guodkcn2wrwq` |
| sbn-workers-2 | 10.120.16.0/20 | Workers OKE | `ocid1.subnet.oc1.sa-saopaulo-1.aaaaaaaahaqguwt67kzs2dad2vyz3zpjl5ac7ximeqg55gmsnd33c2qikija` |
| sbn-workers-3 | 10.120.32.0/20 | Workers OKE | `ocid1.subnet.oc1.sa-saopaulo-1.aaaaaaaafzhmhvz2scr6sfsygixz2gjfnecggiirh3rvyhjcmfn3ohmohj6a` |
### Recomendação para API Gateway
Usar **sbn-lb-1** como subnet para o API Gateway:
```
OCI_SUBNET_OCID=ocid1.subnet.oc1.sa-saopaulo-1.aaaaaaaa2ezw57uocis6s2eioypdsnt2p4pwm4fwnjz5jdaqigrm6jaqexeq
```
### Comandos para verificar buckets
```bash
# Verificar namespace
oci os ns get
# Listar buckets (dev)
oci os bucket list --compartment-id "ocid1.compartment.oc1..aaaaaaaa76x3nykkjwvctpr6px34dysu3pbg7p62h2r65fegt7fvbrioll3a" --all
# Listar buckets (hml)
oci os bucket list --compartment-id "ocid1.compartment.oc1..aaaaaaaawc3hj6isbiibbiuokijw7le72ga3qa3qyblsdhrkj5gdygskzmwq" --all
# Listar buckets (prod)
oci os bucket list --compartment-id "ocid1.compartment.oc1..aaaaaaaazjxk5dkwleol3hjq7huojevotvnjhvy5ngro4jtwcqx2fn2ujara" --all
```
## MFEs - Micro Frontends
### Repositórios MFE
| Repositório | Branch Principal | Pipeline OCI |
|-------------|------------------|--------------|
| mfe-auth | dev/devops | ❌ Não |
| mfe-shell | dev/devops | ❌ Não |
| mfe-person | dev/devops | ❌ Não |
| mfe-poc | dev/devops | ❌ Não |
| mfe-user | dev/devops | ✅ Sim |
| mfe-formalization | dev | ❌ Sem pipeline |
### Pipeline OCI - mfe-user
**Arquivo**: `C:\dev\C:devrepos_mfe\mfe-user\azure-pipelines-oci.yml`
**Trigger**: Branch `devops`
**Estágios**:
1. **Build** - Compila o projeto Angular
2. **UploadToOCI** - Faz upload para OCI Object Storage (bucket: `nexus-mfe-user-dev`)
3. **CreatePAR** - Cria Pre-Authenticated Request (PAR)
4. **DeployToAPIGateway** - Faz deploy no OCI API Gateway
**Variable Groups Required**:
- `oci-terraform`
- `mfe-credentials`
**Bucket**: `nexus-mfe-user-dev` (ainda não criado)
**API Gateway**:
- Nome: `nexus-mfe-user-gateway`
- Deployment: `nexus-mfe-user-deployment`
### Pipeline AWS (Padrão) - mfe-user
**Arquivo**: `C:\dev\C:devrepos_mfe\mfe-user\azure-pipelines.yml`
**Trigger**: Branch `dev`
**Template**: `mfe/deploy-mfe.yaml@templates`
**Deploy**: S3/AWS (não OCI)
## MS-POC - Microservice POC
**Status**: ❌ **NÃO PUBLICADO EM OBJECT STORAGE**
O `ms-poc` está configurado no cluster Kubernetes (OKE) conforme `ingresses.yaml`, mas **NÃO foi publicado em nenhum Object Storage**.
### Ingressos ms-poc (Kubernetes)
```yaml
# Internal
- host: ms-poc.dev-01.interno.invista.com.br
namespace: nexus-services
# External
- host: ms-poc.dev.invista.com.br
namespace: nexus-services
```
### Próximos Passos para ms-poc
Para publicar no OCI Object Storage:
1. Criar bucket: `nexus-ms-poc-dev`
2. Criar pipeline Azure DevOps para build e upload
3. Configurar API Gateway ou usar OKE para deploy
## Clusters OKE (Oracle Kubernetes Engine)
### Clusters Disponíveis
| Ambiente | Cluster OCID |
|----------|--------------|
| Dev Cluster 1 | `ocid1.cluster.oc1.sa-saopaulo-1.aaaaaaaaxernqctehleyduukfuyfgcnmm6fuk5l4mkgdaocsdcobrewkvc3a` |
| Dev Cluster 2 | `ocid1.cluster.oc1.sa-saopaulo-1.aaaaaaaancdtl3rrcblzsifl6h3vguxhj5byqldtzakgg7tv5cifn2eknv6q` |
| Dev Cluster 3 | `ocid1.cluster.oc1.sa-saopaulo-1.aaaaaaaaxbelg5ztrdn3ca3tm5mohq363c5v6yhmjhbwlgyndcrszb62robq` |
| HML Cluster 1 | `ocid1.cluster.oc1.sa-saopaulo-1.aaaaaaaaf26wiaoq2arf66a6jfah3ywbuyreik5mvcdxazyz2cwmskgdnxja` |
| HML Cluster 2 | `ocid1.cluster.oc1.sa-saopaulo-1.aaaaaaaadquto7tpcrqx6k7i7bz5ufyxg7o423ekkbcagpy3tcx3w46e6rfa` |
| HML Cluster 3 | `ocid1.cluster.oc1.sa-saopaulo-1.aaaaaaaais3nc43lvmestqxmj2tvay4jva4eqihjf55mn72yvc5tbieh3qgq` |
| PROD Cluster 1 | `ocid1.cluster.oc1.sa-saopaulo-1.aaaaaaaasseprhgtgw7chdhrlo362vsqcmr3j6reeomvy6ahyc7geg5htaga` |
| PROD Cluster 2 | `ocid1.cluster.oc1.sa-saopaulo-1.aaaaaaaa4zzx3jxqsf2asqlvvvbfrmi3birowx4mrc4xcwjklc5wbegb6xea` |
| PROD Cluster 3 | `ocid1.cluster.oc1.sa-saopaulo-1.aaaaaaaalazuvvqgci4zd6b473mpbrpxhrznqp7i3an6kae62cuugdaohyra` |
## Referências
- Templates Pipeline: `C:\dev\repos_mfe\azure-pipelines-templates\`
- Infra Terraform: `C:\dev\tf_oci_clusters\`
- Clusters Config: `C:\dev\repos_mfe\azure-pipelines-templates\config\oke-clusters.json`

View file

@ -4,6 +4,47 @@ Este repositorio contem a documentacao e os manifestos de Infraestrutura como Co
## Estrutura do Projeto
### OCI - Oracle Cloud Infrastructure
Infraestrutura OCI para projetos **Invista** (Nexus, MFEs, MSs).
#### Documentação
| Documento | Descrição |
|-----------|-----------|
| [Visao Geral OCI](./OCI.md) | Configuracao, compartimentos, VCN, subnets |
| [Tarefas OCI - MFEs](./OCI-MFE-TASKS.md) | Checklist e atividades para MFEs |
| [Passo a Passo mfe-user](./OCI-MFE-STEPBYSTEP.md) | Guia de deploy do mfe-user |
| [Pipeline mfe-user](./MFE-USER-PIPELINE.md) | Como funciona a pipeline multi-cloud |
| [Terraform OCI](./OCI-TERRAFORM.md) | Importacao de recursos, melhores praticas |
| [API Gateway](./OCI-API-GATEWAY.md) | Configuracao para hosting de MFEs |
#### Estado Atual da Infraestrutura OCI
| Recurso | Status | Detalhes |
|---------|--------|----------|
| VCN (Dev) | ✅ Existe | `vcn-oke` - CIDR: 10.120.0.0/16 |
| Subnets (Dev) | ✅ Existe | 5 subnets (lb + workers) |
| API Gateways | ❌ Não existe | Pipeline cria automaticamente |
| Buckets | ❌ Não existe | Pipeline cria automaticamente |
#### Próximo Passo (Ação Necessária)
Adicionar no Azure DevOps Variable Group `oci-terraform`:
```
OCI_SUBNET_OCID = ocid1.subnet.oc1.sa-saopaulo-1.aaaaaaaa2ezw57uocis6s2eioypdsnt2p4pwm4fwnjz5jdaqigrm6jaqexeq
```
#### Quick Start - Deploy mfe-user para OCI
1. Adicionar `OCI_SUBNET_OCID` no Variable Group
2. Push código para branch `devops`
3. Executar pipeline com `cloudProvider = oci`
4. Acessar URL: `https://<gateway-id>.apigateway.sa-saopaulo-1.oci.customer-oci.com/`
---
### VPS (Virtual Private Servers)
Servidores standalone gerenciados individualmente.