@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,541 @@
1
+ ---
2
+ title: "Docker (legacy)"
3
+ description: "Self-host Trigger.dev on your own infrastructure using Docker."
4
+ ---
5
+
6
+ <Note>This is a legacy guide for self-hosting v3 using Docker, you can find the v4 guide [here](/self-hosting/docker).</Note>
7
+
8
+ <Warning>Security, scaling, and reliability concerns are not fully addressed here. This guide is meant for evaluation purposes and won't result in a production-ready deployment.</Warning>
9
+
10
+ ## Overview
11
+
12
+ <Frame>
13
+ <img src="/images/self-hosting.png" alt="Self-hosting architecture" />
14
+ </Frame>
15
+
16
+ The self-hosting guide covers two alternative setups. The first option uses a simple setup where you run everything on one server. With the second option, the webapp and worker components are split on two separate machines.
17
+
18
+ You're going to need at least one Debian (or derivative) machine with Docker and Docker Compose installed. We'll also use Ngrok to expose the webapp to the internet.
19
+
20
+ ## Support
21
+
22
+ It's dangerous to go alone! Join the self-hosting channel on our [Discord server](https://discord.gg/NQTxt5NA7s).
23
+
24
+ ## Caveats
25
+
26
+ <Note>The v3 worker components don't have ARM support yet.</Note>
27
+
28
+ This guide outlines a quick way to start self-hosting Trigger.dev for evaluation purposes - it won't result in a production-ready deployment. Security, scaling, and reliability concerns are not fully addressed here.
29
+
30
+ 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.
31
+
32
+ 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.
33
+
34
+ <Accordion title="Please consider these additional warnings">
35
+ - The [docker checkpoint](https://docs.docker.com/reference/cli/docker/checkpoint/) command is an experimental feature which may not work as expected. It won't be enabled by default. Instead, the containers will stay up and their processes frozen. They won't consume CPU but they _will_ consume RAM.
36
+ - The `docker-provider` does not currently enforce any resource limits. This means your tasks can consume up to the total machine CPU and RAM. Having no limits may be preferable when self-hosting, but can impact the performance of other services.
37
+ - The worker components (not the tasks!) have direct access to the Docker socket. This means they can run any Docker command. To restrict access, you may want to consider using [Docker Socket Proxy](https://github.com/Tecnativa/docker-socket-proxy).
38
+ - The task containers are running with host networking. This means there is no network isolation between them and the host machine. They will be able to access any networked service on the host.
39
+ - There is currently no support for adding multiple worker machines, but we're working on it.
40
+ </Accordion>
41
+
42
+ ## Requirements
43
+
44
+ - 4 CPU
45
+ - 8 GB RAM
46
+ - Debian or derivative
47
+ - Optional: A separate machine for the worker components
48
+
49
+ You will also need a way to expose the webapp to the internet. This can be done with a reverse proxy, or with a service like Ngrok. We will be using the latter in this guide.
50
+
51
+ ## Option 1: Single server
52
+
53
+ This is the simplest setup. You run everything on one server. It's a good option if you have spare capacity on an existing machine, and have no need to independently scale worker capacity.
54
+
55
+ ### Server setup
56
+
57
+ Some very basic steps to get started:
58
+
59
+ 1. [Install Docker](https://docs.docker.com/get-docker/)
60
+ 2. [Install Docker Compose](https://docs.docker.com/compose/install/)
61
+ 3. [Install Ngrok](https://ngrok.com/download)
62
+
63
+ <Accordion title="On a Debian server, you can run these commands">
64
+ ```bash
65
+ # add ngrok repo
66
+ curl -s https://ngrok-agent.s3.amazonaws.com/ngrok.asc | \
67
+ sudo tee /etc/apt/trusted.gpg.d/ngrok.asc >/dev/null && \
68
+ echo "deb https://ngrok-agent.s3.amazonaws.com buster main" | \
69
+ sudo tee /etc/apt/sources.list.d/ngrok.list
70
+
71
+ # add docker repo
72
+ curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc && \
73
+ sudo chmod a+r /etc/apt/keyrings/docker.asc && \
74
+ echo \
75
+ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
76
+ $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
77
+ sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
78
+
79
+ # update and install
80
+ sudo apt-get update
81
+ sudo apt-get install -y \
82
+ docker.io \
83
+ docker-compose-plugin \
84
+ ngrok
85
+ ```
86
+ </Accordion>
87
+
88
+ ### Trigger.dev setup
89
+
90
+ 1. Clone the [Trigger.dev docker repository](https://github.com/triggerdotdev/docker)
91
+
92
+ ```bash
93
+ git clone https://github.com/triggerdotdev/docker
94
+ cd docker
95
+ ```
96
+
97
+ 2. Run the start script and follow the prompts
98
+
99
+ ```bash
100
+ ./start.sh # hint: you can append -d to run in detached mode
101
+ ```
102
+
103
+ #### Manual
104
+
105
+ Alternatively, you can follow these manual steps after cloning the docker repo:
106
+
107
+ 1. Create the `.env` file
108
+
109
+ ```bash
110
+ cp .env.example .env
111
+ ```
112
+
113
+ 2. Generate the required secrets
114
+
115
+ ```bash
116
+ echo MAGIC_LINK_SECRET=$(openssl rand -hex 16)
117
+ echo SESSION_SECRET=$(openssl rand -hex 16)
118
+ echo ENCRYPTION_KEY=$(openssl rand -hex 16)
119
+ echo PROVIDER_SECRET=$(openssl rand -hex 32)
120
+ echo COORDINATOR_SECRET=$(openssl rand -hex 32)
121
+ ```
122
+
123
+ 3. Replace the default secrets in the `.env` file with the generated ones
124
+
125
+ 4. Run docker compose to start the services
126
+
127
+ ```bash
128
+ . lib.sh # source the helper function
129
+ docker_compose -p=trigger up
130
+ ```
131
+
132
+ ### Tunnelling
133
+
134
+ You will need to expose the webapp to the internet. You can use Ngrok for this. If you already have a working reverse proxy setup and a domain, you can skip to the last step.
135
+
136
+ 1. Start Ngrok. You may get prompted to sign up - it's free.
137
+
138
+ ```bash
139
+ ./tunnel.sh
140
+ ```
141
+
142
+ 2. Copy the domain from the output, for example: `1234-42-42-42-42.ngrok-free.app`
143
+
144
+ 3. Uncomment the `TRIGGER_PROTOCOL` and `TRIGGER_DOMAIN` lines in the `.env` file. Set it to the domain you copied.
145
+
146
+ ```bash
147
+ TRIGGER_PROTOCOL=https
148
+ TRIGGER_DOMAIN=1234-42-42-42-42.ngrok-free.app
149
+ ```
150
+
151
+ 4. Quit the start script and launch it again, or run this:
152
+
153
+ ```bash
154
+ ./stop.sh && ./start.sh
155
+ ```
156
+
157
+ ### Registry setup
158
+
159
+ If you want to deploy v3 projects, you will need access to a Docker registry. The [CLI deploy](/cli-deploy) command will push the images, and then the worker machine can pull them when needed. We will use Docker Hub as an example.
160
+
161
+ 1. Sign up for a free account at [Docker Hub](https://hub.docker.com/)
162
+
163
+ 2. Edit the `.env` file and add the registry details
164
+
165
+ ```bash
166
+ DEPLOY_REGISTRY_HOST=docker.io
167
+ DEPLOY_REGISTRY_NAMESPACE=<your_dockerhub_username>
168
+ ```
169
+
170
+ 3. Log in to Docker Hub both locally and your server. For the split setup, this will be the worker machine. You may want to create an [access token](https://hub.docker.com/settings/security) for this.
171
+
172
+ ```bash
173
+ docker login -u <your_dockerhub_username> docker.io
174
+ ```
175
+
176
+ 4. Required on some systems: Run the login command inside the `docker-provider` container so it can pull deployment images to run your tasks.
177
+
178
+ ```bash
179
+ docker exec -ti \
180
+ trigger-docker-provider-1 \
181
+ docker login -u <your_dockerhub_username> docker.io
182
+ ```
183
+
184
+ 5. Restart the services
185
+
186
+ ```bash
187
+ ./stop.sh && ./start.sh
188
+ ```
189
+
190
+ 6. You can now deploy v3 projects using the CLI with these flags:
191
+
192
+ ```
193
+ npx trigger.dev@latest deploy --self-hosted --push
194
+ ```
195
+
196
+ ## Option 2: Split services
197
+
198
+ With this setup, the webapp will run on a different machine than the worker components. This allows independent scaling of your workload capacity.
199
+
200
+ ### Webapp setup
201
+
202
+ All steps are the same as for a single server, except for the following:
203
+
204
+ 1. **Startup.** Run the start script with the `webapp` argument
205
+
206
+ ```bash
207
+ ./start.sh webapp
208
+ ```
209
+
210
+ 2. **Tunnelling.** This is now _required_. Please follow the [tunnelling](/open-source-self-hosting#tunnelling) section.
211
+
212
+ ### Worker setup
213
+
214
+ 1. **Environment variables.** Copy your `.env` file from the webapp to the worker machine:
215
+
216
+ ```bash
217
+ # an example using scp
218
+ scp -3 root@<webapp_machine>:docker/.env root@<worker_machine>:docker/.env
219
+ ```
220
+
221
+ 2. **Startup.** Run the start script with the `worker` argument
222
+
223
+ ```bash
224
+ ./start.sh worker
225
+ ```
226
+
227
+ 3. **Tunnelling.** This is _not_ required for the worker components.
228
+
229
+ 4. **Registry setup.** Follow the [registry setup](/open-source-self-hosting#registry-setup) section but run the last command on the worker machine - note the container name is different:
230
+
231
+ ```bash
232
+ docker exec -ti \
233
+ trigger-worker-docker-provider-1 \
234
+ docker login -u <your_dockerhub_username> docker.io
235
+ ```
236
+
237
+ ## Additional features
238
+
239
+ ### Large payloads
240
+
241
+ By default, payloads over 512KB will be offloaded to S3-compatible storage. If you don't provide the required env vars, runs with payloads larger than this will fail.
242
+
243
+ For example, using Cloudflare R2:
244
+
245
+ ```bash
246
+ OBJECT_STORE_BASE_URL="https://<bucket>.<account>.r2.cloudflarestorage.com"
247
+ OBJECT_STORE_ACCESS_KEY_ID="<r2 access key with read/write access to bucket>"
248
+ OBJECT_STORE_SECRET_ACCESS_KEY="<r2 secret key>"
249
+ ```
250
+
251
+ Alternatively, you can increase the threshold:
252
+
253
+ ```bash
254
+ # size in bytes, example with 5MB threshold
255
+ TASK_PAYLOAD_OFFLOAD_THRESHOLD=5242880
256
+ ```
257
+
258
+ ### Version locking
259
+
260
+ There are several reasons to lock the version of your Docker images:
261
+ - **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.
262
+ - **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.
263
+
264
+ By default, the images will point at the latest versioned release via the `v3` tag. You can override this by specifying a different tag in your `.env` file. For example:
265
+
266
+ ```bash
267
+ TRIGGER_IMAGE_TAG=v3.0.4
268
+ ```
269
+
270
+ ### Auth options
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
+ Depending on your choice of mail provider/transport, you will want to configure a set of variables like one of the following:
275
+
276
+ ##### Resend:
277
+ ```bash
278
+ EMAIL_TRANSPORT=resend
279
+ FROM_EMAIL=
280
+ REPLY_TO_EMAIL=
281
+ RESEND_API_KEY=<your_resend_api_key>
282
+ ```
283
+
284
+ ##### SMTP
285
+
286
+ Note that setting `SMTP_SECURE=false` does _not_ mean the email is sent insecurely.
287
+ This simply means that the connection is secured using the modern STARTTLS protocol command instead of implicit TLS.
288
+ You should only set this to true when the SMTP server host directs you to do so (generally when using port 465)
289
+
290
+ ```bash
291
+ EMAIL_TRANSPORT=smtp
292
+ FROM_EMAIL=
293
+ REPLY_TO_EMAIL=
294
+ SMTP_HOST=<your_smtp_server>
295
+ SMTP_PORT=587
296
+ SMTP_SECURE=false
297
+ SMTP_USER=<your_smtp_username>
298
+ SMTP_PASSWORD=<your_smtp_password>
299
+ ```
300
+
301
+ ##### AWS Simple Email Service
302
+
303
+ Credentials are to be supplied as with any other program using the AWS SDK.
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
+ 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:
313
+
314
+ ```bash
315
+ # every email that does not match this regex will be rejected
316
+ WHITELISTED_EMAILS="^(authorized@yahoo\.com|authorized@gmail\.com)$"
317
+ ```
318
+
319
+ It's currently impossible to restrict GitHub OAuth logins by account name or email like above, so this method is _not recommended_ for self-hosted instances. It's also very easy to lock yourself out of your own instance.
320
+
321
+ <Warning>Only enable GitHub auth if you understand the risks! We strongly advise you against this.</Warning>
322
+
323
+ Your GitHub OAuth app needs a callback URL `https://<your_domain>/auth/github/callback` and you will have to set the following env vars:
324
+
325
+ ```bash
326
+ AUTH_GITHUB_CLIENT_ID=<your_client_id>
327
+ AUTH_GITHUB_CLIENT_SECRET=<your_client_secret>
328
+ ```
329
+
330
+ ### Checkpoint support
331
+
332
+ <Warning>
333
+ This requires an _experimental Docker feature_. Successfully checkpointing a task today, does not
334
+ mean you will be able to restore it tomorrow. Your data may be lost. You've been warned!
335
+ </Warning>
336
+
337
+ Checkpointing allows you to save the state of a running container to disk and restore it later. This can be useful for
338
+ long-running tasks that need to be paused and resumed without losing state. Think fan-out and fan-in, or long waits in email campaigns.
339
+
340
+ The checkpoints will be pushed to the same registry as the deployed images. Please see the [registry setup](#registry-setup) section for more information.
341
+
342
+ #### Requirements
343
+
344
+ - Debian, **NOT** a derivative like Ubuntu
345
+ - Additional storage space for the checkpointed containers
346
+
347
+ #### Setup
348
+
349
+ Underneath the hood this uses Checkpoint and Restore in Userspace, or [CRIU](https://github.com/checkpoint-restore/criu) in short. We'll have to do a few things to get this working:
350
+
351
+ 1. Install CRIU
352
+
353
+ ```bash
354
+ sudo apt-get update
355
+ sudo apt-get install criu
356
+ ```
357
+
358
+ 2. Tweak the config so we can successfully checkpoint our workloads
359
+
360
+ ```bash
361
+ mkdir -p /etc/criu
362
+
363
+ cat << EOF >/etc/criu/runc.conf
364
+ tcp-close
365
+ EOF
366
+ ```
367
+
368
+ 3. Make sure everything works
369
+
370
+ ```bash
371
+ sudo criu check
372
+ ```
373
+
374
+ 3. Enable Docker experimental features, by adding the following to `/etc/docker/daemon.json`
375
+
376
+ ```json
377
+ {
378
+ "experimental": true
379
+ }
380
+ ```
381
+
382
+ 4. Restart the Docker daemon
383
+
384
+ ```bash
385
+ sudo systemctl restart docker
386
+ ```
387
+
388
+ 5. Uncomment `FORCE_CHECKPOINT_SIMULATION=0` in your `.env` file. Alternatively, run this:
389
+
390
+ ```bash
391
+ echo "FORCE_CHECKPOINT_SIMULATION=0" >> .env
392
+ ```
393
+
394
+ 6. Restart the services
395
+
396
+ ```bash
397
+ # if you're running everything on the same machine
398
+ ./stop.sh && ./start.sh
399
+
400
+ # if you're running the worker on a different machine
401
+ ./stop.sh worker && ./start.sh worker
402
+ ```
403
+
404
+ ## Updating
405
+
406
+ Once you have everything set up, you will periodically want to update your Docker images. You can easily do this by running the update script and restarting your services:
407
+
408
+ ```bash
409
+ ./update.sh
410
+ ./stop.sh && ./start.sh
411
+ ```
412
+
413
+ Sometimes, we will make more extensive changes that require pulling updated compose files, scripts, etc from our docker repo:
414
+
415
+ ```bash
416
+ git pull
417
+ ./stop.sh && ./start.sh
418
+ ```
419
+
420
+ Occasionally, you may also have to update your `.env` file, but we will try to keep these changes to a minimum. Check the `.env.example` file for new variables.
421
+
422
+ ### From beta
423
+
424
+ If you're coming from the beta CLI package images, you will need to:
425
+ - **Stash you changes.** If you made any changes, stash them with `git stash`.
426
+ - **Switch branches.** We moved back to main. Run `git checkout main` in your docker repo.
427
+ - **Pull in updates.** We've added a new container for [Electric](https://github.com/electric-sql/electric) and made some other improvements. Run `git pull` to get the latest updates.
428
+ - **Apply your changes.** If you stashed your changes, apply them with `git stash pop`.
429
+ - **Update your images.** We've also published new images. Run `./update.sh` to pull them.
430
+ - **Restart all services.** Run `./stop.sh && ./start.sh` and you're good to go.
431
+
432
+ In summary, run this wherever you cloned the docker repo:
433
+
434
+ ```bash
435
+ # if you made changes
436
+ git stash
437
+
438
+ # switch to the main branch and pull the latest changes
439
+ git checkout main
440
+ git pull
441
+
442
+ # if you stashed your changes
443
+ git stash pop
444
+
445
+ # update and restart your services
446
+ ./update.sh
447
+ ./stop.sh && ./start.sh
448
+ ```
449
+
450
+ ## Troubleshooting
451
+
452
+ - **Deployment fails at the push step.** The machine running `deploy` needs registry access:
453
+
454
+ ```bash
455
+ docker login -u <username> <registry>
456
+ # this should now succeed
457
+ npx trigger.dev@latest deploy --self-hosted --push
458
+ ```
459
+
460
+ - **Prod runs fail to start.** The `docker-provider` needs registry access:
461
+
462
+ ```bash
463
+ # single server? run this:
464
+ docker exec -ti \
465
+ trigger-docker-provider-1 \
466
+ docker login -u <your_dockerhub_username> docker.io
467
+
468
+ # split webapp and worker? run this on the worker:
469
+ docker exec -ti \
470
+ trigger-worker-docker-provider-1 \
471
+ docker login -u <your_dockerhub_username> docker.io
472
+ ```
473
+
474
+ ## CLI usage
475
+
476
+ 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.
477
+
478
+ ### Login
479
+
480
+ To avoid being redirected to the [Trigger.dev Cloud](https://cloud.trigger.dev) login page when using the CLI, you can specify the URL of your self-hosted instance with the `--api-url` or `-a` flag. For example:
481
+
482
+ ```bash
483
+ npx trigger.dev@latest login -a http://trigger.example.com
484
+ ```
485
+
486
+ Once you've logged in, the CLI will remember your login details and you won't need to specify the URL again with other commands.
487
+
488
+ #### Custom profiles
489
+
490
+ You can specify a custom profile when logging in. This allows you to easily use the CLI with our cloud product and your self-hosted instance at the same time. For example:
491
+
492
+ ```
493
+ npx trigger.dev@latest login -a http://trigger.example.com --profile my-profile
494
+ ```
495
+
496
+ You can then use this profile with other commands:
497
+
498
+ ```
499
+ npx trigger.dev@latest dev --profile my-profile
500
+ ```
501
+
502
+ To list all your profiles, use the `list-profiles` command:
503
+
504
+ ```
505
+ npx trigger.dev@latest list-profiles
506
+ ```
507
+
508
+ #### Verify login
509
+
510
+ It can be useful to check you have successfully logged in to the correct instance. You can do this with the `whoami` command, which will also show the API URL:
511
+
512
+ ```bash
513
+ npx trigger.dev@latest whoami
514
+
515
+ # with a custom profile
516
+ npx trigger.dev@latest whoami --profile my-profile
517
+ ```
518
+
519
+ ### Deploy
520
+
521
+ On [Trigger.dev Cloud](https://cloud.trigger.dev), we build deployments remotely and push those images for you. When self-hosting you will have to do that locally yourself. This can be done with the `--self-hosted` and `--push` flags. For example:
522
+
523
+ ```
524
+ npx trigger.dev@latest deploy --self-hosted --push
525
+ ```
526
+
527
+ ### CI / GitHub Actions
528
+
529
+ 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
530
+ variables to point at your self-hosted instance and authenticate.
531
+
532
+ For more detailed instructions, see the [GitHub Actions guide](/github-actions).
533
+
534
+
535
+ ## Telemetry
536
+
537
+ 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 in your `.env` file. The value doesn't matter, it just can't be empty. For example:
538
+
539
+ ```bash
540
+ TRIGGER_TELEMETRY_DISABLED=1
541
+ ```