@trigger.dev/sdk 4.5.0-rc.5 → 4.5.0-rc.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (213) hide show
  1. package/dist/commonjs/v3/ai.d.ts +178 -5
  2. package/dist/commonjs/v3/ai.js +603 -119
  3. package/dist/commonjs/v3/ai.js.map +1 -1
  4. package/dist/commonjs/v3/chat-client.js +3 -0
  5. package/dist/commonjs/v3/chat-client.js.map +1 -1
  6. package/dist/commonjs/v3/chat-react.js +10 -7
  7. package/dist/commonjs/v3/chat-react.js.map +1 -1
  8. package/dist/commonjs/v3/chat-server.d.ts +8 -0
  9. package/dist/commonjs/v3/chat-server.js +32 -10
  10. package/dist/commonjs/v3/chat-server.js.map +1 -1
  11. package/dist/commonjs/v3/chat-server.test.js +51 -0
  12. package/dist/commonjs/v3/chat-server.test.js.map +1 -1
  13. package/dist/commonjs/v3/chat.js +34 -6
  14. package/dist/commonjs/v3/chat.js.map +1 -1
  15. package/dist/commonjs/v3/chat.test.js +53 -0
  16. package/dist/commonjs/v3/chat.test.js.map +1 -1
  17. package/dist/commonjs/v3/createStartSessionAction.test.js +30 -0
  18. package/dist/commonjs/v3/createStartSessionAction.test.js.map +1 -1
  19. package/dist/commonjs/v3/sessions.d.ts +11 -6
  20. package/dist/commonjs/v3/sessions.js +10 -5
  21. package/dist/commonjs/v3/sessions.js.map +1 -1
  22. package/dist/commonjs/v3/test/mock-chat-agent.d.ts +6 -0
  23. package/dist/commonjs/v3/test/mock-chat-agent.js +1 -0
  24. package/dist/commonjs/v3/test/mock-chat-agent.js.map +1 -1
  25. package/dist/commonjs/version.js +1 -1
  26. package/dist/esm/v3/ai.d.ts +178 -5
  27. package/dist/esm/v3/ai.js +603 -120
  28. package/dist/esm/v3/ai.js.map +1 -1
  29. package/dist/esm/v3/chat-client.js +3 -0
  30. package/dist/esm/v3/chat-client.js.map +1 -1
  31. package/dist/esm/v3/chat-react.js +10 -7
  32. package/dist/esm/v3/chat-react.js.map +1 -1
  33. package/dist/esm/v3/chat-server.d.ts +8 -0
  34. package/dist/esm/v3/chat-server.js +32 -10
  35. package/dist/esm/v3/chat-server.js.map +1 -1
  36. package/dist/esm/v3/chat-server.test.js +51 -0
  37. package/dist/esm/v3/chat-server.test.js.map +1 -1
  38. package/dist/esm/v3/chat.js +34 -6
  39. package/dist/esm/v3/chat.js.map +1 -1
  40. package/dist/esm/v3/chat.test.js +53 -0
  41. package/dist/esm/v3/chat.test.js.map +1 -1
  42. package/dist/esm/v3/createStartSessionAction.test.js +30 -0
  43. package/dist/esm/v3/createStartSessionAction.test.js.map +1 -1
  44. package/dist/esm/v3/sessions.d.ts +11 -6
  45. package/dist/esm/v3/sessions.js +10 -5
  46. package/dist/esm/v3/sessions.js.map +1 -1
  47. package/dist/esm/v3/test/mock-chat-agent.d.ts +6 -0
  48. package/dist/esm/v3/test/mock-chat-agent.js +1 -0
  49. package/dist/esm/v3/test/mock-chat-agent.js.map +1 -1
  50. package/dist/esm/version.js +1 -1
  51. package/docs/ai/prompts.mdx +430 -0
  52. package/docs/ai-chat/actions.mdx +115 -0
  53. package/docs/ai-chat/anatomy.mdx +71 -0
  54. package/docs/ai-chat/backend.mdx +817 -0
  55. package/docs/ai-chat/background-injection.mdx +221 -0
  56. package/docs/ai-chat/changelog.mdx +850 -0
  57. package/docs/ai-chat/chat-local.mdx +174 -0
  58. package/docs/ai-chat/client-protocol.mdx +1081 -0
  59. package/docs/ai-chat/compaction.mdx +411 -0
  60. package/docs/ai-chat/custom-agents.mdx +364 -0
  61. package/docs/ai-chat/error-handling.mdx +415 -0
  62. package/docs/ai-chat/fast-starts.mdx +672 -0
  63. package/docs/ai-chat/frontend.mdx +580 -0
  64. package/docs/ai-chat/how-it-works.mdx +230 -0
  65. package/docs/ai-chat/lifecycle-hooks.mdx +530 -0
  66. package/docs/ai-chat/mcp.mdx +101 -0
  67. package/docs/ai-chat/overview.mdx +90 -0
  68. package/docs/ai-chat/patterns/branching-conversations.mdx +284 -0
  69. package/docs/ai-chat/patterns/code-sandbox.mdx +126 -0
  70. package/docs/ai-chat/patterns/database-persistence.mdx +414 -0
  71. package/docs/ai-chat/patterns/human-in-the-loop.mdx +275 -0
  72. package/docs/ai-chat/patterns/large-payloads.mdx +169 -0
  73. package/docs/ai-chat/patterns/oom-resilience.mdx +120 -0
  74. package/docs/ai-chat/patterns/persistence-and-replay.mdx +211 -0
  75. package/docs/ai-chat/patterns/recovery-boot.mdx +230 -0
  76. package/docs/ai-chat/patterns/skills.mdx +221 -0
  77. package/docs/ai-chat/patterns/sub-agents.mdx +383 -0
  78. package/docs/ai-chat/patterns/tool-result-auditing.mdx +148 -0
  79. package/docs/ai-chat/patterns/trusted-edge-signals.mdx +337 -0
  80. package/docs/ai-chat/patterns/version-upgrades.mdx +172 -0
  81. package/docs/ai-chat/pending-messages.mdx +343 -0
  82. package/docs/ai-chat/prompt-caching.mdx +206 -0
  83. package/docs/ai-chat/quick-start.mdx +161 -0
  84. package/docs/ai-chat/reference.mdx +909 -0
  85. package/docs/ai-chat/server-chat.mdx +263 -0
  86. package/docs/ai-chat/sessions.mdx +333 -0
  87. package/docs/ai-chat/testing.mdx +682 -0
  88. package/docs/ai-chat/tools.mdx +191 -0
  89. package/docs/ai-chat/types.mdx +242 -0
  90. package/docs/ai-chat/upgrade-guide.mdx +515 -0
  91. package/docs/apikeys.mdx +54 -0
  92. package/docs/building-with-ai.mdx +261 -0
  93. package/docs/bulk-actions.mdx +49 -0
  94. package/docs/changelog.mdx +6 -0
  95. package/docs/cli-deploy-commands.mdx +9 -0
  96. package/docs/cli-dev-commands.mdx +9 -0
  97. package/docs/cli-dev.mdx +8 -0
  98. package/docs/cli-init-commands.mdx +58 -0
  99. package/docs/cli-introduction.mdx +25 -0
  100. package/docs/cli-list-profiles-commands.mdx +42 -0
  101. package/docs/cli-login-commands.mdx +33 -0
  102. package/docs/cli-logout-commands.mdx +33 -0
  103. package/docs/cli-preview-archive.mdx +59 -0
  104. package/docs/cli-promote-commands.mdx +9 -0
  105. package/docs/cli-switch.mdx +43 -0
  106. package/docs/cli-update-commands.mdx +42 -0
  107. package/docs/cli-whoami-commands.mdx +33 -0
  108. package/docs/community.mdx +6 -0
  109. package/docs/config/config-file.mdx +602 -0
  110. package/docs/config/extensions/additionalFiles.mdx +38 -0
  111. package/docs/config/extensions/additionalPackages.mdx +40 -0
  112. package/docs/config/extensions/aptGet.mdx +34 -0
  113. package/docs/config/extensions/audioWaveform.mdx +20 -0
  114. package/docs/config/extensions/custom.mdx +380 -0
  115. package/docs/config/extensions/emitDecoratorMetadata.mdx +29 -0
  116. package/docs/config/extensions/esbuildPlugin.mdx +31 -0
  117. package/docs/config/extensions/ffmpeg.mdx +45 -0
  118. package/docs/config/extensions/lightpanda.mdx +56 -0
  119. package/docs/config/extensions/overview.mdx +67 -0
  120. package/docs/config/extensions/playwright.mdx +195 -0
  121. package/docs/config/extensions/prismaExtension.mdx +1014 -0
  122. package/docs/config/extensions/puppeteer.mdx +30 -0
  123. package/docs/config/extensions/pythonExtension.mdx +182 -0
  124. package/docs/config/extensions/syncEnvVars.mdx +291 -0
  125. package/docs/context.mdx +235 -0
  126. package/docs/database-connections.mdx +213 -0
  127. package/docs/deploy-environment-variables.mdx +435 -0
  128. package/docs/deployment/atomic-deployment.mdx +172 -0
  129. package/docs/deployment/overview.mdx +257 -0
  130. package/docs/deployment/preview-branches.mdx +224 -0
  131. package/docs/errors-retrying.mdx +379 -0
  132. package/docs/github-actions.mdx +222 -0
  133. package/docs/github-integration.mdx +136 -0
  134. package/docs/github-repo.mdx +8 -0
  135. package/docs/help-email.mdx +6 -0
  136. package/docs/help-slack.mdx +11 -0
  137. package/docs/hidden-tasks.mdx +56 -0
  138. package/docs/how-it-works.mdx +454 -0
  139. package/docs/how-to-reduce-your-spend.mdx +217 -0
  140. package/docs/idempotency.mdx +504 -0
  141. package/docs/introduction.mdx +223 -0
  142. package/docs/limits.mdx +241 -0
  143. package/docs/logging.mdx +195 -0
  144. package/docs/machines.mdx +952 -0
  145. package/docs/manual-setup.mdx +632 -0
  146. package/docs/mcp-agent-rules.mdx +41 -0
  147. package/docs/mcp-introduction.mdx +385 -0
  148. package/docs/mcp-tools.mdx +273 -0
  149. package/docs/migrating-from-v3.mdx +334 -0
  150. package/docs/observability/dashboards.mdx +102 -0
  151. package/docs/observability/query.mdx +585 -0
  152. package/docs/open-source-contributing.mdx +16 -0
  153. package/docs/open-source-self-hosting.mdx +541 -0
  154. package/docs/private-networking/aws-console-setup.mdx +304 -0
  155. package/docs/private-networking/overview.mdx +144 -0
  156. package/docs/private-networking/troubleshooting.mdx +78 -0
  157. package/docs/queue-concurrency.mdx +354 -0
  158. package/docs/quick-start.mdx +97 -0
  159. package/docs/realtime/auth.mdx +208 -0
  160. package/docs/realtime/backend/overview.mdx +45 -0
  161. package/docs/realtime/backend/streams.mdx +418 -0
  162. package/docs/realtime/backend/subscribe.mdx +225 -0
  163. package/docs/realtime/how-it-works.mdx +94 -0
  164. package/docs/realtime/overview.mdx +63 -0
  165. package/docs/realtime/react-hooks/overview.mdx +73 -0
  166. package/docs/realtime/react-hooks/streams.mdx +449 -0
  167. package/docs/realtime/react-hooks/subscribe.mdx +674 -0
  168. package/docs/realtime/react-hooks/swr.mdx +87 -0
  169. package/docs/realtime/react-hooks/triggering.mdx +194 -0
  170. package/docs/realtime/react-hooks/use-wait-token.mdx +34 -0
  171. package/docs/realtime/run-object.mdx +174 -0
  172. package/docs/replaying.mdx +72 -0
  173. package/docs/request-feature.mdx +6 -0
  174. package/docs/roadmap.mdx +6 -0
  175. package/docs/run-tests.mdx +20 -0
  176. package/docs/run-usage.mdx +113 -0
  177. package/docs/runs/heartbeats.mdx +38 -0
  178. package/docs/runs/max-duration.mdx +139 -0
  179. package/docs/runs/metadata.mdx +734 -0
  180. package/docs/runs/priority.mdx +31 -0
  181. package/docs/runs.mdx +396 -0
  182. package/docs/self-hosting/docker.mdx +458 -0
  183. package/docs/self-hosting/env/supervisor.mdx +74 -0
  184. package/docs/self-hosting/env/webapp.mdx +276 -0
  185. package/docs/self-hosting/kubernetes.mdx +601 -0
  186. package/docs/self-hosting/overview.mdx +108 -0
  187. package/docs/skills.mdx +85 -0
  188. package/docs/tags.mdx +120 -0
  189. package/docs/tasks/overview.mdx +697 -0
  190. package/docs/tasks/scheduled.mdx +382 -0
  191. package/docs/tasks/schemaTask.mdx +413 -0
  192. package/docs/tasks/streams.mdx +884 -0
  193. package/docs/triggering.mdx +1320 -0
  194. package/docs/troubleshooting-alerts.mdx +385 -0
  195. package/docs/troubleshooting-debugging-in-vscode.mdx +8 -0
  196. package/docs/troubleshooting-github-issues.mdx +6 -0
  197. package/docs/troubleshooting-uptime-status.mdx +6 -0
  198. package/docs/troubleshooting.mdx +398 -0
  199. package/docs/upgrading-packages.mdx +80 -0
  200. package/docs/vercel-integration.mdx +207 -0
  201. package/docs/versioning.mdx +56 -0
  202. package/docs/video-walkthrough.mdx +23 -0
  203. package/docs/wait-for-token.mdx +540 -0
  204. package/docs/wait-for.mdx +42 -0
  205. package/docs/wait-until.mdx +53 -0
  206. package/docs/wait.mdx +18 -0
  207. package/docs/writing-tasks-introduction.mdx +33 -0
  208. package/package.json +10 -6
  209. package/skills/trigger-authoring-chat-agent/SKILL.md +296 -0
  210. package/skills/trigger-authoring-tasks/SKILL.md +254 -0
  211. package/skills/trigger-chat-agent-advanced/SKILL.md +368 -0
  212. package/skills/trigger-cost-savings/SKILL.md +116 -0
  213. package/skills/trigger-realtime-and-frontend/SKILL.md +276 -0
