Skip to content

Docs improvements for v4 self hosting #2156

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 7, 2025
Merged

Docs improvements for v4 self hosting #2156

merged 2 commits into from
Jun 7, 2025

Conversation

nicktrn
Copy link
Collaborator

@nicktrn nicktrn commented Jun 7, 2025

This also documents the new switch command.

Copy link

changeset-bot bot commented Jun 7, 2025

⚠️ No Changeset found

Latest commit: b29ef93

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

coderabbitai bot commented Jun 7, 2025

Walkthrough

The changes introduce a new CLI command documentation page for trigger.dev switch, update the CLI documentation navigation order and completeness, and extensively revise self-hosting documentation and configuration for Trigger.dev's Docker-based deployment. The self-hosting Docker documentation is expanded for clarity, operational detail, and improved flow, including new sections on registry, object storage, authentication, and version locking. The .env.example file is reorganized with additional variables, improved comments, and consolidated image tag handling. Docker Compose files for both webapp and worker are updated to use unified image tag variables, allow more environment variable overrides, and clarify network and token configurations. The default Node.js memory allocation is now specified as 8192 MiB. No code or public API changes are present; all modifications are confined to documentation and configuration templates.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
docs/cli-switch.mdx (1)

8-16: Remove unused imports.

Several snippet imports (ProjectPathArg, CommonOptions, ProjectRefOption, EnvFileOption, ConfigFileOption, SkipUpdateCheckOption, BranchOption) are not referenced in this document. Consider removing them to avoid confusion.

docs/self-hosting/docker.mdx (1)

50-50: Minor wording: “all of the runs” → “all runs”
Consider dropping “of” for conciseness:

- This machine will host the supervisor and all of the runs.
+ This machine will host the supervisor and all runs.
🧰 Tools
🪛 LanguageTool

[style] ~50-~50: Consider removing “of” to be more concise
Context: ...is machine will host the supervisor and all of the runs. - 2+ vCPU - 4+ GB RAM How many ...

(ALL_OF_THE)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7a34c11 and b29ef93.

📒 Files selected for processing (7)
  • docs/cli-switch.mdx (1 hunks)
  • docs/docs.json (1 hunks)
  • docs/self-hosting/docker.mdx (7 hunks)
  • docs/self-hosting/env/webapp.mdx (1 hunks)
  • hosting/docker/.env.example (2 hunks)
  • hosting/docker/webapp/docker-compose.yml (3 hunks)
  • hosting/docker/worker/docker-compose.yml (3 hunks)
🧰 Additional context used
🧠 Learnings (1)
hosting/docker/.env.example (1)
Learnt from: nicktrn
PR: triggerdotdev/trigger.dev#2155
File: hosting/docker/.env.example:4-7
Timestamp: 2025-06-06T23:55:01.894Z
Learning: In the trigger.dev project, .env.example files should contain actual example secret values rather than placeholders, as these help users understand the expected format. The files include clear warnings about not using these defaults in production and instructions for generating proper secrets.
🪛 Checkov (3.2.334)
hosting/docker/webapp/docker-compose.yml

[MEDIUM] 32-33: Basic Auth Credentials

(CKV_SECRET_4)

🪛 LanguageTool
docs/self-hosting/docker.mdx

[uncategorized] ~24-~24: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ...eploy and execute tasks without needing third party services for this. - **Improved CLI com...

(EN_COMPOUND_ADJECTIVE_INTERNAL)


[style] ~50-~50: Consider removing “of” to be more concise
Context: ...is machine will host the supervisor and all of the runs. - 2+ vCPU - 4+ GB RAM How many ...

(ALL_OF_THE)


[misspelling] ~217-~217: Did you mean the verb “log in” instead of the noun ‘login’?
Context: ...g, builds run locally. You will have to login to the registry on every machine that r...

(LOG_IN)


