Skip to content
John Shaughnessy edited this page Nov 1, 2023 · 2 revisions

Deployment Workflow Documentation

Deployment Diagram

file:./deploy.png

Overview

This document outlines the deployment workflow of a server application involving a migration. The workflow consists of three main stages:

  1. Local Development
  2. Development Environment on GCP
  3. Production Environment on GCP

Local Development

  • Components: Docker container for PostgreSQL, Docker container for App Server
  • Responsibilities: Active development, running migrations locally
  • Debug Pointers: Inspect Docker logs, run manual tests on local machine

Steps

  1. Active Development: Write and modify code.
  2. Docker Compose: Use docker-compose up -d to bring up Postgres and App containers.
  3. Local Migrations: Run Diesel migrations against the local Postgres container.
  4. Testing: Execute local test suite.

Development Environment

  • Infrastructure: Dedicated GCP VM
  • Components: Docker Registry, PostgreSQL on VM, App Server on VM
  • Responsibilities: Automated deployment and testing
  • Debug Pointers: Check CI/CD pipeline logs, verify Docker registry uploads, examine VM logs

Steps

  1. Git Workflow: Push changes to a feature branch.
  2. CI/CD: Automatically build and upload Docker image to registry.
  3. Dev Migrations: Run Diesel migrations on Dev PostgreSQL.
  4. Dev Deployment: Deploy new image as a Docker container on the Dev VM.
  5. Automated Tests: Run any tests and report back.

Production Environment

  • Infrastructure: Same as Development, but separated for isolation.
  • Components: PostgreSQL, App Server
  • Responsibilities: Final deployment, migration, and validation
  • Debug Pointers: Check logs in the production environment, especially during and after migrations.

Steps

  1. App Shutdown: Stop the production App container but leave Postgres running.
  2. Prod Migrations: Execute Diesel migrations on production database through a temporary container.
  3. Prod Deployment: Bring up new App container from updated Docker image.
  4. Validation: Run production-specific tests to ensure everything is operational.

Key Takeaways

  • For local debugging, consult Docker logs and local test outputs.
  • In Dev and Prod, debugging involves checking pipeline logs, container statuses, and database logs.
  • Migrations are executed against respective databases at the Dev and Prod stages.
  • Testing is woven into each stage to ensure functional integrity.
Clone this wiki locally