@@ -0,0 +1,458 @@
1
+ ---
2
+ title: "Docker compose"
3
+ description: "You can self-host Trigger.dev on your own infrastructure using Docker."
4
+ ---
5
+
6
+ The following instructions will use docker compose to spin up a Trigger.dev instance. Make sure to read the self-hosting [overview](/self-hosting/overview) first.
7
+
8
+ As self-hosted deployments tend to have unique requirements and configurations, we don't provide specific advice for securing your deployment, scaling up, or improving reliability.
9
+
10
+ Should the burden ever get too much, we'd be happy to see you on [Trigger.dev cloud](https://trigger.dev/pricing) where we deal with these concerns for you.
11
+
12
+ **Warning:** This guide alone is unlikely to result in a production-ready deployment. Security, scaling, and reliability concerns are not fully addressed here.
13
+
14
+ ## What's new?
15
+
16
+ Goodbye v3, hello v4! We made quite a few changes:
17
+
18
+ - **Much simpler setup.** The provider and coordinator are now combined into a single supervisor. No more startup scripts, just `docker compose up`.
19
+ - **Automatic container cleanup.** The supervisor will automatically clean up containers that are no longer needed.
20
+ - **Support for multiple worker machines.** This is a big one, and we're very excited about it! You can now scale your workers horizontally as needed.
21
+ - **Resource limits enforced by default.** This means that tasks will be limited to the total CPU and RAM of the machine preset, preventing noisy neighbours.
22
+ - **No direct Docker socket access.** The compose file now comes with [Docker Socket Proxy](https://github.com/Tecnativa/docker-socket-proxy) by default. Yes, you want this.
23
+ - **No host networking.** All containers are now running with network isolation, using only the network access they need.
24
+ - **No checkpoint support.** This was only ever experimental when self-hosting and not recommended. It caused a bunch of issues. We decided to focus on the core features instead.
25
+ - **Built-in container registry and object storage.** You can now deploy and execute tasks without needing third party services for this.
26
+ - **Improved CLI commands.** You don't need any additional flags to deploy anymore, and there's a new command to easily `switch` between profiles.
27
+ - **Whitelisting for GitHub OAuth.** Any whitelisted email addresses will now also apply to sign ins via GitHub, unlike v3 where they only applied to magic links.
28
+
29
+ ## Requirements
30
+
31
+ These are the minimum requirements for running the webapp and worker components. They can run on the same, or on separate machines.
32
+
33
+ It's fine to run everything on the same machine for testing. To be able to scale your workers, you will want to run them separately.
34
+
35
+ ### Prerequisites
36
+
37
+ To run the webapp and worker components, you will need:
38
+
39
+ - [Docker](https://docs.docker.com/get-docker/) 20.10.0+
40
+ - [Docker Compose](https://docs.docker.com/compose/install/) 2.20.0+
41
+
42
+ ### Webapp
43
+
44
+ This machine will host the webapp, postgres, redis, and related services.
45
+
46
+ - 3+ vCPU
47
+ - 6+ GB RAM
48
+
49
+ ### Worker
50
+
51
+ This machine will host the supervisor and all of the runs.
52
+
53
+ - 4+ vCPU
54
+ - 8+ GB RAM
55
+
56
+ How many workers and resources you need will depend on your workloads and concurrency requirements.
57
+
58
+ For example:
59
+
60
+ - 10 concurrency x `small-1x` (0.5 vCPU, 0.5 GB RAM) = 5 vCPU and 5 GB RAM
61
+ - 20 concurrency x `small-1x` (0.5 vCPU, 0.5 GB RAM) = 10 vCPU and 10 GB RAM
62
+ - 100 concurrency x `small-1x` (0.5 vCPU, 0.5 GB RAM) = 50 vCPU and 50 GB RAM
63
+ - 100 concurrency x `small-2x` (1 vCPU, 1 GB RAM) = 100 vCPU and 100 GB RAM
64
+
65
+ You may need to spin up multiple workers to handle peak concurrency. The good news is you don't have to know the exact numbers upfront. You can start with a single worker and add more as needed.
66
+
67
+ ## Setup
68
+
69
+ ### Webapp
70
+
71
+ 1. Clone the repository
72
+
73
+ ```bash
74
+ git clone --depth=1 https://github.com/triggerdotdev/trigger.dev
75
+ cd trigger.dev/hosting/docker
76
+ ```
77
+
78
+ 2. Create a `.env` file
79
+
80
+ ```bash
81
+ cp .env.example .env
82
+ ```
83
+
84
+ 3. Start the webapp
85
+
86
+ ```bash
87
+ cd webapp
88
+ docker compose up -d
89
+ ```
90
+
91
+ 4. Configure the webapp using the [environment variables](/self-hosting/env/webapp) in your `.env` file, then apply the changes:
92
+
93
+ ```bash
94
+ docker compose up -d
95
+ ```
96
+
97
+ 5. You should now be able to access the webapp at `http://localhost:8030`. When logging in, check the container logs for the magic link:
98
+
99
+ ```bash
100
+ docker compose logs -f webapp
101
+ ```
102
+
103
+ 6. (optional) To initialize a new project, run the following command:
104
+
105
+ ```bash
106
+ npx trigger.dev@latest init -p <project-ref> -a http://localhost:8030
107
+ ```
108
+
109
+ ### Worker
110
+
111
+ 1. Clone the repository
112
+
113
+ ```bash
114
+ git clone --depth=1 https://github.com/triggerdotdev/trigger.dev
115
+ cd trigger.dev/hosting/docker
116
+ ```
117
+
118
+ 2. Create a `.env` file
119
+
120
+ ```bash
121
+ cp .env.example .env
122
+ ```
123
+
124
+ 3. Start the worker
125
+
126
+ ```bash
127
+ cd worker
128
+ docker compose up -d
129
+ ```
130
+
131
+ 4. Configure the supervisor using the [environment variables](/self-hosting/env/supervisor) in your `.env` file, including the [worker token](#worker-token).
132
+
133
+ 5. Apply the changes:
134
+
135
+ ```bash
136
+ docker compose up -d
137
+ ```
138
+
139
+ 6. Repeat as needed for additional workers.
140
+
141
+ ### Combined
142
+
143
+ If you want to run the webapp and worker on the same machine, just replace the `up` command with the following:
144
+
145
+ ```bash
146
+ # Run this from the /hosting/docker directory
147
+ docker compose -f webapp/docker-compose.yml -f worker/docker-compose.yml up -d
148
+ ```
149
+
150
+ ## Worker token
151
+
152
+ When running the combined stack, worker bootstrap is handled automatically. When running the webapp and worker separately, you will need to manually set the worker token.
153
+
154
+ On the first run, the webapp will generate a worker token and store it in a shared volume. It will also print the token to the console. It should look something like this:
155
+
156
+ ```bash
157
+ ==========================
158
+ Trigger.dev Bootstrap - Worker Token
159
+
160
+ WARNING: This will only be shown once. Save it now!
161
+
162
+ Worker group:
163
+ bootstrap
164
+
165
+ Token:
166
+ tr_wgt_fgfAEjsTmvl4lowBLTbP7Xo563UlnVa206mr9uW6
167
+
168
+ If using docker compose, set:
169
+ TRIGGER_WORKER_TOKEN=tr_wgt_fgfAEjsTmvl4lowBLTbP7Xo563UlnVa206mr9uW6
170
+
171
+ Or, if using a file:
172
+ TRIGGER_WORKER_TOKEN=file:///home/node/shared/worker_token
173
+
174
+ ==========================
175
+ ```
176
+
177
+ You can then uncomment and set the `TRIGGER_WORKER_TOKEN` environment variable in your `.env` file.
178
+
179
+ Don't forget to restart the worker container for the changes to take effect:
180
+
181
+ ```bash
182
+ # Run this from the /hosting/docker/worker directory
183
+ docker compose down
184
+ docker compose up -d
185
+ ```
186
+
187
+ ### Creating additional worker groups
188
+
189
+ To create additional worker groups beyond the bootstrap group, use the admin API endpoint. This requires admin privileges.
190
+
191
+ **Making a user admin:**
192
+
193
+ - **New users**: Set `ADMIN_EMAILS` environment variable (regex pattern) before user creation.
194
+ - **Existing users**: Set `admin = true` in the `user` table in your database.
195
+
196
+ **Creating a worker group:**
197
+
198
+ ```bash
199
+ api_url=http://localhost:8030
200
+ wg_name=my-worker
201
+ admin_pat=tr_pat_...
202
+
203
+ curl -X POST \
204
+ "$api_url/admin/api/v1/workers" \
205
+ -H "Authorization: Bearer $admin_pat" \
206
+ -H "Content-Type: application/json" \
207
+ -d "{\"name\": \"$wg_name\"}"
208
+ ```
209
+
210
+ The response includes a `token` field if the worker group is newly created.
211
+
212
+ ## Registry setup
213
+
214
+ The registry is used to store and pull deployment images. When testing the stack locally, the defaults should work out of the box.
215
+
216
+ When deploying to production, you will need to set the correct URL and generate secure credentials for the registry.
217
+
218
+ ### Default settings
219
+
220
+ The default settings for the registry are:
221
+
222
+ - Registry: `localhost:5000`
223
+ - Username: `registry-user`
224
+ - Password: `very-secure-indeed`
225
+
226
+ You should change these before deploying to production, especially the password. You can find more information about how to do this in the official [registry docs](https://github.com/distribution/distribution/blob/735c161b53e7faf81a21ba94c55ac9edee081cd9/docs/deploying.md#native-basic-auth).
227
+
228
+ **Note:** This will require modifying the default `.htpasswd` file located at `./hosting/docker/registry/auth.htpasswd` of the repo root.
229
+
230
+ ### Logging in
231
+
232
+ When self-hosting, builds run locally. You will have to login to the registry on every machine that runs the `deploy` command. You should only have to do this once:
233
+
234
+ ```bash
235
+ docker login -u <username> <registry>
236
+ ```
237
+
238
+ This will prompt for the password. Afterwards, the deploy command should work as expected.
239
+
240
+ ## Object storage
241
+
242
+ This is mainly used for large payloads and outputs. There are a few simple steps to follow to get started.
243
+
244
+ ### Default settings
245
+
246
+ The default settings for the object storage are:
247
+
248
+ - Endpoint: `http://localhost:9000`
249
+ - Username: `admin`
250
+ - Password: `very-safe-password`
251
+
252
+ You should change these before deploying to production, especially the password.
253
+
254
+ ### Setup
255
+
256
+ <Note>
257
+ The `packets` bucket is created by default. In case this doesn't work, you can create it manually.
258
+ </Note>
259
+
260
+ 1. Login to the dashboard: `http://localhost:9001`
261
+
262
+ 2. Create a bucket named `packets`.
263
+
264
+ 3. For production, you will want to set up a dedicated user and not use the root credentials above.
265
+
266
+ ## Authentication
267
+
268
+ The specific set of variables required will depend on your choice of email transport or alternative login methods like GitHub OAuth.
269
+
270
+ ### Magic link
271
+
272
+ By default, magic link auth is the only login option. If the `EMAIL_TRANSPORT` env var is not set, the magic links will be logged by the webapp container and not sent via email.
273
+
274
+ #### Resend
275
+
276
+ ```bash
277
+ EMAIL_TRANSPORT=resend
278
+ FROM_EMAIL=
279
+ REPLY_TO_EMAIL=
280
+ RESEND_API_KEY=<your_resend_api_key>
281
+ ```
282
+
283
+ #### SMTP
284
+
285
+ Note that setting `SMTP_SECURE=false` does _not_ mean the email is sent insecurely.
286
+ This simply means that the connection is secured using the modern STARTTLS protocol command instead of implicit TLS.
287
+ You should only set this to true when the SMTP server host directs you to do so (generally when using port 465)
288
+
289
+ ```bash
290
+ EMAIL_TRANSPORT=smtp
291
+ FROM_EMAIL=
292
+ REPLY_TO_EMAIL=
293
+ SMTP_HOST=<your_smtp_server>
294
+ SMTP_PORT=587
295
+ SMTP_SECURE=false
296
+ SMTP_USER=<your_smtp_username>
297
+ SMTP_PASSWORD=<your_smtp_password>
298
+ ```
299
+
300
+ #### AWS SES
301
+
302
+ Credentials are to be supplied as with any other program using the AWS SDK.
303
+
304
+ In this scenario, you would likely either supply the additional environment variables `AWS_REGION`, `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` or, when running on AWS, use credentials supplied by the EC2 IMDS.
305
+
306
+ ```bash
307
+ EMAIL_TRANSPORT=aws-ses
308
+ FROM_EMAIL=
309
+ REPLY_TO_EMAIL=
310
+ ```
311
+
312
+ ### GitHub OAuth
313
+
314
+ To authenticate with GitHub, you will need to set up a GitHub OAuth app. It needs a callback URL `https://<your_webapp_domain>/auth/github/callback` and you will have to set the following env vars:
315
+
316
+ ```bash
317
+ AUTH_GITHUB_CLIENT_ID=<your_client_id>
318
+ AUTH_GITHUB_CLIENT_SECRET=<your_client_secret>
319
+ ```
320
+
321
+ ### Restricting access
322
+
323
+ All email addresses can sign up and log in this way. If you would like to restrict this, you can use the `WHITELISTED_EMAILS` env var. For example:
324
+
325
+ ```bash
326
+ # every email that does not match this regex will be rejected
327
+ WHITELISTED_EMAILS="^(authorized@yahoo\.com|authorized@gmail\.com)$"
328
+ ```
329
+
330
+ This will apply to all auth methods including magic link and GitHub OAuth.
331
+
332
+ ## Version locking
333
+
334
+ There are several reasons to lock the version of your Docker images:
335
+
336
+ - **Backwards compatibility.** We try our best to maintain compatibility with older CLI versions, but it's not always possible. If you don't want to update your CLI, you can lock your Docker images to that specific version.
337
+ - **Ensuring full feature support.** Sometimes, new CLI releases will also require new or updated platform features. Running unlocked images can make any issues difficult to debug. Using a specific tag can help here as well.
338
+
339
+ By default, the images will point at the latest versioned release via the `latest` tag. You can override this by specifying a different tag in your `.env` file. For example:
340
+
341
+ ```bash
342
+ TRIGGER_IMAGE_TAG=v4.0.0
343
+ ```
344
+
345
+ ## Task events
346
+
347
+ By default, task events (timeline, logs, spans) are stored in PostgreSQL. For production deployments we recommend storing them in ClickHouse instead, it scales to much higher volumes and avoids unbounded growth of the `TaskEvent` table.
348
+
349
+ To enable, set on the webapp in your `.env`:
350
+
351
+ ```bash
352
+ EVENT_REPOSITORY_DEFAULT_STORE=clickhouse_v2
353
+ ```
354
+
355
+ This only affects new runs; existing runs continue to read from wherever their events were originally stored.
356
+
357
+ ## Troubleshooting
358
+
359
+ - **Deployment fails at the push step.** The machine running `deploy` needs registry access. See the [registry setup](#registry-setup) section for more details.
360
+
361
+ - **Magic links don't arrive.** The webapp container needs to be able to send emails. You probably need to set up an email transport. See the [authentication](#authentication) section for more details.
362
+
363
+ You should check the logs of the webapp container to see the magic link:
364
+
365
+ ```bash
366
+ # Run this from the /hosting/docker/webapp directory
367
+ docker compose logs -f webapp
368
+ ```
369
+
370
+ - **Deploy fails with `ERROR: schema "graphile_worker" does not exist`.** This error occurs when Graphile Worker migrations fail to run during webapp startup. Check the webapp logs for certificate-related errors like `self-signed certificate in certificate chain`. This is often caused by PostgreSQL SSL certificate issues when using an external PostgreSQL instance with SSL enabled. Ensure that both the webapp and supervisor containers have access to the same CA certificate used by your PostgreSQL instance. You can configure this by mounting the certificate file and setting the `NODE_EXTRA_CA_CERTS` environment variable to point to the certificate path. Once the certificate issue is resolved, the migrations will complete and create the required `graphile_worker` schema.
371
+
372
+ - **ClickHouse migrations say "no migrations to run" but schema is missing.** The goose migration tracker is out of sync. Exec into the webapp container, set the GOOSE env vars (from webapp startup logs), and run `goose reset && goose up`.
373
+
374
+ <Warning>
375
+ **Data Loss Warning:** The `goose reset` command is destructive and will drop the entire schema.
376
+ Make sure to backup your data and confirm you are running this in a non-production environment
377
+ before executing this command.
378
+ </Warning>
379
+
380
+ ## CLI usage
381
+
382
+ This section highlights some of the CLI commands and options that are useful when self-hosting. Please check the [CLI reference](/cli-introduction) for more in-depth documentation.
383
+
384
+ ### Login
385
+
386
+ To avoid being redirected to [Trigger.dev Cloud](https://cloud.trigger.dev) when using the CLI, you need to specify the URL of your self-hosted instance with the `--api-url` or `-a` flag. For example:
387
+
388
+ ```bash
389
+ npx trigger.dev@latest login -a http://trigger.example.com
390
+ ```
391
+
392
+ Once you've logged in, you shouldn't have to specify the URL again with other commands.
393
+
394
+ ### Profiles
395
+
396
+ You can specify a profile when logging in. This allows you to easily use the CLI with multiple instances of Trigger.dev. For example:
397
+
398
+ ```bash
399
+ npx trigger.dev@latest login -a http://trigger.example.com \
400
+ --profile self-hosted
401
+ ```
402
+
403
+ Logging in with a new profile will also make it the new default profile.
404
+
405
+ To use a specific profile, you can use the `--profile` flag with other commands:
406
+
407
+ ```bash
408
+ npx trigger.dev@latest dev --profile self-hosted
409
+ ```
410
+
411
+ To list all your profiles, use the `list-profiles` command:
412
+
413
+ ```bash
414
+ npx trigger.dev@latest list-profiles
415
+ ```
416
+
417
+ To remove a profile, use the `logout` command:
418
+
419
+ ```bash
420
+ npx trigger.dev@latest logout --profile self-hosted
421
+ ```
422
+
423
+ To switch to a different profile, use the `switch` command:
424
+
425
+ ```bash
426
+ # To run interactively
427
+ npx trigger.dev@latest switch
428
+
429
+ # To switch to a specific profile
430
+ npx trigger.dev@latest switch self-hosted
431
+ ```
432
+
433
+ ### Whoami
434
+
435
+ It can be useful to check you are logged into the correct instance. Running this will also show the API URL:
436
+
437
+ ```bash
438
+ npx trigger.dev@latest whoami
439
+ ```
440
+
441
+ ## CI / GitHub Actions
442
+
443
+ When running the CLI in a CI environment, your login profiles won't be available. Instead, you can use the `TRIGGER_API_URL` and `TRIGGER_ACCESS_TOKEN` environment
444
+ variables to point at your self-hosted instance and authenticate.
445
+
446
+ For more detailed instructions, see the [GitHub Actions guide](/github-actions).
447
+
448
+ ## Telemetry
449
+
450
+ By default, the Trigger.dev webapp sends telemetry data to our servers. This data is used to improve the product and is not shared with third parties. If you would like to opt-out of this, you can set the `TRIGGER_TELEMETRY_DISABLED` environment variable on the webapp container. The value doesn't matter, it just can't be empty. For example:
451
+
452
+ ```yaml
453
+ services:
454
+ webapp:
455
+ ...
456
+ environment:
457
+ TRIGGER_TELEMETRY_DISABLED: 1
458
+ ```
@@ -0,0 +1,74 @@
1
+ ---
2
+ title: "Supervisor"
3
+ description: "Environment variables for the supervisor container."
4
+ sidebarTitle: "Supervisor"
5
+ mode: "wide"
6
+ ---
7
+
8
+ | Name | Required | Default | Description |
9
+ | :------------------------------------------ | :------- | :---------- | :---------------------------------------------------------- |
10
+ | **Required settings** | | | |
11
+ | `TRIGGER_API_URL` | Yes | — | Trigger.dev API URL. Should point at the webapp. |
12
+ | `TRIGGER_WORKER_TOKEN` | Yes | — | Worker token (can be a file path with file://). |
13
+ | `MANAGED_WORKER_SECRET` | Yes | — | Managed worker secret. Needs to match webapp value. |
14
+ | `OTEL_EXPORTER_OTLP_ENDPOINT` | Yes | — | OTel exporter endpoint. Point at: `<webapp-url>/otel` |
15
+ | **Worker instance** | | | |
16
+ | `TRIGGER_WORKER_INSTANCE_NAME` | No | random UUID | Worker instance name. Set to `spec.nodeName` on k8s. |
17
+ | `TRIGGER_WORKER_HEARTBEAT_INTERVAL_SECONDS` | No | 30 | Worker heartbeat interval (seconds). |
18
+ | **Workload API settings** | | | |
19
+ | `TRIGGER_WORKLOAD_API_ENABLED` | No | true | Enable workload API. Runs use this to perform actions. |
20
+ | `TRIGGER_WORKLOAD_API_PROTOCOL` | No | http | Workload API protocol (http/https). |
21
+ | `TRIGGER_WORKLOAD_API_DOMAIN` | No | — | Workload API domain. Keep empty for auto-detection. |
22
+ | `TRIGGER_WORKLOAD_API_HOST_INTERNAL` | No | 0.0.0.0 | Workload API internal host. |
23
+ | `TRIGGER_WORKLOAD_API_PORT_INTERNAL` | No | 8020 | Workload API internal port. |
24
+ | `TRIGGER_WORKLOAD_API_PORT_EXTERNAL` | No | 8020 | Workload API external port. |
25
+ | **Runner settings** | | | |
26
+ | `RUNNER_HEARTBEAT_INTERVAL_SECONDS` | No | — | Runner heartbeat interval (seconds). |
27
+ | `RUNNER_SNAPSHOT_POLL_INTERVAL_SECONDS` | No | — | Runner snapshot poll interval (seconds). |
28
+ | `RUNNER_ADDITIONAL_ENV_VARS` | No | — | Additional runner env vars (CSV). |
29
+ | `RUNNER_PRETTY_LOGS` | No | false | Pretty logs for runner. |
30
+ | **Dequeue settings** | | | |
31
+ | `TRIGGER_DEQUEUE_ENABLED` | No | true | Enable dequeue to pull runs from the queue. |
32
+ | `TRIGGER_DEQUEUE_INTERVAL_MS` | No | 250 | Dequeue interval (ms). |
33
+ | `TRIGGER_DEQUEUE_IDLE_INTERVAL_MS` | No | 1000 (1s) | Dequeue idle interval (ms). |
34
+ | `TRIGGER_DEQUEUE_MAX_RUN_COUNT` | No | 10 | Max dequeue run count. |
35
+ | `TRIGGER_DEQUEUE_MAX_CONSUMER_COUNT` | No | 1 | Max dequeue consumer count. |
36
+ | **Docker settings** | | | |
37
+ | `DOCKER_API_VERSION` | No | v1.41 | Docker API version. You should probably not touch this. |
38
+ | `DOCKER_STRIP_IMAGE_DIGEST` | No | true | Strip image digest in Docker. Turning off can cause issues. |
39
+ | `DOCKER_ENFORCE_MACHINE_PRESETS` | No | true | Enforce Docker machine cpu and memory limits. |
40
+ | `DOCKER_AUTOREMOVE_EXITED_CONTAINERS` | No | true | Auto-remove exited containers. |
41
+ | `DOCKER_RUNNER_NETWORKS` | No | host | Docker runner networks (CSV). |
42
+ | **Registry auth** | | | |
43
+ | `DOCKER_REGISTRY_URL` | No | — | Docker registry URL, e.g. `docker.io`. |
44
+ | `DOCKER_REGISTRY_USERNAME` | No | — | Docker registry username. |
45
+ | `DOCKER_REGISTRY_PASSWORD` | No | — | Docker registry password. |
46
+ | **Kubernetes settings** | | | |
47
+ | `KUBERNETES_FORCE_ENABLED` | No | false | Force Kubernetes mode. |
48
+ | `KUBERNETES_NAMESPACE` | No | default | The namespace that runs should be in. |
49
+ | `KUBERNETES_WORKER_NODETYPE_LABEL` | No | v4-worker | Nodes for runs need this label, e.g. `nodetype=v4-worker`. |
50
+ | `KUBERNETES_IMAGE_PULL_SECRETS` | No | — | Image pull secrets (CSV). |
51
+ | `KUBERNETES_EPHEMERAL_STORAGE_SIZE_LIMIT` | No | 10Gi | Ephemeral storage size limit. Applies to all runs. |
52
+ | `KUBERNETES_EPHEMERAL_STORAGE_SIZE_REQUEST` | No | 2Gi | Ephemeral storage size request. Applies to all runs. |
53
+ | **Metrics** | | | |
54
+ | `METRICS_ENABLED` | No | true | Enable metrics. |
55
+ | `METRICS_COLLECT_DEFAULTS` | No | true | Collect default metrics. |
56
+ | `METRICS_HOST` | No | 127.0.0.1 | Metrics host. |
57
+ | `METRICS_PORT` | No | 9090 | Metrics port. |
58
+ | **Pod cleaner** | | | |
59
+ | `POD_CLEANER_ENABLED` | No | true | Enable pod cleaner. |
60
+ | `POD_CLEANER_INTERVAL_MS` | No | 10000 (10s) | Pod cleaner interval (ms). Best not to touch this. |
61
+ | `POD_CLEANER_BATCH_SIZE` | No | 500 | Pod cleaner batch size. |
62
+ | **Failed pod handler** | | | |
63
+ | `FAILED_POD_HANDLER_ENABLED` | No | true | Enable failed pod handler. |
64
+ | `FAILED_POD_HANDLER_RECONNECT_INTERVAL_MS` | No | 1000 (1s) | Failed pod handler reconnect interval (ms). |
65
+ | **Debug** | | | |
66
+ | `DEBUG` | No | false | Enable debug logs. |
67
+ | `SEND_RUN_DEBUG_LOGS` | No | false | Send run debug logs to the platform. |
68
+ | **Not used for self-hosting** | | | |
69
+ | `TRIGGER_WARM_START_URL` | No | — | Warm start URL. |
70
+ | `TRIGGER_CHECKPOINT_URL` | No | — | Checkpoint URL. |
71
+ | `TRIGGER_METADATA_URL` | No | — | Metadata URL. |
72
+ | `RESOURCE_MONITOR_ENABLED` | No | false | Enable resource monitor. |
73
+ | `RESOURCE_MONITOR_OVERRIDE_CPU_TOTAL` | No | — | Override CPU total for resource monitor. |
74
+ | `RESOURCE_MONITOR_OVERRIDE_MEMORY_TOTAL_GB` | No | — | Override memory total (GB) for resource monitor. |