docs(nexus): atualiza MFE-URLS com environment.dev.ts e logica do main.ts
Descobre e documenta environment.dev.ts como arquivo principal de URLs:
- federationManifest usa nexus-{name}-dev.invista.com.br (nao localhost)
- main.ts usa blob URL dinamico em dev, federation.manifest.json em prod
- apiUrls tem pocUrl, beltUrl, notificationUrl (nao documentados antes)
- mfe-formalization ausente no federationManifest atual
This commit is contained in:
parent
ea34eabf99
commit
1e4a1a9a08
1 changed files with 111 additions and 53 deletions
|
|
@ -1,17 +1,78 @@
|
|||
# MFE Shell — Configuração de Endereços
|
||||
|
||||
Referência rápida de onde ficam os endereços no `mfe-shell` (branch `devops`).
|
||||
Referência dos três arquivos onde ficam os endereços no `mfe-shell` (branch `devops`).
|
||||
|
||||
> Documentação completa: [`tf_oci_clusters/docs/mfe-architecture.md`](https://dev.azure.com/CN-Squad/Invista%20FIDC%20-%20Nexus/_git/tf_oci_clusters?path=/docs/mfe-architecture.md)
|
||||
|
||||
---
|
||||
|
||||
## 1. URLs dos MFEs remotos — `public/federation.manifest.json`
|
||||
## Como funciona (main.ts)
|
||||
|
||||
Arquivo: `mfe-shell/public/federation.manifest.json`
|
||||
O `main.ts` decide qual manifesto usar conforme o ambiente:
|
||||
|
||||
Este arquivo é lido em runtime pelo `main.ts` (`initFederation('federation.manifest.json')`).
|
||||
Diz ao shell onde encontrar o `remoteEntry.json` de cada MFE remoto.
|
||||
```typescript
|
||||
import { environment } from './environments/environment';
|
||||
|
||||
if (!environment.production) {
|
||||
// DEV: lê environment.federationManifest, cria blob URL dinâmico
|
||||
const blob = new Blob([JSON.stringify(environment.federationManifest)], { type: 'application/json' });
|
||||
initFederation(URL.createObjectURL(blob))...
|
||||
} else {
|
||||
// PROD: usa o arquivo estático
|
||||
initFederation('federation.manifest.json')...
|
||||
}
|
||||
```
|
||||
|
||||
| Build | Manifesto usado | Arquivo |
|
||||
|-------|----------------|---------|
|
||||
| `npm run build:dev` (produção = false) | `environment.federationManifest` | `src/environments/environment.dev.ts` |
|
||||
| `npm run build:prod` (produção = true) | arquivo estático | `public/federation.manifest.json` |
|
||||
|
||||
---
|
||||
|
||||
## 1. `src/environments/environment.dev.ts` — Arquivo principal (build DEV)
|
||||
|
||||
É aqui que ficam as URLs reais usadas no deploy OCI (build `npm run build:dev`).
|
||||
|
||||
```typescript
|
||||
export const environment = {
|
||||
production: false,
|
||||
development: true,
|
||||
|
||||
// URLs dos MFEs remotos (federation)
|
||||
federationManifest: {
|
||||
'mfe-auth': 'https://nexus-auth-dev.invista.com.br/remoteEntry.json',
|
||||
'mfe-user': 'https://nexus-user-dev.invista.com.br/remoteEntry.json',
|
||||
'mfe-person': 'https://nexus-person-dev.invista.com.br/remoteEntry.json',
|
||||
'mfe-poc': 'https://nexus-poc-dev.invista.com.br/remoteEntry.json'
|
||||
},
|
||||
|
||||
// URLs das APIs backend
|
||||
apiUrls: {
|
||||
baseUrl: 'https://llbywpgzxj.execute-api.us-east-2.amazonaws.com/dev/api',
|
||||
authUrl: 'https://llbywpgzxj.execute-api.us-east-2.amazonaws.com/dev/api/auth',
|
||||
userUrl: 'https://04fy406qme.execute-api.us-east-2.amazonaws.com/dev/api/user',
|
||||
personUrl: 'https://qfmruzhrlj.execute-api.us-east-2.amazonaws.com/dev/api/person',
|
||||
userExternalUrl: 'https://04fy406qme.execute-api.us-east-2.amazonaws.com/dev/api/user-external',
|
||||
ssoUrl: 'https://n7u24ds9cg.execute-api.us-east-2.amazonaws.com/dev/api/sso/Auth',
|
||||
pocUrl: 'https://pd98177mna.execute-api.us-east-2.amazonaws.com/dev/api/poc',
|
||||
beltUrl: 'https://yxnupsrqx5.execute-api.us-east-2.amazonaws.com/dev/api/belt',
|
||||
notificationUrl: 'https://z2yz9ykvtd.execute-api.us-east-2.amazonaws.com/dev/api/notification'
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
**Observações:**
|
||||
- `federationManifest`: aponta para `nexus-{name}-dev.invista.com.br` — domínios Cloudflare
|
||||
- `apiUrls`: ainda apontam para **AWS API Gateway** (us-east-2) — pendente migração OCI
|
||||
- `mfe-formalization` **não está** no federationManifest (não tem rota no shell ainda)
|
||||
|
||||
---
|
||||
|
||||
## 2. `public/federation.manifest.json` — Manifesto estático (build PROD)
|
||||
|
||||
Usado apenas em builds de produção (`environment.production = true`).
|
||||
Atualmente aponta para localhost (desenvolvimento local).
|
||||
|
||||
```json
|
||||
{
|
||||
|
|
@ -21,29 +82,14 @@ Diz ao shell onde encontrar o `remoteEntry.json` de cada MFE remoto.
|
|||
}
|
||||
```
|
||||
|
||||
> **Estado atual:** aponta para `localhost` (desenvolvimento local).
|
||||
> **Em OCI/produção deve apontar para:** os buckets Object Storage de cada MFE.
|
||||
|
||||
**URLs OCI corretas (a aplicar):**
|
||||
|
||||
```json
|
||||
{
|
||||
"mfe-auth": "https://objectstorage.sa-saopaulo-1.oraclecloud.com/n/grbb7qzeuoag/b/mfe-auth-dev/o/remoteEntry.json",
|
||||
"mfe-user": "https://objectstorage.sa-saopaulo-1.oraclecloud.com/n/grbb7qzeuoag/b/mfe-user-dev/o/remoteEntry.json",
|
||||
"mfe-person": "https://objectstorage.sa-saopaulo-1.oraclecloud.com/n/grbb7qzeuoag/b/mfe-person-dev/o/remoteEntry.json",
|
||||
"mfe-formalization": "https://objectstorage.sa-saopaulo-1.oraclecloud.com/n/grbb7qzeuoag/b/mfe-formalization-dev/o/remoteEntry.json",
|
||||
"mfe-poc": "https://objectstorage.sa-saopaulo-1.oraclecloud.com/n/grbb7qzeuoag/b/mfe-poc-dev/o/remoteEntry.json"
|
||||
}
|
||||
```
|
||||
> **Atenção:** Este arquivo **não é usado no deploy OCI atual** (build:dev).
|
||||
> Precisa ser atualizado antes de ter um build de produção funcional.
|
||||
|
||||
---
|
||||
|
||||
## 2. URLs das APIs backend — `src/app/core/config/environment.service.ts`
|
||||
## 3. `src/app/core/config/environment.service.ts` — Serviço exposto via federation
|
||||
|
||||
Arquivo: `mfe-shell/src/app/core/config/environment.service.ts`
|
||||
|
||||
Este serviço é **exposto via federation** (`./EnvironmentService`) para que todos os MFEs remotos
|
||||
consumam as URLs de API sem precisar defini-las individualmente.
|
||||
Exposto para todos os MFEs remotos via `./EnvironmentService`. Os remotes consomem as URLs de API daqui.
|
||||
|
||||
```typescript
|
||||
private config: AppConfig = {
|
||||
|
|
@ -59,43 +105,55 @@ private config: AppConfig = {
|
|||
};
|
||||
```
|
||||
|
||||
> **Estado atual:** aponta para **AWS API Gateway** (us-east-2) — legado.
|
||||
> **Pendente:** migrar para `api-gateway-nexus-dev` (OCI, 10.6.0.123).
|
||||
|
||||
**URLs OCI corretas (a aplicar):**
|
||||
|
||||
| Chave | URL OCI |
|
||||
|-------|---------|
|
||||
| `baseUrl` | `https://api-dev.invista.com.br/api` |
|
||||
| `authUrl` | `https://api-dev.invista.com.br/api/auth` |
|
||||
| `userUrl` | `https://api-dev.invista.com.br/api/user` |
|
||||
| `personUrl` | `https://api-dev.invista.com.br/api/person` |
|
||||
| `userExternalUrl` | `https://api-dev.invista.com.br/api/user-external` |
|
||||
| `ssoUrl` | `https://api-dev.invista.com.br/api/sso/Auth` |
|
||||
|
||||
> O domínio `api-dev.invista.com.br` é roteado via Cloudflare → LB Test_Crivo_Dev → api-gateway-nexus-dev.
|
||||
> Valores idênticos ao `environment.dev.ts > apiUrls` (AWS). Provavelmente deve ser refatorado para ler de `environment`.
|
||||
|
||||
---
|
||||
|
||||
## 3. Onde cada MFE usa esses endereços
|
||||
## Resumo: o que mudar para OCI
|
||||
|
||||
| MFE | federation.manifest.json | EnvironmentService |
|
||||
|-----|--------------------------|--------------------|
|
||||
| `mfe-auth` | `remoteEntry.json` do bucket `mfe-auth-dev` | `authUrl`, `ssoUrl` |
|
||||
| `mfe-user` | `remoteEntry.json` do bucket `mfe-user-dev` | `userUrl`, `userExternalUrl` |
|
||||
| `mfe-person` | `remoteEntry.json` do bucket `mfe-person-dev` | `personUrl` |
|
||||
| `mfe-formalization` | `remoteEntry.json` do bucket `mfe-formalization-dev` | `baseUrl` |
|
||||
| `mfe-poc` | `remoteEntry.json` do bucket `mfe-poc-dev` | `baseUrl` |
|
||||
### federationManifest (environment.dev.ts)
|
||||
|
||||
As URLs `nexus-{name}-dev.invista.com.br` precisam resolver para os buckets OCI.
|
||||
Opção A — DNS Cloudflare apontando para API Gateway MFE:
|
||||
|
||||
```typescript
|
||||
federationManifest: {
|
||||
'mfe-auth': 'https://mfe-auth-dev.invista.com.br/remoteEntry.json',
|
||||
'mfe-user': 'https://mfe-user-dev.invista.com.br/remoteEntry.json',
|
||||
'mfe-person': 'https://mfe-person-dev.invista.com.br/remoteEntry.json',
|
||||
'mfe-formalization': 'https://mfe-formalization-dev.invista.com.br/remoteEntry.json',
|
||||
'mfe-poc': 'https://mfe-poc-dev.invista.com.br/remoteEntry.json'
|
||||
}
|
||||
```
|
||||
|
||||
Opção B — URL direta Object Storage (sem DNS):
|
||||
|
||||
```typescript
|
||||
'mfe-auth': 'https://objectstorage.sa-saopaulo-1.oraclecloud.com/n/grbb7qzeuoag/b/mfe-auth-dev/o/remoteEntry.json'
|
||||
```
|
||||
|
||||
### apiUrls (environment.dev.ts + EnvironmentService)
|
||||
|
||||
Substituir todos os domínios `*.execute-api.us-east-2.amazonaws.com` por:
|
||||
|
||||
```
|
||||
https://api-dev.invista.com.br/api/*
|
||||
```
|
||||
|
||||
(Cloudflare → LB Test_Crivo_Dev → api-gateway-nexus-dev, já funcional)
|
||||
|
||||
---
|
||||
|
||||
## 4. Pendências para funcionar em OCI
|
||||
## Checklist de pendências
|
||||
|
||||
- [ ] Atualizar `public/federation.manifest.json` com URLs OCI dos remotes
|
||||
- [ ] Atualizar `environment.service.ts` com URLs do `api-gateway-nexus-dev` (OCI)
|
||||
- [ ] Configurar DNS Cloudflare: `mfe-*.invista.com.br` e `api-dev.invista.com.br`
|
||||
- [ ] VCN peering: vcn-oke ↔ DRG-Invista-Shared (para LB acessar API Gateway MFE)
|
||||
- [ ] Adicionar `mfe-formalization` ao `federationManifest` em `environment.dev.ts`
|
||||
- [ ] Atualizar domínios do `federationManifest`: `nexus-{name}-dev` → `mfe-{name}-dev` (ou URL OCI direta)
|
||||
- [ ] Migrar `apiUrls` de AWS para OCI (`api-dev.invista.com.br`)
|
||||
- [ ] Migrar `EnvironmentService` para ler de `environment.apiUrls` (evitar duplicação)
|
||||
- [ ] Atualizar `public/federation.manifest.json` para build de produção
|
||||
- [ ] DNS Cloudflare: `mfe-{name}-dev.invista.com.br` + `api-dev.invista.com.br`
|
||||
- [ ] VCN peering vcn-oke ↔ DRG-Invista-Shared
|
||||
|
||||
---
|
||||
|
||||
*Atualizado em: 2026-03-01 | Leitura direta do repo mfe-shell (branch devops, Azure DevOps)*
|
||||
*Atualizado em: 2026-03-01 | Leitura direta do repo mfe-shell (branch devops)*
|
||||
|
|
|
|||
Loading…
Reference in a new issue