[locale-violation] ~223-~223: In American English, ‘afterward’ is the preferred variant. ‘Afterwards’ is more commonly used in British English and other dialects.
Context: ...``` This will prompt for the password. Afterwards, the deploy command should work as expe...

(AFTERWARDS_US)


[grammar] ~223-~223: The word ‘deploy’ is a verb. Did you mean the noun “deployment” (= release, placement)?
Context: ...rompt for the password. Afterwards, the deploy command should work as expected. ## Ob...

(PREPOSITION_VERB)


[uncategorized] ~311-~311: Possible missing comma found.
Context: ....com" ``` This will apply to all auth methods including magic link and GitHub OAuth. ...

(AI_HYDRA_LEO_MISSING_COMMA)

🪛 Gitleaks (8.26.0)
docs/self-hosting/docker.mdx

177-178: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


181-181: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

⏰ Context from checks skipped due to timeout of 90000ms (25)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (10, 10)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (9, 10)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (8, 10)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (7, 10)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (6, 10)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (8, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (5, 10)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (7, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (4, 10)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (6, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (3, 10)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (5, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (2, 10)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (4, 8)
  • GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (1, 10)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (3, 8)
  • GitHub Check: units / packages / 🧪 Unit Tests: Packages (1, 1)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (2, 8)
  • GitHub Check: units / internal / 🧪 Unit Tests: Internal (1, 8)
  • GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - pnpm)
  • GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - npm)
  • GitHub Check: e2e / 🧪 CLI v3 tests (ubuntu-latest - pnpm)
  • GitHub Check: e2e / 🧪 CLI v3 tests (ubuntu-latest - npm)
  • GitHub Check: typecheck / typecheck
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (41)
docs/self-hosting/env/webapp.mdx (1)

129-129: Well-defined default memory allocation.

The addition of NODE_MAX_OLD_SPACE_SIZE with a clear MiB unit is helpful for users to understand and configure Node.js memory.

hosting/docker/worker/docker-compose.yml (4)

5-5: Unified image tag variable.

Switching from SUPERVISOR_IMAGE_TAG to TRIGGER_IMAGE_TAG ensures consistency across services for image versioning.


12-12: Include webapp network.

Adding the webapp network to the supervisor service aligns with the updated networking topology and enables direct communication.


22-23: Explicit worker token path.

Using file:///home/node/shared/worker_token makes the source of the token clear and matches the documentation for bootstrap token creation.


77-78: Declare webapp network.

Defining the webapp network at the bottom ensures Docker Compose recognizes and creates it for all services.

docs/docs.json (1)

143-153: Update CLI commands navigation order.

Reordering cli-dev-commands before cli-init-commands and appending new entries (cli-login-commands, cli-logout-commands, cli-preview-archive, cli-promote-commands, cli-switch, cli-update-commands, cli-whoami-commands) correctly integrates the new switch command into the CLI section.

docs/cli-switch.mdx (3)

1-6: Frontmatter metadata looks good.

The title, sidebarTitle, description, and tag align with the format of other CLI command pages.


19-35: Usage examples are clear.

The CodeGroup usage section correctly demonstrates how to run the switch command with npm, pnpm, and yarn.


39-47: Arguments section is concise.

The profile argument is well-explained; omitting the profile will list options interactively.

hosting/docker/webapp/docker-compose.yml (3)

5-5: Unified image tag variable.

Switching to TRIGGER_IMAGE_TAG for the webapp service aligns with other services and the .env.example.


30-30: Expose API_ORIGIN.

Making API_ORIGIN configurable with an override enhances flexibility for different deployment scenarios.


32-33: Default database connection strings.

Providing fallback values for DATABASE_URL and DIRECT_URL simplifies local setups; ensure the SSL mode setting is appropriate for production deployments.
Verification: Confirm if sslmode=disable is acceptable in production or if a secure default is needed.

🧰 Tools
🪛 Checkov (3.2.334)

[MEDIUM] 32-33: Basic Auth Credentials

(CKV_SECRET_4)

docs/self-hosting/docker.mdx (17)

17-18: Clear “What’s new” bullets for v4 features
The new items on simpler setup and automatic container cleanup are concise and informative.


23-25: “What’s new” entries for checkpoint support and CLI switch
The notes on removing checkpoint support and highlighting the new switch command fit well here.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~24-~24: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ...eploy and execute tasks without needing third party services for this. - **Improved CLI com...

(EN_COMPOUND_ADJECTIVE_INTERNAL)


43-43: Clarify webapp host requirements
The description for the webapp host machine is accurate and aligns with the updated architecture.


90-93: Step 4: Reapply compose after env changes
Good call to remind users to run docker compose up -d after editing .env.


96-99: Step 5: Access and log retrieval instructions
Instructions to check logs for the magic link are clear.


102-102: Step 6 (optional): Project initialization command
The npx trigger.dev@v4-beta init example is helpful for getting started.


108-112: Bonus: Traefik reverse proxy commented example
Including a commented example for Traefik is a nice-to-have and clearly marked optional.


136-138: Worker setup: env configuration and apply changes
The supervisor env var section matches the compose updates and is well explained.


144-144: Step 6: Scale additional workers
Clear instruction to repeat for more workers.


152-152: Combined stack compose command
Good inclusion of the combined docker compose -f ... up -d example.


156-160: Combined stack Traefik override commented
Optional Traefik override is properly scoped and commented out.


163-164: Worker token section header and intro
The new “Worker token” header and explanation align with the actual bootstrap flow.


189-191: Instructions to set and restart worker token
The guidance on uncommenting TRIGGER_WORKER_TOKEN and restarting is clear.


331-336: Troubleshooting: log inspection snippet
The log command example is precise and correctly scoped.


344-344: CLI usage: “Login” heading
The added “Login” subsection clarifies the first CLI step.

🧰 Tools
🪛 LanguageTool

[style] ~344-~344: You have already used this phrasing in nearby sentences. Consider replacing it to add variety to your writing.
Context: ...ud.trigger.dev) when using the CLI, you need to specify the URL of your self-hosted ins...

(REP_NEED_TO_VB)


352-352: CLI usage: “Profiles” heading
The new “Profiles” section landing spot is consistent with the navigation.


391-391: CLI usage: “Whoami” heading
Adding a “Whoami” subsection helps users verify their login context.

hosting/docker/.env.example (12)

1-5: Header comments clearly set expectations
The top block introduces the file’s purpose and links to docs—perfect for first-time users.


14-20: Worker token placeholders and guidance
Worker token instructions align with the updated bootstrap flow and link back to the docs.


21-29: Postgres defaults with clear production warnings
Credentials and URLs are spelled out with appropriate “do not use in production” notes.


30-34: Unified TRIGGER_IMAGE_TAG guidance
The single image tag variable replaces separate tags and includes version-locking advice.


36-43: Webapp origin variables introduced
APP_ORIGIN, LOGIN_ORIGIN, and API_ORIGIN are configured with sensible defaults.


44-53: Node.js memory management section comprehensive
Heap size recommendations and examples are thorough and clear.


55-62: Docker registry defaults and notes
Registry URL and credentials are documented with production considerations.


64-75: Minio object store example configuration
Access keys, dashboard notes, and bucket instructions are well covered.


76-87: Other service image tags section
Encourages locking all service image tags, matching best practices.


88-98: Publish IPs section for binding control
Examples for local vs production binding are helpful.


100-103: Restart policy template included
Restart policy default commented out with clear commentary.


104-110: Traefik reverse proxy example settings
Traefik env vars are presented as examples with a pointer to override files.

@nicktrn nicktrn merged commit e72820c into main Jun 7, 2025
34 checks passed
@nicktrn nicktrn deleted the docs/v4-self-hosting branch June 7, 2025 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants