File size: 2,566 Bytes
af1bee9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
348eedc
 
af1bee9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# Patchwise: single-tenant deployment for one customer environment.
#   cp .env.example .env   (edit it)   then:   docker compose up -d
# Three containers: the application, Temporal (durable workflows) and Caddy (HTTPS). All customer data stays in the
# named volumes on this host: nothing is stored outside the customer's environment.
name: patch-coworker
services:
  app:
    image: ${FPT_IMAGE:-patch-coworker:1.0.0}
    build:
      context: ..
      dockerfile: Dockerfile
    restart: unless-stopped
    env_file: .env
    environment:
      FPT_ORCHESTRATOR: temporal
      FPT_EMBEDDED_WORKER: "1"          # the workflow worker runs inside the application
      TEMPORAL_ADDRESS: temporal:7233
      TEMPORAL_UI_URL: ""                # the Temporal UI is not published; see DEPLOY.md to reach it over SSH
      FPT_COOKIE_SECURE: always          # the app is only reachable through HTTPS
      FPT_TRUST_PROXY: ${FPT_TRUST_PROXY:-1}   # the app is only reachable through Caddy, which sets the visitor address: sign-in limits count per visitor
      FPT_API_DOCS: ${FPT_API_DOCS:-0}         # the interactive API docs are off on a public server (FPT_API_DOCS=1 in .env to show them)
      FPT_CASE_WRITEBACK: "0"            # approvals are kept in the database; the image itself is read-only content
      POD_BASE_URL: http://127.0.0.1:3100
    volumes:
      - fpt-data:/data
    depends_on:
      temporal:
        condition: service_started
    shm_size: 1gb                         # Chromium needs shared memory for full browser runs
    expose:
      - "8800"

  temporal:
    image: temporalio/temporal:1.9.1
    restart: unless-stopped
    command: ["server", "start-dev", "--ip", "0.0.0.0", "--db-filename", "/data/temporal.db", "--namespace", "default", "--ui-port", "8233"]
    user: "0:0"
    volumes:
      - temporal-data:/data
    expose:
      - "7233"
    ports:
      - "127.0.0.1:8233:8233"             # Temporal Web UI on the host's loopback only (reach it through an SSH tunnel)

  proxy:
    image: caddy:2.10-alpine
    restart: unless-stopped
    environment:
      FPT_DOMAIN: ${FPT_DOMAIN:?set FPT_DOMAIN in .env}
      FPT_TLS: ${FPT_TLS:-internal}
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./Caddyfile:/etc/caddy/Caddyfile:ro
      - caddy-data:/data
      - caddy-config:/config
    depends_on:
      - app

volumes:
  fpt-data:         # database, secrets vault, encrypted evidence, reports, script library
  temporal-data:    # workflow history
  caddy-data:       # TLS certificates
  caddy-config: