GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing trigger.dev — Docker compose - Trigger.dev The following instructions will use docker compose to spin up a Trigger.dev instance. Make sure to read the self-hosting overview first.
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.
Should the burden ever get too much, we’d be happy to see you on Trigger.dev cloud where we deal with these concerns for you.
Warning: This guide alone is unlikely to result in a production-ready deployment. Security, scaling, and reliability concerns are not fully addressed here.
What’s new?Goodbye v3, hello v4! We made quite a few changes:
RequirementsThese are the minimum requirements for running the webapp and worker components. They can run on the same, or on separate machines. 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.PrerequisitesTo run the webapp and worker components, you will need:
WebappThis machine will host the webapp, postgres, redis, and related services.
WorkerThis machine will host the supervisor and all of the runs.
SetupWebapp
The stack ships no working default credentials. generate-secrets.sh fills the
application secrets and the bundled datastore passwords with strong, unique values.
Keep them safe - rotating the encryption key or session secret later will invalidate
existing sessions and encrypted data.
Worker
For a split webapp/worker setup, set MANAGED_WORKER_SECRET on the worker to
the same value as the webapp’s MANAGED_WORKER_SECRET. Don’t run
generate-secrets.sh on the worker host - it would create a mismatched value
and the worker would fail to authenticate.
CombinedIf you want to run the webapp and worker on the same machine, just replace theup command with the following:
Worker tokenWhen 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. 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:TRIGGER_WORKER_TOKEN environment variable in your .env file.
Don’t forget to restart the worker container for the changes to take effect:
Creating additional worker groupsTo create additional worker groups beyond the bootstrap group, use the admin API endpoint. This requires admin privileges. Making a user admin:
token field if the worker group is newly created.
Registry setupThe registry is used to store and pull deployment images. When testing the stack locally, the defaults should work out of the box. When deploying to production, you will need to set the correct URL and generate secure credentials for the registry.Default settingsThe default settings for the registry are:
.htpasswd file located at ./hosting/docker/registry/auth.htpasswd of the repo root.
Logging inWhen self-hosting, builds run locally. You will have to login to the registry on every machine that runs thedeploy command. You should only have to do this once:
Object storageThis is mainly used for large payloads and outputs. There are a few simple steps to follow to get started.Default settingsThe default settings for the object storage are:
SetupThe packets bucket is created by default. In case this doesn’t work, you can create it manually.
AuthenticationThe specific set of variables required will depend on your choice of email transport or alternative login methods like GitHub OAuth.Magic linkBy default, magic link auth is the only login option. If theEMAIL_TRANSPORT env var is not set, the magic links will be logged by the webapp container and not sent via email.
ResendSMTPNote that settingSMTP_SECURE=false does not mean the email is sent insecurely.
This simply means that the connection is secured using the modern STARTTLS protocol command instead of implicit TLS.
You should only set this to true when the SMTP server host directs you to do so (generally when using port 465)
AWS SESCredentials are to be supplied as with any other program using the AWS SDK. In this scenario, you would likely either supply the additional environment variablesAWS_REGION, AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY or, when running on AWS, use credentials supplied by the EC2 IMDS.
GitHub OAuthTo authenticate with GitHub, you will need to set up a GitHub OAuth app. It needs a callback URLhttps://<your_webapp_domain>/auth/github/callback and you will have to set the following env vars:
Restricting accessAll email addresses can sign up and log in this way. If you would like to restrict this, you can use theWHITELISTED_EMAILS env var. For example:
Version lockingThere are several reasons to lock the version of your Docker images:
latest tag. You can override this by specifying a different tag in your .env file. For example:
CLICKHOUSE_IMAGE_TAG. If you do, or if you bring your own ClickHouse via CLICKHOUSE_URL, note that Trigger.dev requires ClickHouse 25.8 or newer.
The bundled ClickHouse uses the official clickhouse/clickhouse-server image, and your existing
data volume carries over automatically on upgrade. If you pinned CLICKHOUSE_IMAGE_TAG to a
Bitnami tag, switch it to an official tag (for example 26.2) — Bitnami tags don’t exist in the
official repository.Trigger.dev 4.5.0 is the last version we officially support for running v3 (SDK v3) tasks. If
you still have v3 tasks, pin TRIGGER_IMAGE_TAG to exactly v4.5.0 or migrate to
v4. 4.5.1 and later reject v3 triggers and deploys with an upgrade message.Task eventsBy 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 theTaskEvent table.
To enable, set on the webapp in your .env:
Move from the legacy clickhouse storeThe legacyclickhouse store (the task_events_v1 table) is retired. If you set EVENT_REPOSITORY_DEFAULT_STORE=clickhouse, your webapp now writes and reads clickhouse_v2 instead and logs a warning at startup. Events recorded in task_events_v1 stay there but no longer show in the dashboard until you copy them over.
1 Switch to clickhouse_v2Switch the store in your .env and restart the webapp:.env 2 List the days to copyList the days that hold legacy events. The bundled ClickHouse container already sets CLICKHOUSE_USER and CLICKHOUSE_PASSWORD, and clickhouse-client reads them, so no credentials are needed:3 Save the copy querySave the copy query as copy-task-events-v1.sql. It copies one day and skips events already in task_events_v2, so it’s safe to run again if it’s interrupted:copy-task-events-v1.sql 4 Copy each dayRun it once per day from step 2, oldest first: 5 Check a copied runOpen a run from one of the copied days and check its trace and logs show. task_events_v1, so copy anything you want to keep before then.
EVENT_REPOSITORY_V1_REROUTE_ENABLED=0 keeps the legacy store while you migrate. It’s
temporary and will be removed in a future release.Realtime streamsRealtime streams power AI-agent token streaming and run streams. They default to v2, backed by the bundleds2 service — s2-lite, the open-source, self-hostable S2 server. It stores stream data in a persistent volume and is preconfigured in the webapp compose file, so no setup is required.
To fall back to the Redis-backed v1 streams, set on the webapp in your .env:
Troubleshooting
CLI usageThis section highlights some of the CLI commands and options that are useful when self-hosting. Please check the CLI reference for more in-depth documentation.LoginTo avoid being redirected to Trigger.dev Cloud when using the CLI, you need to specify the URL of your self-hosted instance with the--api-url or -a flag. For example:
ProfilesYou can specify a profile when logging in. This allows you to easily use the CLI with multiple instances of Trigger.dev. For example:--profile flag with other commands:
list-profiles command:
logout command:
switch command:
WhoamiIt can be useful to check you are logged into the correct instance. Running this will also show the API URL:CI / GitHub ActionsWhen running the CLI in a CI environment, your login profiles won’t be available. Instead, you can use theTRIGGER_API_URL and TRIGGER_ACCESS_TOKEN environment
variables to point at your self-hosted instance and authenticate.
For more detailed instructions, see the GitHub Actions guide.
TelemetryBy 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 theTRIGGER_TELEMETRY_DISABLED environment variable on the webapp container. The value doesn’t matter, it just can’t be empty. For example:
Was this page helpful? ⌘I |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |