From 7f0abc2da0cb544ba02fc53de53f59c9101017e7 Mon Sep 17 00:00:00 2001 From: Eduardo Lopes <155753879+eduardolopesx03@users.noreply.github.com> Date: Tue, 10 Feb 2026 14:09:50 -0300 Subject: [PATCH 1/3] =?UTF-8?q?fix:=20usar=20API=20same-origin=20no=20ambi?= =?UTF-8?q?ente=20de=20produ=C3=A7=C3=A3o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/DEPLOY_VPS.md | 2 +- src/environments/environment.production.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/DEPLOY_VPS.md b/docs/DEPLOY_VPS.md index 7c8e8d5..1a3ea86 100644 --- a/docs/DEPLOY_VPS.md +++ b/docs/DEPLOY_VPS.md @@ -43,7 +43,7 @@ cd ~/apps/line-gestao-frontend cat > src/environments/environment.production.ts <<'EOT' export const environment = { production: true, - apiUrl: 'https://linegestao.inglinesystems.com.br' + apiUrl: '' }; EOT diff --git a/src/environments/environment.production.ts b/src/environments/environment.production.ts index 179c3c2..e76a9fe 100644 --- a/src/environments/environment.production.ts +++ b/src/environments/environment.production.ts @@ -1,4 +1,4 @@ export const environment = { production: true, - apiUrl: 'https://linegestao.inglinesystems.com.br' + apiUrl: '' }; From ced67a02b40c8af327737125348c1c09ef7f2bad Mon Sep 17 00:00:00 2001 From: Eduardo Lopes <155753879+eduardolopesx03@users.noreply.github.com> Date: Tue, 10 Feb 2026 14:14:26 -0300 Subject: [PATCH 2/3] docs: esclarecer build do frontend via docker no VPS --- README.md | 20 ++++++++++++++++++-- docs/DEPLOY_VPS.md | 5 ++++- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5ba89c0..6127343 100644 --- a/README.md +++ b/README.md @@ -28,13 +28,29 @@ ng generate --help ## Building +### Local (com Node instalado) + To build the project run: ```bash -ng build +npm run build ``` -This will compile your project and store the build artifacts in the `dist/` directory. By default, the production build optimizes your application for performance and speed. +### VPS/Servidor sem Node no host (recomendado neste projeto) + +Execute o build **dentro do container Docker do frontend**: + +```bash +docker compose -f docker-compose.frontend.yml run --rm frontend-builder +``` + +Se quiser rodar exatamente o comando `npm run build` dentro do container: + +```bash +docker compose -f docker-compose.frontend.yml run --rm frontend-builder sh -lc "npm run build" +``` + +Os artefatos serão gerados em `dist/line-gestao-frontend`. ## Running unit tests diff --git a/docs/DEPLOY_VPS.md b/docs/DEPLOY_VPS.md index 1a3ea86..b6fdbd1 100644 --- a/docs/DEPLOY_VPS.md +++ b/docs/DEPLOY_VPS.md @@ -47,9 +47,12 @@ export const environment = { }; EOT -# 3) build de produção via container Node +# 3) build de produção via container Node (não rodar npm no host) docker compose -f docker-compose.frontend.yml run --rm frontend-builder +# opcional: equivalente a executar `npm run build` dentro do container +# docker compose -f docker-compose.frontend.yml run --rm frontend-builder sh -lc "npm run build" + # 4) validar saída estática ls -lah dist/line-gestao-frontend/browser ``` From a5b850ac06c05cc9dff62be415758ef61af80fd7 Mon Sep 17 00:00:00 2001 From: Eduardo Lopes <155753879+eduardolopesx03@users.noreply.github.com> Date: Tue, 10 Feb 2026 14:24:16 -0300 Subject: [PATCH 3/3] fix: corrigir nginx do front para usar index.csr.html --- docker/nginx.frontend.conf | 9 +++++++-- docs/DEPLOY_VPS.md | 19 +++++++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/docker/nginx.frontend.conf b/docker/nginx.frontend.conf index 79fd959..67620cd 100644 --- a/docker/nginx.frontend.conf +++ b/docker/nginx.frontend.conf @@ -3,9 +3,14 @@ server { server_name _; root /usr/share/nginx/html; - index index.html; + index index.csr.html; + + # Angular SSR static browser build uses index.csr.html as the SPA entrypoint. + location = /index.html { + try_files /index.csr.html =404; + } location / { - try_files $uri $uri/ /index.html; + try_files $uri $uri/ /index.csr.html; } } diff --git a/docs/DEPLOY_VPS.md b/docs/DEPLOY_VPS.md index b6fdbd1..d03d03c 100644 --- a/docs/DEPLOY_VPS.md +++ b/docs/DEPLOY_VPS.md @@ -88,6 +88,25 @@ cd ~/apps/line-gestao-api docker compose -f docker-compose.domain.yml up -d caddy ``` + +## 404 no domínio após build (caso comum neste projeto) + +Se o container `frontend-nginx` subir, mas `https://linegestao.inglinesystems.com.br` continuar em 404, valide: + +```bash +# 1) arquivo de entrada do build Angular SSR +ls -lah ~/apps/line-gestao-frontend/dist/line-gestao-frontend/browser/index.csr.html + +# 2) recarregar Nginx do front após atualizar config +cd ~/apps/line-gestao-frontend +docker compose -f docker-compose.frontend.yml up -d --force-recreate frontend-nginx + +# 3) testar origem do Nginx localmente no VPS +curl -i http://127.0.0.1:8081/ +``` + +Neste repositório, o Nginx do front deve apontar para `index.csr.html` (e não `index.html`). + --- ## Bloco C — validação (curl + navegador)