# Deploy de SeniorTech Ventures

- Repositório `FCJ-VB/seniortech-venture`, branch `main`; Lovable `https://seniortech-venture.lovable.app/`.
- Domínio canônico: `seniortechventures.com` e `www.seniortechventures.com`.
- Alias: `seniortechventures.com.br` e `www.seniortechventures.com.br`, redirecionando para `https://seniortechventures.com` com caminho e query preservados.
- DNS dos quatro hosts aponta para `54.89.68.19`, conferido em 2026-11-11.
- VM FCJ: checkout `/var/www/html/seniortechventures/seniortech-venture`, serviço ativo `seniortechventures.service`, bind `127.0.0.1:3019`, vhost HTTP `/etc/apache2/sites-enabled/seniortechventures.conf`.
- Primeira instalação concluída em 2026-11-11 no commit `0ea36bd`; porta `3019` confirmada livre antes de reservar.
- Runtime: Node.js `22.23.4` / npm `10.9.9`; instalar com `npm ci --no-audit --no-fund`.
- Certificado Certbot `/etc/letsencrypt/live/seniortechventures.com/` cobre raiz e `www`, válido até 2027-02-09. `certbot.timer` está ativo e HTTP redireciona para HTTPS.
- Em 2026-11-11, Apache configtest passou; 11 rotas e 116 assets retornaram HTTP 200 via HTTPS. `certbot renew --dry-run` passou para este certificado.

## Build e assets

```bash
npm ci --no-audit --no-fund
npm run build
bash scripts/verify-static-assets.sh
```

O build exige Nitro `node-server`, entrypoint SSR e todos os caminhos do manifesto em `public/` e `.output/public/`.

## Primeira instalação

Após publicar `main` e criar o checkout como `deploy` em `/var/www/html/seniortechventures/seniortech-venture`:

```bash
npm ci --no-audit --no-fund
npm run build
sudo -n bash ops/install-vm-config.sh
```

O instalador confere a porta, instala somente a unidade e o vhost HTTP deste site, valida Apache, resposta local e assets principais. Para futuras instalações, após confirmar DNS, emitir TLS pelo Certbot; preserve o vhost SSL gerenciado por ele.

## Certificado TLS

O certificado foi emitido após a virada do DNS em 2026-11-11:

```bash
sudo certbot --apache --non-interactive --agree-tos --redirect \
  --cert-name seniortechventures.com \
  -d seniortechventures.com -d www.seniortechventures.com
sudo certbot renew --dry-run --cert-name seniortechventures.com \
  --no-random-sleep-on-renew
```

O certificado cobre os dois hosts e expira em 2027-02-09. `certbot.timer` agenda a renovação automática.

## Alias `.com.br`

Os vhosts Apache `seniortechventures.com.br.conf` e `seniortechventures.com.br-ssl.conf` redirecionam os dois hosts alternativos diretamente para o domínio canônico, mantendo caminho e query string. O vhost HTTP serve também o desafio ACME em `/var/www/html/letsencrypt`.

Instalado em 2026-11-11. DNS de raiz e `www` aponta para `54.89.68.19`; ambos redirecionam com HTTP e HTTPS. Certificado `/etc/letsencrypt/live/seniortechventures.com.br/` válido até 2027-02-09, com `certbot.timer` ativo. O dry-run de renovação passou.

```bash
sudo bash ops/install-domain-alias.sh
sudo certbot certonly --webroot --webroot-path /var/www/html/letsencrypt \
  --non-interactive --agree-tos --cert-name seniortechventures.com.br \
  -d seniortechventures.com.br -d www.seniortechventures.com.br
sudo bash ops/install-domain-alias.sh
sudo certbot renew --dry-run --cert-name seniortechventures.com.br \
  --no-random-sleep-on-renew
```

O instalador configura um deploy hook para recarregar o Apache após futuras renovações deste certificado.

## Atualizações

```bash
sudo -n -u deploy bash /var/www/html/seniortechventures/seniortech-venture/deploy.sh
```

O script exige checkout limpo, atualiza `main` por fast-forward, executa `npm ci`, build e verificação de assets, reinicia apenas `seniortechventures.service` e confirma o health check local.
