Skip to content

Infrastructure

Overview of Sartiq's cloud infrastructure, covering cloud providers, environments, and service architecture.


Cloud Providers

Sartiq runs on a multi-cloud architecture:

Provider Region Purpose
GCP europe-west8 Primary provider. Backend services, compute, databases
Vercel Global Frontend deployments (web app and website)
Cloudflare Global Content storage (R2) and CDN

GCP Projects

Project Purpose
sartiq-ops Shared infrastructure (Terraform state bucket)
sartiq-dev Development environment
sartiq-staging Staging environment
sartiq-prod Production environment

Infrastructure is managed via Terraform + Terragrunt under the shootify-deployment/terraform/ directory.


Infrastructure Overview

flowchart TB
    Users([Users])

    subgraph Vercel ["Vercel"]
        Webapp[Web App]
    end

    subgraph GCP ["GCP (europe-west8)"]
        subgraph BackendVM ["Backend VM"]
            Caddy_BE[Caddy]
            Backend[Backend API]
            Scheduler[Scheduler]
            Celery_BE[Celery Worker]
            BE_DB[(PostgreSQL)]
            BE_Redis[(Redis)]
        end

        subgraph ComputeVM ["Compute VM"]
            CS_API[Compute API]
            CS_Workers[Workers]
            CS_DB[(PostgreSQL)]
            CS_Redis[(Redis)]
        end
    end

    subgraph AI ["AI Providers"]
        FAL[FAL.ai]
        LLMs[OpenAI / Anthropic / Gemini]
    end

    subgraph Cloudflare ["Cloudflare"]
        R2[(R2 Storage)]
        CDN[CDN]
    end

    Users --> Vercel
    Users --> Caddy_BE
    Caddy_BE --> Backend
    Caddy_BE --> Webapp
    Backend --> CS_API
    CS_Workers --> AI

    R2 --> CDN
    Vercel -. read .-> CDN
    BackendVM -. read .-> CDN
    ComputeVM -. read .-> CDN
    BackendVM -- write --> R2
    ComputeVM -- write --> R2

Environments

Environment Frontend Backend Compute
Development localhost:3000 localhost:8000 localhost:9000
Staging staging-app.sartiq.com staging-api.sartiq.com compute-api-staging.sartiq.com
Production app.sartiq.com api.sartiq.com compute-api.sartiq.com

Each environment runs on its own GCP project with dedicated VMs, databases, and networking. Deployment configurations live in separate directories per environment:

  • GCP-Backend-{dev,staging,production}/docker-compose.yml
  • GCP-ComputeServer-{dev,staging,production}/compute/docker-compose.yml

URL Routing

Caddy handles SSL termination and routes traffic to backend services:

URL Service
api.sartiq.com Backend Production
staging-api.sartiq.com Backend Staging
compute-api.sartiq.com Compute Server Production
compute-api-staging.sartiq.com Compute Server Staging

Service Architecture

Each environment runs two VMs — Backend and Compute — each with its own isolated data stores.

Backend VM

Service Image Port Purpose
Caddy caddy:2-alpine 80, 443 Reverse proxy, SSL/TLS termination
Backend API shootify-backend 8000 Core API (Python)
Scheduler shootify-backend 8010 APScheduler service
Celery Worker shootify-backend Async task processing
Webapp shootify-webapp 3000 Frontend (dev/staging only)
PostgreSQL postgres:17 5432 Primary database
Redis redis:7-alpine Cache, Celery broker, pub/sub
DB Backup tiredofit/db-backup Scheduled backups to R2

Compute VM

Service Image Port Purpose
API shootify-compute-server 9000 Compute API
FAL Worker shootify-compute-server External AI model integration (concurrency: 50)
LLM Worker shootify-compute-server OpenAI, Anthropic, Gemini interactions
Local CPU Worker shootify-compute-server U2NET inference (CPU-based)
Workflow Worker shootify-compute-server Pipeline execution
Inference Worker shootify-compute-server FAL inference tasks
Beat shootify-compute-server Celery Beat scheduler
Event Listener shootify-compute-server Redis event listener
PostgreSQL postgres:17 5433 Compute database
Redis redis:alpine 6479 Celery broker, task state
DB Backup tiredofit/db-backup Scheduled backups to R2

Service Isolation

flowchart TB
    subgraph Backend["Backend VM"]
        BE_API[API]
        BE_Scheduler[Scheduler]
        BE_Workers[Celery Worker]
        BE_DB[(PostgreSQL)]
        BE_Redis[(Redis)]
    end

    subgraph Compute["Compute VM"]
        CS_API[API]
        CS_Workers[Workers]
        CS_DB[(PostgreSQL)]
        CS_Redis[(Redis)]
    end

    BE_API --> BE_DB
    BE_API --> BE_Redis
    BE_Workers --> BE_Redis
    BE_Scheduler --> BE_DB

    CS_API --> CS_DB
    CS_API --> CS_Redis
    CS_Workers --> CS_Redis

    BE_API --> CS_API
Service Database Contents Redis Usage
Backend Users, organizations, products, subjects, shootings, generations Cache, sessions, pub/sub for WebSocket
Compute Tasks, workflows, provider state, job history Celery broker, task results, workflow state

Data Persistence

All persistent data is stored on GCP persistent disks mounted at /data:

Path Contents
/data/postgres PostgreSQL data
/data/redis Redis snapshots
/data/caddy Caddy configuration and certificates
/data/models/onnx ML model files (U2NET)

Sections

Servers & Compute

Network, Storage & IAM

Operations

Security