-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.dstack-postgres.yaml
More file actions
106 lines (102 loc) · 4.91 KB
/
Copy pathdocker-compose.dstack-postgres.yaml
File metadata and controls
106 lines (102 loc) · 4.91 KB
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# dstack deployment - Topology 2: Postgres + S3
# tinycloud-node in the CVM, Postgres external.
# Database credentials encrypted by dstack KMS.
# Column encryption enabled for sensitive data.
#
# All ${...} variables should be encrypted using dstack's KMS public key
# before deployment. The operator never sees plaintext values.
services:
tinycloud:
# DuckDB-enabled images are opt-in and use the -duckdb suffix, for example:
# ghcr.io/tinycloudlabs/tinycloud-node:1.4.0-dstack-duckdb
image: ghcr.io/tinycloudlabs/tinycloud-node:dstack
restart: unless-stopped
ports:
- "8000:8000"
volumes:
- /var/run/dstack.sock:/var/run/dstack.sock
environment:
TINYCLOUD_KEYS_TYPE: Dstack
TINYCLOUD_STORAGE_DATABASE: "${DATABASE_URL}"
TINYCLOUD_STORAGE_BLOCKS_TYPE: S3
TINYCLOUD_STORAGE_BLOCKS_BUCKET: "${S3_BUCKET}"
TINYCLOUD_STORAGE_BLOCKS_ENDPOINT: "${S3_ENDPOINT}"
AWS_ACCESS_KEY_ID: "${AWS_KEY}"
AWS_SECRET_ACCESS_KEY: "${AWS_SECRET}"
AWS_DEFAULT_REGION: "${AWS_REGION}"
TINYCLOUD_LOG_LEVEL: normal
# Enable Prometheus telemetry (metrics, span histograms, pool gauges).
# The metrics handler is intentionally NOT gateway-exposed: port 8001 is
# not published here, so the unauthenticated /metrics endpoint stays
# internal to the CVM.
TINYCLOUD_TELEMETRY__ENABLED: "true"
# The managed Postgres instance allows max_connections = 25 (measured
# 2026-07-29, with some of those reserved for superuser roles). The pool
# default of 100 cannot be satisfied: the node opened and held slots
# until the instance ran out, and further requests failed with
# "Failed to acquire connection from pool: Connection pool timed out"
# after the 30s sqlx default. Keep this below the instance limit with
# headroom for admin/psql access, and raise it only alongside the
# instance's own max_connections.
TINYCLOUD_DATABASE__MAX_CONNECTIONS: "15"
TINYCLOUD_CORS: "true"
# --- addressed sharing (TC-397) ------------------------------------
#
# The public trust document shared with Share and OpenCredentials,
# delivered inline because nothing else can reach this container: the
# image is `FROM scratch` (no shell, so share-api's decode-to-tmpfs
# entrypoint cannot work here) and a dstack deployment uploads only
# this compose file (so there is no host path to bind-mount from).
#
# Seal the base64 of the reviewed trust-bundle.production.json — the
# same bytes share-api serves — into the CVM's encrypted environment as
# SHARE_TRUST_BUNDLE_BASE64. Same variable name and same wire form
# share-api already uses, so one sealed value feeds both services and
# cannot drift between them.
#
# The `:?` form is deliberate: compose refuses to interpolate a partial
# deployment, failing loudly at deploy time rather than letting the node
# die at boot with "share email trust bundle is required".
TINYCLOUD_SHARE_EMAIL__ENABLED: "true"
TINYCLOUD_SHARE_EMAIL__TRUST_BUNDLE_BASE64: "${SHARE_TRUST_BUNDLE_BASE64:?seal the reviewed share-email trust bundle, base64-encoded}"
# The sealed DATABASE_URL already carries sslmode=verify-full as its sole
# query parameter. ROOT_CERT_PATH stays unset so verify-full resolves
# against the compiled-in public root set (TC-363).
TINYCLOUD_SHARE_EMAIL__POSTGRES_TLS__SSLMODE: verify-full
TINYCLOUD_QUOTA_URL: "${TINYCLOUD_QUOTA_URL}"
TINYCLOUD_ADMIN_SECRET: "${TINYCLOUD_ADMIN_SECRET}"
ROCKET_ADDRESS: "0.0.0.0"
ROCKET_MAX_BLOCKING: "1024"
dstack-ingress:
image: dstacktee/dstack-ingress:20250924@sha256:40429d78060ef3066b5f93676bf3ba7c2e9ac47d4648440febfdda558aed4b32
ports:
- "443:443"
depends_on:
- tinycloud
environment:
- DOMAIN=tee.node.tinycloud.xyz
- TARGET_ENDPOINT=http://tinycloud:8000
- CLOUDFLARE_API_TOKEN=${CLOUDFLARE_API_TOKEN}
- GATEWAY_DOMAIN=_.${DSTACK_GATEWAY_DOMAIN}
- CERTBOT_EMAIL=${CERTBOT_EMAIL}
- SET_CAA=true
- DNS_PROVIDER=cloudflare
volumes:
- /var/run/dstack.sock:/var/run/dstack.sock
- cert-data:/etc/letsencrypt
restart: unless-stopped
# The dstack gateway's TLS-terminating routes (<app>-<port>.<domain>:443)
# only forward to compose-published ports, so guest sshd on :22 is
# unreachable via `phala ssh` even with authorized_keys installed.
# Publish a TCP forwarder on 10022 that relays to guest sshd via the
# docker host gateway. Port 10022 exposes ONLY sshd, which is key-gated.
ssh-gateway:
image: alpine/socat:1.8.1.3@sha256:188fe0a22182f81c16def9d1137930121eaa3023f427164e32c0d2f118f79dd6
restart: unless-stopped
ports:
- "10022:10022"
extra_hosts:
- "host.docker.internal:host-gateway"
command: TCP-LISTEN:10022,fork,reuseaddr TCP:host.docker.internal:22
volumes:
cert-data: