Busflow Docs

Internal documentation portal

Skip to content

Infrastructure Overview

This document provides a high-level overview of the Busflow infrastructure setup, covering containerization, scripts, and Infrastructure as Code (IaC). All related configuration is safely stored within this infrastructure/ directory.

Directory Structure

The repository organizes into the following key administrative areas:

  • docker/: Docker environments and configurations.
  • terraform/: Infrastructure as Code (IaC) provisioning.
  • scripts/: Helper utilities for initialization and maintenance.
  • config/: Centralized configuration files for infrastructure components.

1. Docker (docker/)

Handles local development, staging, and production container environments.

  • Dockerfiles: Define core services here (e.g., Dockerfile.api, Dockerfile.workspace, Dockerfile.landing, Dockerfile.docs-hub).
  • Compose Files: Provide tailored configurations for various environments:
    • docker-compose.local.yml: Defines everything needed for local development.
    • docker-compose.production.yml: Deploys production services stack.
    • docker-compose.studio.yml: Configures the studio/backoffice environment specifically.
    • docker-compose.preview.yml: Configures preview or staging environments.
    • docker-compose.observability.yml: Sets up monitoring, logs, and metric collection.
  • Subdirectories: Contain configurations for specific infrastructure components like traefik/ (routing), nginx/ (web server overrides), and initdb.d/ (PostgreSQL schemas initialization).

NOTE

View local setup instructions directly in docker/README.md.


2. Terraform (terraform/)

Manages the provisioning of external services and overall deployment infrastructure. We organize this into modules and environments.

  • Environments (environments/): Contain state and variables specific to environments, notably production and studio.
  • Modules (modules/): Provide reusable IaC pieces including:
    • dns-cloudflare: Manages domain and DNS records via Cloudflare.
    • github-secrets: Provisions and manages secrets securely in GitHub Actions.
    • postgres-ubicloud: Provisions managed PostgreSQL database using Ubicloud.
    • swarm: Initializes and manages Docker Swarm infrastructure and nodes.
    • network: Sets up underlying networks.

3. Scripts (scripts/)

Supply utility scripts for repetitive tasks or verifications across environments.

  • init-swarm.sh: Initializes Docker Swarm or joins nodes.
  • generate-secrets.sh: Generates and manages secure values.
  • Validation Scripts: Monitor operational metrics and validate database integrity constraints where soft foreign keys exist using tools like check_metric_cardinality.py and verify_soft_fks.py.

Summary

  • To change the way containers run, look in docker/.
  • To alter cloud resources (DNS, managed DB, Swarm VM), look in terraform/.
  • To look for helper commands or automation scripts, look in scripts/.
  • For server access via SSH, read the Server Access Guide.

Internal documentation — Busflow