@@ -29,6 +29,80 @@ This is a separate example from [`launcher/`](../launcher), which is a
2929Docker Compose auto-update pattern. This launcher does the opposite — it
3030* prevents* auto-update by pinning to one full commit SHA per deploy.
3131
32+ ## Preparing a workload repo
33+
34+ For a repo you control, use default mode. Put a bash entry script in the repo
35+ and let the launcher do only the Git pinning:
36+
37+ ``` text
38+ example-workload/
39+ entrypoint.sh
40+ ...
41+ ```
42+
43+ ` entrypoint.sh ` is the workload boundary. It should:
44+
45+ * Install or validate whatever runtime the workload needs.
46+ * Build or prepare the application from the pinned source tree.
47+ * Be idempotent across container restarts.
48+ * Fail closed when install, build, config validation, or startup fails.
49+ * ` exec ` the long-running workload process so it becomes PID 1.
50+ * Keep mutable state, databases, uploads, retained bodies, and build caches
51+ outside ` WORK_DIR ` .
52+
53+ A minimal shape:
54+
55+ ``` bash
56+ #! /usr/bin/env bash
57+ set -euo pipefail
58+
59+ SCRIPT_DIR=$( cd -- " $( dirname -- " ${BASH_SOURCE[0]} " ) " > /dev/null && pwd)
60+ cd " $SCRIPT_DIR "
61+
62+ # Example only: replace with your workload's real install/build/run steps.
63+ ./scripts/build.sh
64+ exec ./bin/server
65+ ```
66+
67+ Deployment config should keep the source checkout and workload state separate:
68+
69+ ``` yaml
70+ services :
71+ workload :
72+ image : docker.io/<org>/git-launcher@sha256:<launcher-digest>
73+ command : ["/etc/git-launcher/config.conf"]
74+ configs :
75+ - source : pin
76+ target : /etc/git-launcher/config.conf
77+ environment :
78+ APP_CONFIG_PATH : /var/lib/example-workload/config.json
79+ volumes :
80+ - workload-checkout:/var/lib/git-launcher
81+ - workload-state:/var/lib/example-workload
82+ - /var/run/dstack.sock:/var/run/dstack.sock
83+
84+ configs :
85+ pin :
86+ content : |
87+ REPO_URL=https://github.com/example-org/example-workload.git
88+ COMMIT_SHA=<full-40-or-64-hex-sha>
89+ WORK_DIR=/var/lib/git-launcher/example-workload
90+
91+ volumes :
92+ workload-checkout :
93+ workload-state :
94+ ` ` `
95+
96+ Use Docker Compose ` environment:` for non-secret runtime configuration that
97+ should be visible in the attested deployment. Use dstack encrypted secrets,
98+ dstack KMS, or mounted secret files for secrets. If the workload needs dstack
99+ KMS keys or quotes, mount `/var/run/dstack.sock` and let the workload use the
100+ dstack SDK.
101+
102+ Before deploying, audit the workload commit, then put its full commit hash in
103+ ` COMMIT_SHA` . Do not use a branch, tag, or short SHA; the launcher rejects
104+ them.
105+
32106# # What this is — and what it is not
33107
34108The launcher is **not** the workload. It is intentionally tiny so the contents
0 commit comments