Skip to content

Flujos funcionales

Flujo 1: Autoría → build → despliegue MANUAL a Cloud Run

El workflow deploy.yml describe un pipeline automático, pero en la práctica el despliegue es MANUAL porque Gitea Actions está APAGADO en este repo (manifiesto del workspace; ver tecnico/05-despliegue.md). El diagrama refleja ambas cosas.

mermaid
sequenceDiagram
    autonumber
    actor Autor
    participant Repo as Repo Gitea (main)
    participant CI as Workflow deploy.yml<br/>(Gitea Actions OFF)
    participant Op as Operador (manual)
    participant AR as Artifact Registry<br/>(europe-southwest1)
    participant Run as Cloud Run<br/>(europe-west1)

    Autor->>Repo: edita es/ + en/, registra sidebar y push a main
    Note over CI: deploy.yml definido para push a main<br/>(.github/workflows/deploy.yml:4-7)<br/>pero NO se ejecuta (Actions OFF)
    Op->>Op: docker build (Node 20 → nginx)
    Op->>AR: docker push IMAGE:sha + :latest
    Op->>Run: gcloud run deploy --port 8080
    Run-->>Autor: revisión nueva sirviendo el sitio
    Note over Run: si no se ejecuta el deploy manual,<br/>el sitio en vivo queda desfasado vs main

Pasos del pipeline definido (no automatizado hoy):

  1. Checkout (.github/workflows/deploy.yml:19-20).
  2. Autenticación a GCP con GCP_SA_KEY (:22-25).
  3. docker build multistage y push de :sha y :latest (:33-37).
  4. gcloud run deploy con puerto 8080, 256Mi, cpu 1, min 0 / max 2 (:39-52).

Flujo 2: Build de VitePress dentro de la imagen

mermaid
sequenceDiagram
    autonumber
    participant Builder as Stage builder<br/>(node:20-alpine)
    participant VP as VitePress
    participant Nginx as Stage serve<br/>(nginx:alpine)

    Builder->>Builder: npm ci --ignore-scripts (Dockerfile:8)
    Builder->>VP: npm run build → vitepress build (package.json:9)
    VP-->>Builder: estáticos en .vitepress/dist (Dockerfile:11,17)
    Builder->>Nginx: COPY dist → /usr/share/nginx/html (Dockerfile:17)
    Nginx->>Nginx: COPY nginx.conf (Dockerfile:16)
    Note over Nginx: EXPOSE 8080, CMD nginx -g daemon off (Dockerfile:19-20)

Flujo 3: Visita y redirección automática por idioma

mermaid
sequenceDiagram
    autonumber
    actor Visitante
    participant Nginx
    participant Root as index.md (/)
    participant Locale as /es/ o /en/

    Visitante->>Nginx: GET /
    Nginx->>Root: try_files resuelve index.html (nginx.conf:21)
    Root->>Root: lee navigator.language (index.md:9)
    alt idioma empieza por "en"
        Root-->>Visitante: location.replace('/en/') (index.md:10-13)
    else resto
        Root-->>Visitante: location.replace('/es/') (index.md:10-13)
    end
    Visitante->>Nginx: GET /es/blog/<slug>
    Nginx->>Locale: try_files $uri $uri.html (clean URLs, nginx.conf:21)
    Locale-->>Visitante: artículo renderizado

Notas:

  • La redirección solo actúa si la ruta es / o /index.html (index.md:11).
  • Las URLs limpias (cleanUrls: true, .vitepress/config.mts:13) se resuelven en nginx con try_files $uri $uri.html $uri/ /index.html (nginx.conf:21).

Cybersecurity · Technology · Leadership