Backend Deployment Quick Reference Backend Deployment Quick Reference A quick guide to common commands used for managing backend deployments across different environments using the unified deploy.sh script.

๐Ÿ“ฆ Deployment Script

The backend service includes a flexible deployment script deploy.sh that supports Podman, Buildah, and Kaniko (GitOps), removing the dependency on Docker Desktop.

Usage

Build Options

When running the script, you will be prompted to choose a build method:

1. Local Build (Podman/Buildah)

  • Tool: Automatically detects and uses buildah (Linux) or podman (Mac/Windows).
  • Environment: Runs on your local machine.
  • Cross-Platform: Supports building for different architectures (e.g., M1 Mac -> Intel Server).
  • Best for: Fast, iterative development loops.
  • Requirement: podman or buildah must be installed locally.
    Authentication: To push images to GHCR, ensure you are logged in:

2. Remote Build (Kaniko)

  • Tool: Triggers a Kaniko Job inside your Kubernetes cluster.
  • Environment: Runs on the cluster nodes (e.g., Raspberry Pi).
  • Best for:
    • Deploying from devices without local build tools (e.g., lightweight laptops).
    • Ensuring architecture compatibility (builds on the target architecture).
    • Reducing local resource usage.
  • Requirement:
    • kubectl configured to point to the cluster.
    • ghcr-secret exists in the namespace (for pushing to GHCR).
    • GITHUB_TOKEN environment variable must be exported (for private repo cloning).
  • Cross-Platform: Kaniko runs on the cluster architecture by default. To force a specific platform:

3. Skip Build

  • Action: Skips the build/push step and proceeds directly to Kustomize updates.
  • Best for: Redeploying the current version or updating k8s configs without code changes.

Deployment Methods

After the build phase, you can choose how to apply changes:

๐Ÿงช Local Testing (Optional)

If you need to spin up the stack locally for testing:
The test environment runs the backend on port 8081 (to avoid conflict with your normal dev server) and sets up temporary PostgreSQL and NATS instances.

๐Ÿค– CI/CD Automation

Deployments are automated via GitHub Actions (.github/workflows/backend-k8s-deploy.yml) triggered by pushes to specific branches:

Kustomize Preview

Pod Management

๐Ÿ“Š Resource Allocation Sheet

๐Ÿšจ Emergency Rollback

To rollback a failed production deployment: