From aaaf5de70c42518295ca740189d0c79a8a761812 Mon Sep 17 00:00:00 2001 From: asepharyana Date: Thu, 23 Jul 2026 06:57:40 +0700 Subject: [PATCH] feat(infra): remove Go dashboard, dashboard is now part of hub Next.js app - Remove dashboard container from observability.yml - Remove infra/docker/dashboard.Dockerfile - Remove dashboard route from Traefik apps.yaml - Mount Docker socket on hub container for /api/dashboard - Remove dashboard build from CI/CD (docker-build-push.yml) - Update submodule pointer to hub with Next.js dashboard rewrite Co-Authored-By: Claude Opus 4.8 (1M context) --- .github/workflows/docker-build-push.yml | 11 ++--------- apps/hub | 2 +- infra/compose/hub.yml | 2 ++ infra/compose/observability.yml | 22 ---------------------- infra/docker/dashboard.Dockerfile | 11 ----------- infra/traefik/dynamic/apps.yaml | 15 --------------- 6 files changed, 5 insertions(+), 58 deletions(-) delete mode 100644 infra/docker/dashboard.Dockerfile diff --git a/.github/workflows/docker-build-push.yml b/.github/workflows/docker-build-push.yml index b6e00d5..21950c7 100644 --- a/.github/workflows/docker-build-push.yml +++ b/.github/workflows/docker-build-push.yml @@ -36,7 +36,6 @@ jobs: matrix: ${{ steps.set-matrix.outputs.matrix }} scraper-api: ${{ steps.filter.outputs['scraper-api'] == 'true' || steps.dispatch.outputs['scraper-api'] == 'true' || github.event_name == 'workflow_dispatch' }} hub: ${{ steps.filter.outputs['hub'] == 'true' || steps.dispatch.outputs['hub'] == 'true' || github.event_name == 'workflow_dispatch' }} - dashboard: ${{ steps.filter.outputs['dashboard'] == 'true' || steps.dispatch.outputs['dashboard'] == 'true' || github.event_name == 'workflow_dispatch' }} steps: - uses: actions/checkout@v6 with: @@ -64,7 +63,6 @@ jobs: echo "scraper-api=$(changed '^(apps/scraper(/|$)|\.github/workflows/docker-build-push\.yml$|infra/docker/scraper\.Dockerfile$)')" >> "$GITHUB_OUTPUT" echo "hub=$(changed '^(apps/hub(/|$)|\.github/workflows/docker-build-push\.yml$|infra/docker/hub\.Dockerfile$)')" >> "$GITHUB_OUTPUT" - echo "dashboard=$(changed '^(apps/hub/dashboard(/|$)|\.github/workflows/docker-build-push\.yml$|infra/docker/dashboard\.Dockerfile$)')" >> "$GITHUB_OUTPUT" - name: Parse repository_dispatch payload id: dispatch @@ -86,7 +84,7 @@ jobs: fi case "$SERVICE" in - scraper-api|hub|dashboard) ;; + scraper-api|hub) ;; *) exit 1 ;; @@ -94,7 +92,7 @@ jobs: if ! [[ "$SHA" =~ ^[0-9a-fA-F]{40}$ ]]; then echo "::error::Invalid sha '$SHA'. Expected 40 hex characters"; fi - SERVICES=(scraper-api hub dashboard) + SERVICES=(scraper-api hub) for svc in "${SERVICES[@]}"; do if [ "$SERVICE" = "$svc" ]; then echo "${svc}=true" >> "$GITHUB_OUTPUT" @@ -113,7 +111,6 @@ jobs: if [ "${{ steps.filter.outputs['scraper-api'] == 'true' || steps.dispatch.outputs['scraper-api'] == 'true' || github.event_name == 'workflow_dispatch' }}" == "true" ]; then add_service "scraper-api" "docker-scraper" "apps/scraper"; fi if [ "${{ steps.filter.outputs['hub'] == 'true' || steps.dispatch.outputs['hub'] == 'true' || github.event_name == 'workflow_dispatch' }}" == "true" ]; then add_service "hub" "docker-hub" "apps/hub"; fi - if [ "${{ steps.filter.outputs['dashboard'] == 'true' || steps.dispatch.outputs['dashboard'] == 'true' || github.event_name == 'workflow_dispatch' }}" == "true" ]; then add_service "dashboard" "docker-dashboard" "infra/dashboard"; fi JSON_ARRAY="[$(IFS=,; echo "${SERVICES[*]}")]" echo "matrix=$JSON_ARRAY" >> $GITHUB_OUTPUT @@ -216,7 +213,6 @@ jobs: case "$SVC_NAME" in "scraper-api") echo "dockerfile=infra/docker/scraper.Dockerfile" >> $GITHUB_OUTPUT ;; "hub") echo "dockerfile=infra/docker/hub.Dockerfile" >> $GITHUB_OUTPUT ;; - "dashboard") echo "dockerfile=infra/docker/dashboard.Dockerfile" >> $GITHUB_OUTPUT ;; esac - name: Build and Push Docker image @@ -262,12 +258,10 @@ jobs: declare -A SERVICES SERVICES["scraper-api"]="scraper.yml" SERVICES["hub"]="hub.yml" - SERVICES["dashboard"]="observability.yml" declare -A PATHS PATHS["scraper-api"]="apps/scraper" PATHS["hub"]="apps/hub" - PATHS["dashboard"]="apps/hub" # Use git config for possible commits git config --local user.email "action@github.com" @@ -277,7 +271,6 @@ jobs: SHOULD_HAVE_RUN=false if [ "${{ needs.changes.outputs['scraper-api'] }}" == "true" ] && [ "$id" == "scraper-api" ]; then SHOULD_HAVE_RUN=true; fi if [ "${{ needs.changes.outputs['hub'] }}" == "true" ] && [ "$id" == "hub" ]; then SHOULD_HAVE_RUN=true; fi - if [ "${{ needs.changes.outputs['dashboard'] }}" == "true" ] && [ "$id" == "dashboard" ]; then SHOULD_HAVE_RUN=true; fi if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then SHOULD_HAVE_RUN=true; fi diff --git a/apps/hub b/apps/hub index 91896b8..72f4759 160000 --- a/apps/hub +++ b/apps/hub @@ -1 +1 @@ -Subproject commit 91896b8fdf496b7c02dc1b82b4a96dcde98ca70c +Subproject commit 72f4759f8bc11d6bc6fffac63ea9b56074f2fc2d diff --git a/infra/compose/hub.yml b/infra/compose/hub.yml index 9bac883..ec3f4e9 100644 --- a/infra/compose/hub.yml +++ b/infra/compose/hub.yml @@ -9,6 +9,8 @@ services: - hub env_file: - ../../.env + volumes: + - /var/run/docker.sock:/var/run/docker.sock:ro networks: app-shared-net: diff --git a/infra/compose/observability.yml b/infra/compose/observability.yml index 2407dba..d619cf6 100644 --- a/infra/compose/observability.yml +++ b/infra/compose/observability.yml @@ -73,28 +73,6 @@ services: volumes: - /:/host:ro,rslave - # ── Custom Dashboard (nginx:alpine) ── - dashboard: - container_name: dashboard - image: ghcr.io/asepharyana/asepharyana-hub/dashboard:sha-5999ac1 - build: - context: ../.. - dockerfile: infra/docker/dashboard.Dockerfile - restart: always - networks: - app-shared-net: - aliases: - - dashboard - ports: - - '8080:8080' - volumes: - - /var/run/docker.sock:/var/run/docker.sock:ro - depends_on: - jaeger: - condition: service_started - otel-collector: - condition: service_started - networks: app-shared-net: name: app-shared-net diff --git a/infra/docker/dashboard.Dockerfile b/infra/docker/dashboard.Dockerfile deleted file mode 100644 index 185a66e..0000000 --- a/infra/docker/dashboard.Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -# ── Build stage ── -FROM golang:1.24-alpine AS builder -WORKDIR /build -COPY apps/hub/dashboard/ ./ -RUN CGO_ENABLED=0 go build -ldflags="-s -w" -o dashboard . - -# ── Runtime (scratch — ~7MB total) ── -FROM scratch -COPY --from=builder /build/dashboard /dashboard -EXPOSE 8080 -CMD ["/dashboard"] diff --git a/infra/traefik/dynamic/apps.yaml b/infra/traefik/dynamic/apps.yaml index ae62d2e..fc749cb 100644 --- a/infra/traefik/dynamic/apps.yaml +++ b/infra/traefik/dynamic/apps.yaml @@ -20,16 +20,6 @@ http: - common-chain@file service: scraper-service - # ── Dashboard ── - dashboard: - rule: 'Host(`dashboard.asepharyana.my.id`) || Host(`status.asepharyana.my.id`) || Host(`dashboard.asepharyana.web.id`) || Host(`status.asepharyana.web.id`)' - entryPoints: - - websecure - tls: {} - middlewares: - - common-chain@file - service: dashboard-service - # ── Jaeger UI ── jaeger: rule: 'Host(`jaeger.asepharyana.my.id`) || Host(`jaeger.asepharyana.web.id`)' @@ -51,11 +41,6 @@ http: servers: - url: 'http://scraper-api:4091' - dashboard-service: - loadBalancer: - servers: - - url: 'http://dashboard:8080' - jaeger-service: loadBalancer: servers: