diff --git a/README.md b/README.md index 6ee8e22..ec7227c 100644 --- a/README.md +++ b/README.md @@ -4,46 +4,10 @@ Este repositorio contem a documentacao e os manifestos de Infraestrutura como Co ## Estrutura do Projeto -### OCI - Oracle Cloud Infrastructure +### Empresas e Projetos -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://.apigateway.sa-saopaulo-1.oci.customer-oci.com/` - ---- +- [**InventCloud**](./inventcloud/README.md) + - [Invista FIDC - Nexus](./inventcloud/invista/nexus/README.md): Microservicos e cluster OCI OKE ### VPS (Virtual Private Servers) @@ -64,11 +28,6 @@ Bancos de dados gerenciados. - [**Guia de Conexoes**](./CONNECTIONS.md): Cloudflare, GitHub, Coolify, SSH Keys, etc. - [**Credenciais**](./credentials/): Backup local das credenciais SSH e tokens -### Azure DevOps - -- [**Azure DevOps**](./azure-devops/CONNECTION.md): CN-Squad Organization -- [**OCI**](./azure-devops/OCI-CONNECTION.md): Oracle Cloud Infrastructure - ### Containers Definicoes de containers compartilhados entre servidores. diff --git a/inventcloud/README.md b/inventcloud/README.md new file mode 100644 index 0000000..9c99262 --- /dev/null +++ b/inventcloud/README.md @@ -0,0 +1,27 @@ +# InventCloud + +Empresa de tecnologia e infraestrutura cloud. + +## Projetos + +### Invista FIDC + +- [**Nexus**](./invista/nexus/README.md): Plataforma de microservicos para gestao de fundos + +## Cluster Kubernetes OCI OKE + +Cluster principal hospedado na Oracle Cloud Infrastructure. + +| Propriedade | Valor | +|-------------|-------| +| Provider | Oracle Cloud Infrastructure | +| Servico | OKE (Oracle Kubernetes Engine) | +| Region | sa-saopaulo-1 | +| API Server | https://136.248.124.22:6443 | +| Versao | v1.34.1 | +| Nodes | 3 | + +## Documentacao + +- [Conexoes e Credenciais](./CONNECTIONS.md) +- [Historico de Operacoes](./invista/nexus/OPERATIONS.md) diff --git a/inventcloud/invista/README.md b/inventcloud/invista/README.md new file mode 100644 index 0000000..668dae8 --- /dev/null +++ b/inventcloud/invista/README.md @@ -0,0 +1,25 @@ +# Invista FIDC + +Projeto de gestao de fundos de investimento. + +## Projetos + +- [**Nexus**](./nexus/README.md): Plataforma de microservicos + +## Cluster OCI OKE + +Cluster Kubernetes gerenciado na Oracle Cloud Infrastructure. + +| Propriedade | Valor | +|-------------|-------| +| API Server | https://136.248.124.22:6443 | +| Versao K8s | v1.34.1 | +| Nodes | 3 | +| Region | sa-saopaulo-1 | +| Registry | gru.ocir.io/grbb7qzeuoag | + +## Documentacao + +- [Historico de Operacoes](./nexus/OPERATIONS.md) +- [Azure DevOps](./nexus/azure-devops/CONNECTION.md) +- [OCI Connection](./nexus/azure-devops/OCI-CONNECTION.md) diff --git a/inventcloud/invista/nexus/CONNECTIONS.md b/inventcloud/invista/nexus/CONNECTIONS.md new file mode 100644 index 0000000..981b3fb --- /dev/null +++ b/inventcloud/invista/nexus/CONNECTIONS.md @@ -0,0 +1,64 @@ +# Conexoes - Nexus + +Conexoes e credenciais do projeto Nexus. + +## Cluster OCI OKE + +### Acesso kubectl + +```bash +# Verificar contexto +kubectl config get-contexts + +# Info do cluster +kubectl cluster-info +# API Server: https://136.248.124.22:6443 +``` + +### Nodes + +| Node | IP | Status | +|------|----|----| +| 10.110.10.16 | 10.110.10.16 | Ready | +| 10.110.15.40 | 10.110.15.40 | Ready | +| 10.110.2.160 | 10.110.2.160 | Ready | + +## Registry OCI + +| Propriedade | Valor | +|-------------|-------| +| Registry | gru.ocir.io/grbb7qzeuoag | +| Auth | Secret `ocir-regcred` | + +### Secrets no Kubernetes + +| Secret | Namespace | Tipo | +|--------|-----------|------| +| ocir-regcred | nexus-services | dockerconfigjson | +| oci-credentials | nexus-services | Opaque | + +## Namespaces + +| Namespace | Descricao | +|-----------|-----------| +| nexus-services | Microservicos principais | +| integration-hub | Integracoes | +| stream | NATS messaging | +| argocd | GitOps | +| ingress-nginx | Ingress controller | + +## Comandos Uteis + +```bash +# Listar pods +kubectl get pods -n nexus-services + +# Logs de um pod +kubectl logs -n nexus-services --tail=100 + +# Rollback deployment +kubectl rollout undo deployment/ -n nexus-services + +# Scale down replicaset quebrado +kubectl scale replicaset -n nexus-services --replicas=0 +``` diff --git a/inventcloud/invista/nexus/OPERATIONS.md b/inventcloud/invista/nexus/OPERATIONS.md new file mode 100644 index 0000000..24f27b4 --- /dev/null +++ b/inventcloud/invista/nexus/OPERATIONS.md @@ -0,0 +1,172 @@ +# Historico de Operacoes - Infracloud + +Registro de operacoes e incidentes na infraestrutura. + +--- + +## 2026-02-18 - Conexao Cluster OCI OKE e Troubleshooting + +### Contexto + +Usuario solicitou conexao ao cluster Kubernetes OCI OKE para verificar mudancas de commits e investigar problemas. + +### Ferramentas Utilizadas + +| Ferramenta | Versao | Localizacao | +|------------|--------|-------------| +| OCI CLI | 3.73.2 | C:\oci\bin\oci.exe | +| kubectl | v1.31.0 | C:\oci\bin\kubectl.exe | +| Git | - | C:\dev\infracloud | + +### Passos Realizados + +#### 1. Sincronizacao do Repositorio infracloud + +```bash +# Local: C:\dev\infracloud + +# Verificar commits de ontem +git log --oneline --since="yesterday" + +# Commits encontrados: +# 26ce1f6 - docs: add mfe repos URLs to Azure DevOps connection docs +# 8379e6b - Add OCI and K3s cluster connection documentation +# fa2ff35 - Add Azure DevOps connection documentation + +# Stash de mudancas locais (README.md modificado) +git stash + +# Pull do remote +git pull +# Resultado: 25 arquivos atualizados, 1564 remocoes, 729 adicoes + +# Resolver conflitos de merge no README.md +# Mescladas secoes: OCI + Conexoes + Azure DevOps + +# Commit e push +git add -A +git commit -m "docs: add OCI documentation and resolve merge conflicts" +git push +# Commit: 3a615e1 +``` + +#### 2. Conexao ao Cluster OCI OKE + +O cluster ja estava configurado no kubeconfig local. + +```bash +# Verificar contexto atual +kubectl config get-contexts +# Contexto: context-cobrewkvc3a + +# Informacoes do cluster +kubectl cluster-info +# API Server: https://136.248.124.22:6443 +``` + +**Cluster OCI OKE:** +| Propriedade | Valor | +|-------------|-------| +| API Server | https://136.248.124.22:6443 | +| Versao K8s | v1.34.1 | +| Nodes | 3 (10.110.10.16, 10.110.15.40, 10.110.2.160) | +| CNI | Flannel | + +#### 3. Investigacao de Pods com Problema + +**Estado inicial:** + +```bash +kubectl get pods -A +``` + +| Namespace | Pod | Status | +|-----------|-----|--------| +| nexus-services | ms-auth-external-57f96d6d9d-7ksmr | CrashLoopBackOff | +| nexus-services | ms-parameters-666cd67f5-g9dh4 | CrashLoopBackOff | +| stream | nats-0 | ImagePullBackOff | +| default | dnscheck-* (varios) | Error | + +**Diagnostico detalhado:** + +```bash +# ms-auth-external +kubectl describe pod ms-auth-external-57f96d6d9d-7ksmr -n nexus-services +kubectl logs ms-auth-external-57f96d6d9d-7ksmr -n nexus-services --tail=50 + +# Erro: IAmazonCognitoIdentityProvider nao registrado +# Exit Code: 139 (SIGSEGV - Segmentation Fault) +# Causa: Nova versao da imagem :5744 sem configuracao AWS Cognito +``` + +```bash +# ms-parameters +kubectl describe pod ms-parameters-666cd67f5-g9dh4 -n nexus-services +kubectl logs ms-parameters-666cd67f5-g9dh4 -n nexus-services --tail=50 + +# Erro: Could not find a part of the path '/root/.oci/config' +# Exit Code: 139 (SIGSEGV) +# Causa: Nova versao da imagem :5474 sem configuracao OCI +``` + +```bash +# nats-0 +kubectl describe pod nats-0 -n stream + +# Erro: ImagePullBackOff +# Imagem: gru.ocir.io/grbb7qzeuoag/ms-auth-external/nats:5563 +# Causa: Imagem nao existe no registry OCI +``` + +#### 4. Acao Corretiva - Rollback + +A causa raiz foi deploy da branch `devops` com imagens quebradas. + +**Rollback executado:** + +```bash +# Rollback dos deployments +kubectl rollout undo deployment/ms-auth-external -n nexus-services +kubectl rollout undo deployment/ms-parameters -n nexus-services + +# Scale down replicasets quebrados +kubectl scale replicaset \ + ms-auth-external-796b45cb94 \ + ms-auth-external-57f96d6d9d \ + ms-parameters-666cd67f5 \ + ms-parameters-9d5b74747 \ + -n nexus-services --replicas=0 +``` + +**Resultado:** + +| Deployment | Replicaset | Imagem | Status | +|------------|------------|--------|--------| +| ms-auth-external | 5bb9fd69b5 | :5744 (versao estavel) | 2/2 Running | +| ms-parameters | 56c86b75 | :5474 (versao estavel) | 2/2 Running | + +### Licoes Aprendidas + +1. **Branch devops** esta fazendo deploy automatico de imagens sem testes adequados +2. **ms-auth-external** requer configuracao AWS Cognito (`IAmazonCognitoIdentityProvider`) +3. **ms-parameters** requer arquivo `/root/.oci/config` ou variaveis de ambiente OCI +4. **nats-0** precisa de imagem correta no registry OCI + +### Acoes Futuras Recomendadas + +- [ ] Implementar testes de healthcheck antes do deploy +- [ ] Adicionar gate de aprovacao na pipeline da branch devops +- [ ] Corrigir imagem do NATS no registry OCI +- [ ] Configurar AWS Cognito no ms-auth-external (se necessario) +- [ ] Configurar secrets OCI para ms-parameters + +--- + +## Referencias + +- [CONNECTIONS.md](./CONNECTIONS.md) - Credenciais e conexoes +- [azure-devops/OCI-CONNECTION.md](./azure-devops/OCI-CONNECTION.md) - Configuracao OCI + +--- + +*Documento atualizado em: 2026-02-18* diff --git a/inventcloud/invista/nexus/README.md b/inventcloud/invista/nexus/README.md new file mode 100644 index 0000000..1f5a65f --- /dev/null +++ b/inventcloud/invista/nexus/README.md @@ -0,0 +1,49 @@ +# Nexus - Invista FIDC + +Microservicos e infraestrutura do projeto Nexus para Invista FIDC. + +## Estrutura + +``` +nexus/ +├── README.md # Este arquivo +├── OPERATIONS.md # Historico de operacoes e incidentes +├── CONNECTIONS.md # Conexoes e credenciais +└── azure-devops/ + ├── CONNECTION.md # Azure DevOps CN-Squad + └── OCI-CONNECTION.md # Oracle Cloud Infrastructure +``` + +## Cluster OCI OKE + +| Propriedade | Valor | +|-------------|-------| +| API Server | https://136.248.124.22:6443 | +| Versao K8s | v1.34.1 | +| Nodes | 3 | +| Region | sa-saopaulo-1 | +| Registry | gru.ocir.io/grbb7qzeuoag | + +## Microservicos + +| Servico | Namespace | Status | +|---------|-----------|--------| +| ms-auth-external | nexus-services | Running | +| ms-auth-sso | nexus-services | Running | +| ms-parameters | nexus-services | Running | +| ms-belt | nexus-services | Running | +| ms-notify | nexus-services | Running | +| ms-person | nexus-services | Running | +| ms-user | nexus-services | Running | +| ms-poc | nexus-services | Running | + +## Documentacao + +- [Historico de Operacoes](./OPERATIONS.md) +- [Conexoes e Credenciais](./CONNECTIONS.md) +- [Azure DevOps](./azure-devops/CONNECTION.md) +- [OCI Connection](./azure-devops/OCI-CONNECTION.md) + +--- + +*Projeto InventCloud - Invista FIDC* diff --git a/inventcloud/invista/nexus/azure-devops/CONNECTION.md b/inventcloud/invista/nexus/azure-devops/CONNECTION.md new file mode 100644 index 0000000..0d14e9e --- /dev/null +++ b/inventcloud/invista/nexus/azure-devops/CONNECTION.md @@ -0,0 +1,128 @@ +# Azure DevOps - Configuração de Conexão + +## Visão Geral + +Este documento descreve a configuração de acesso ao Azure DevOps da organização **CN-Squad** (Projeto: Invista FIDC - Nexus). + +## Credenciais e Configurações + +### Arquivo de Configuração SSH +**Localização:** `C:\Users\TiagoRibeiro\.ssh\config` + +``` +Host azure-devops + HostName ssh.dev.azure.com + User git + IdentityFile ~/.ssh/ic-ad + IdentitiesOnly yes + AddKeysToAgent yes +``` + +### Arquivo de Autenticação +**Localização:** `C:\Users\TiagoRibeiro\.ssh\azure_devops_auth.json` + +```json +{ + "organization": "CN-Squad", + "project": "Invista FIDC - Nexus", + "pat": "3t5wWZ3hXtj899rImLoei2STZ5Mp1LecfInf5qbxWE6j22UUVIltJQQJ99CBACAAAAAamI5kAAASAZDO2gOJ" +} +``` + +### Chave SSH +- **Chave Pública:** `C:\Users\TiagoRibeiro\.ssh\ic-ad.pub` +- **Chave Privada:** `C:\Users\TiagoRibeiro\.ssh\ic-ad` +- **Email:** tiago.ribeiro@inventcloud.com.br + +## Métodos de Conexão + +### 1. HTTPS com PAT (Funcionando) +```bash +# Listar projetos +curl -u "tiago.ribeiro:" "https://dev.azure.com/CN-Squad/_apis/projects?api-version=7.0" + +# Listar repositórios +curl -u "tiago.ribeiro:" "https://dev.azure.com/CN-Squad/Invista%20FIDC%20-%20Nexus/_apis/git/repositories?api-version=7.0" + +# Clonar repositório +git clone https://tiago.ribeiro:@dev.azure.com/CN-Squad/Invista%20FIDC%20-%20Nexus/_git/ +``` + +### 2. SSH (Não funcionando) +```bash +# Testar conexão SSH +ssh -T git@ssh.dev.azure.com + +# Resultado: Permission denied (publickey) +``` + +**Problema:** A chave pública SSH não está registada no Azure DevOps. + +**Solução:** Adicionar a chave pública em: +- Azure DevOps → User Settings → SSH public keys +- Adicionar conteúdo de `ic-ad.pub` + +## Repositórios Disponíveis + +Total: **49 repositórios** + +### Repositórios de Infraestrutura +| Nome | URL | +|------|-----| +| tf_oci_clusters | https://dev.azure.com/CN-Squad/Invista%20FIDC%20-%20Nexus/_git/tf_oci_clusters | +| nats-k8s-config | https://dev.azure.com/CN-Squad/Invista%20FIDC%20-%20Nexus/_git/nats-k8s-config | +| o11y-adot | https://dev.azure.com/CN-Squad/Invista%20FIDC%20-%20Nexus/_git/o11y-adot | +| o11y-grafana | https://dev.azure.com/CN-Squad/Invista%20FIDC%20-%20Nexus/_git/o11y-grafana | +| o11y-jaeger | https://dev.azure.com/CN-Squad/Invista%20FIDC%20-%20Nexus/_git/o11y-jaeger | +| o11y-victoria-logs | https://dev.azure.com/CN-Squad/Invista%20FIDC%20-%20Nexus/_git/o11y-victoria-logs | +| o11y-victoria-metrics | https://dev.azure.com/CN-Squad/Invista%20FIDC%20-%20Nexus/_git/o11y-victoria-metrics | +| azure-pipelines-templates | https://dev.azure.com/CN-Squad/Invista%20FIDC%20-%20Nexus/_git/azure-pipelines-templates | +| database | https://dev.azure.com/CN-Squad/Invista%20FIDC%20-%20Nexus/_git/database | + +### Microservices (ms-*) +- ms-auth-external +- ms-auth-sso +- ms-barramento +- ms-belt +- ms-notify +- ms-parameters +- ms-person +- ms-poc +- ms-user + +### Micro Frontends (mfe-*) +| Nome | URL | +|------|-----| +| mfe-auth | https://dev.azure.com/CN-Squad/Invista%20FIDC%20-%20Nexus/_git/mfe-auth | +| mfe-formalization | https://dev.azure.com/CN-Squad/Invista%20FIDC%20-%20Nexus/_git/mfe-formalization | +| mfe-person | https://dev.azure.com/CN-Squad/Invista%20FIDC%20-%20Nexus/_git/mfe-person | +| mfe-poc | https://dev.azure.com/CN-Squad/Invista%20FIDC%20-%20Nexus/_git/mfe-poc | +| mfe-shell | https://dev.azure.com/CN-Squad/Invista%20FIDC%20-%20Nexus/_git/mfe-shell | +| mfe-user | https://dev.azure.com/CN-Squad/Invista%20FIDC%20-%20Nexus/_git/mfe-user | + +### Libraries (InvistaFIDC.Lib.*) +- InvistaFIDC.Lib.AuditLog +- InvistaFIDC.Lib.Bases +- InvistaFIDC.Lib.DateHandler +- InvistaFIDC.Lib.DocBuilder +- InvistaFIDC.Lib.GrpcClient +- InvistaFIDC.Lib.Helpers +- InvistaFIDC.Lib.HttpClient +- InvistaFIDC.Lib.Logging +- InvistaFIDC.Lib.Messaging +- InvistaFIDC.Lib.Middlewares +- InvistaFIDC.Lib.Observability +- InvistaFIDC.Lib.Results +- InvistaFIDC.Lib.SecretProvider +- InvistaFIDC.Lib.Storage +- InvistaFIDC.Lib.ValueObjects + +## URLs Úteis + +- **Azure DevOps:** https://dev.azure.com/CN-Squad/ +- **Projeto:** https://dev.azure.com/CN-Squad/Invista%20FIDC%20-%20Nexus/ + +--- + +*Documento gerado em: 2026-02-17* +*Atualizado em: 2026-02-17* diff --git a/inventcloud/invista/nexus/azure-devops/OCI-CONNECTION.md b/inventcloud/invista/nexus/azure-devops/OCI-CONNECTION.md new file mode 100644 index 0000000..0bcd2ce --- /dev/null +++ b/inventcloud/invista/nexus/azure-devops/OCI-CONNECTION.md @@ -0,0 +1,101 @@ +# Oracle Cloud Infrastructure (OCI) - Conexão e Configuração + +## Visão Geral + +Documentação de conexão à Oracle Cloud Infrastructure utilizada para criar e gerenciar clusters Kubernetes. + +## Configuração SSH para OCI + +### Configuração do SSH +**Arquivo:** `C:\Users\TiagoRibeiro\.ssh\config` + +``` +# OCI Compute Instances - adicionar conforme necessário +Host oci-* + HostName + User opc + IdentityFile ~/.ssh/oci_key + IdentitiesOnly yes +``` + +## Repositório Terraform + +### tf_oci_clusters +- **URL Azure DevOps:** https://dev.azure.com/CN-Squad/Invista%20FIDC%20-%20Nexus/_git/tf_oci_clusters +- **Conteúdo:** Definições Terraform para infraestrutura OCI + +### Clonar Repositório +```bash +# Via HTTPS com PAT +git clone https://tiago.ribeiro:@dev.azure.com/CN-Squad/Invista%20FIDC%20-%20Nexus/_git/tf_oci_clusters + +# Via SSH (após configurar chave pública no Azure DevOps) +git clone git@ssh.dev.azure.com:v3/CN-Squad/Invista%20FIDC%20-%20Nexus/tf_oci_clusters +``` + +## Autenticação OCI + +### Configuração OCI CLI + +```bash +# Instalar OCI CLI +bash -c "$(curl -L https://raw.githubusercontent.com/oracle/oci-cli/master/scripts/install/install.sh)" + +# Configurar autenticação +oci session authenticate + +# Ou usar API Key +# 1. Criar chave privada +openssl genrsa -out ~/.oci/oci_api_key.pem 2048 + +# 2. Criar chave pública +openssl rsa -in ~/.oci/oci_api_key.pem -pubout -out ~/.oci/oci_api_key_public.pem + +# 3. Upload da chave pública no OCI Console +# User Settings → API Keys → Add Public Key +``` + +### Variáveis de Ambiente +```bash +export OCI_TENANCY= +export OCI_USER= +export OCI_FINGERPRINT= +export OCI_KEY_FILE=~/.oci/oci_api_key.pem +export OCI_REGION=us-ashburn-1 +``` + +## Comandos Úteis OCI + +### Listar Compute Instances +```bash +oci compute instance list --compartment-id +``` + +### Listar VCNs +```bash +oci network vcn list --compartment-id +``` + +### Listar Load Balancers +```bash +oci lb load-balancer list --compartment-id +``` + +## Recursos Gerenciados + +| Recurso | Descrição | +|---------|-----------| +| Compute Instances | VMs para K3s clusters | +| VCN | Virtual Cloud Network | +| Load Balancers | Balanceamento de carga | +| Object Storage | Armazenamento | +| OKE | Oracle Kubernetes Engine | + +## Links Úteis + +- **OCI Console:** https://console.oraclecloud.com +- **OCI Documentation:** https://docs.oracle.com/en-us/oci/ + +--- + +*Documento gerado em: 2026-02-17*