Understand how Trigger.dev works and how it can help you.
ffmpeg
and sends the results to an s3 bucket, then updates a database with the results and sends an email to the user.
npx
like so:
npx trigger.dev@latest deploy
, we build and deploy your task code to your Trigger.dev instance. Then, when you trigger a task from your application, it’s run in a secure, isolated environment with the resources you need to complete the task. A simplified diagram for a task execution looks like this:
In reality there are many more components involved, such as the task queue, the task scheduler, and the task worker pool, logging (etc.), but this diagram gives you a high-level overview of how Trigger.dev works.
triggerAndWait
wait.for({ seconds: 30 })
), the system uses CRIU (Checkpoint/Restore In Userspace) to create a checkpoint of the task’s entire state, including memory, CPU registers, and open file descriptors.
convert-video
task above to be more durable:
npx trigger.dev@latest deploy
or npx trigger.dev@latest dev
, we build your task code using our build system, which is powered by esbuild. When deploying, the code is packaged up into a Docker image and deployed to your Trigger.dev instance. When running in dev mode, the code is built and run locally on your machine. Some features of our build system include:
--dry-run
flag, which will output the Containerfile and the build output.
Learn more about working with our build system in the configuration docs.
npx trigger.dev@latest dev
, we run your task code locally on your machine. All scheduling is still done in the Trigger.dev server instance, but the task code is run locally. This allows you to develop and test your tasks locally before deploying them to the cloud, and is especially useful for debugging and testing.
npx trigger.dev@latest deploy --env <env>
, where <env>
is the name of the environment you want to deploy to. Each environment has its own API Key, which you can use to trigger tasks in that environment.