Skip to content

Deployment

Dispatch runs on GKE with ArgoCD for GitOps deployment.

Infrastructure

ComponentDescription
API ServerGin HTTP server (port 8080)
WorkerAsynq background processor
SMTP ServerEmail relay (ports 587, 465)
PostgreSQLPrimary database
RedisTask queue (Asynq)
S3Image/attachment storage

Docker Image

dockerfile
# Multi-stage build
FROM golang:1.25-alpine AS builder
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN go build -o server ./cmd/server
RUN go build -o worker ./cmd/worker

FROM alpine:latest
COPY --from=builder /app/server /app/worker /usr/local/bin/

Kubernetes

Managed via the application repo:

application/
  base/sending-saas-backend/
    deploy.yaml           # API deployment
    service.yaml
    api-ing.yaml          # API ingress
    smtp-health-check.yaml
    swagger-ing.yaml
    migration-hook.yaml   # Pre-sync migration job
  dev/sending-saas-backend/
    patches/              # Dev overrides
  prod/sending-saas-backend/
    patches/              # Prod overrides

CI/CD Pipeline

  1. Push to main → GitHub Actions
  2. Run Go tests
  3. Build Docker image → push to GCP Artifact Registry
  4. ArgoCD detects new image digest → auto-deploy

Migrations

Database migrations run automatically via ArgoCD pre-sync hook:

bash
# Manual migration
go run cmd/migrate/main.go up

# Rollback
go run cmd/migrate/main.go down

TechTrans Lab