Skip to content

v3: self-hosting support for latest packages #1319

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 10 commits into from
Sep 18, 2024
Merged

Conversation

nicktrn
Copy link
Collaborator

@nicktrn nicktrn commented Sep 18, 2024

Package changes:

  • Improve index error logging
  • Add network flag for self-hosted deploys
  • Fix checksum flag on some docker versions
  • Add Containerfile debug logs

Docs changes:

  • Removed all remaining beta tags
  • New self-hosting update and version lock sections
  • Clarified push and registry flags

Summary by CodeRabbit

  • New Features

    • Introduced a new network flag for self-hosted deployments, enhancing configuration flexibility.
    • Added a new section in documentation detailing the process for updating Docker images.
  • Bug Fixes

    • Resolved checksum flag handling issues for certain Docker versions to ensure compatibility.
  • Documentation

    • Updated CLI commands and deployment instructions to reflect the transition from beta to the latest version.
    • Enhanced documentation clarity regarding deployment parameters and processes.
    • Removed warnings about the CLI's beta status to improve self-hosting experience.
  • Chores

    • Improved error logging and debug visibility during deployment and image building processes.

Copy link

changeset-bot bot commented Sep 18, 2024

🦋 Changeset detected

Latest commit: be90406

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
trigger.dev Patch
@trigger.dev/build Patch
@trigger.dev/core Patch
@trigger.dev/sdk Patch

Not sure what this means? Click here to learn what changesets are.

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

Copy link
Contributor

coderabbitai bot commented Sep 18, 2024

Caution

Review failed

The pull request is closed.

Walkthrough

This update introduces multiple enhancements to the deployment system, including a new network flag for self-hosted deployments, improved error logging, and adjustments to the handling of the checksum flag for Docker compatibility. Documentation has been updated to reflect the transition from beta to the latest CLI version, and several command-line options have been modified or removed to streamline the deployment process. Overall, these changes aim to improve usability and flexibility in deployment configurations.

Changes

Files Change Summary
.changeset/metal-geckos-pretend.md Introduced enhanced error logging, a new network flag for self-hosted deployments, fixed checksum flag handling for Docker, and added debug logs to the Containerfile.
docs/github-actions.mdx Updated deployment command from trigger.dev@beta to trigger.dev@latest in GitHub Actions workflow.
docs/open-source-self-hosting.mdx Removed beta warning, simplified manual setup, updated commands to use the latest CLI version, added sections on updating Docker images and version locking.
docs/snippets/cli-commands-deploy.mdx Repositioned --skip-deploy parameter, expanded --registry description, updated --push description, and added --network parameter for networking mode.
docs/upgrading-beta.mdx Removed --push option from the deployment command.
packages/cli-v3/src/build/buildWorker.ts Added debug logging for the Containerfile writing process.
packages/cli-v3/src/commands/deploy.ts Introduced a new optional network parameter to specify networking mode for RUN instructions in the deployment command.
packages/cli-v3/src/commands/init.ts Modified output message in _initCommand to include --profile argument based on profile presence.
packages/cli-v3/src/deploy/buildImage.ts Added network property to BuildImageOptions and SelfHostedBuildImageOptions, enhancing image-building flexibility.
packages/cli-v3/src/entryPoints/deploy-index-controller.ts Enhanced error handling in indexDeployment function by adding console error logs for failed indexing.

Possibly related PRs

  • v3: self-hosting support for latest packages #1319: This PR introduces a new network flag for self-hosted deployments and enhances error logging, which directly relates to the main PR's addition of a network flag and improvements in error logging for index-related issues.

🐇 In fields of code where changes bloom,
A network flag brings forth new room.
With logs that shine and commands refined,
The self-hosted path is now aligned.
So hop along, let’s build and deploy,
For every tweak brings us more joy! 🌼


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

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.
    -- Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    -- @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 generate interesting stats about this repository and render them as a table.
    -- @coderabbitai read src/utils.ts and generate unit testing code.
    -- @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.

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 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: 0

Outside diff range and nitpick comments (2)
.changeset/metal-geckos-pretend.md (1)

1-8: Changes look good!

The changeset file accurately captures the key improvements made in this PR, which include:

  1. Improved index error logging for better diagnostics.
  2. Addition of a network flag for self-hosted deploys to provide more flexibility.
  3. Fix for the checksum flag issue on certain Docker versions to ensure compatibility.
  4. Addition of debug logs to the Containerfile for deeper insights.

These changes collectively enhance the robustness and usability of the deployment system.

A few additional suggestions:

  1. Consider adding more details to the changeset file on how to use the new network flag and in what scenarios it would be useful.
  2. If possible, provide more specifics on which Docker versions were affected by the checksum flag issue and how it was fixed.
  3. Ensure that the improved logging and added debug logs do not log any sensitive information.
docs/open-source-self-hosting.mdx (1)

296-296: Add a period after "etc".

In American English, abbreviations like "etc." require a period.

Apply this diff to fix the punctuation:

-etc
+etc.
Tools
LanguageTool

[style] ~296-~296: In American English, abbreviations like “etc.” require a period.
Context: ...pulling updated compose files, scripts, etc from our docker repo: ```bash git pull...

(ETC_PERIOD)

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 4adc773 and fbd89f4.

Files selected for processing (10)
  • .changeset/metal-geckos-pretend.md (1 hunks)
  • docs/github-actions.mdx (1 hunks)
  • docs/open-source-self-hosting.mdx (6 hunks)
  • docs/snippets/cli-commands-deploy.mdx (1 hunks)
  • docs/upgrading-beta.mdx (0 hunks)
  • packages/cli-v3/src/build/buildWorker.ts (1 hunks)
  • packages/cli-v3/src/commands/deploy.ts (3 hunks)
  • packages/cli-v3/src/commands/init.ts (1 hunks)
  • packages/cli-v3/src/deploy/buildImage.ts (6 hunks)
  • packages/cli-v3/src/entryPoints/deploy-index-controller.ts (1 hunks)
Files not reviewed due to no reviewable changes (1)
  • docs/upgrading-beta.mdx
Additional context used
LanguageTool
docs/open-source-self-hosting.mdx

[style] ~296-~296: In American English, abbreviations like “etc.” require a period.
Context: ...pulling updated compose files, scripts, etc from our docker repo: ```bash git pull...

(ETC_PERIOD)


[grammar] ~390-~390: The word “opt-out” is a noun. The verb is spelled with a space.
Context: ...ith third parties. If you would like to opt-out of this, you can set the `TRIGGER_TELEM...

(NOUN_VERB_CONFUSION)

Additional comments not posted (23)
packages/cli-v3/src/entryPoints/deploy-index-controller.ts (1)

107-108: Improved error logging for better visibility and debugging.

The addition of the console error log statement in the catch block enhances the visibility of error occurrences during the indexing process. By logging a message indicating the failure to index a deployment, along with the serialized error details, it provides immediate feedback in the console when an error is caught.

This change improves debugging capabilities by making it clearer when and why the indexing fails, while still maintaining the existing functionality of failing the deployment and exiting the process.

docs/snippets/cli-commands-deploy.mdx (3)

90-92: LGTM!

The repositioning of the --skip-deploy parameter and the updated description improve the clarity and discoverability of this option.


99-103: LGTM!

The expanded description for the --registry parameter and the updated description for the --push parameter improve clarity and consistency in the documentation.


111-113: LGTM!

The addition of the --network parameter enhances the flexibility and customization options for users who are self-hosting their deployments. This is a valuable addition to the CLI commands.

docs/github-actions.mdx (1)

184-184: Approve version update with a reminder to review the changelog.

Updating the trigger.dev package version from beta to latest aligns with the best practice of using stable versions for deployments.

However, please review the changelog or release notes for any breaking changes between the beta and latest versions that could potentially impact your deployment or task functionality.

packages/cli-v3/src/build/buildWorker.ts (1)

226-231: LGTM!

The added debug log statements in the writeContainerfile function provide better visibility into the file writing process without altering the core functionality. Logging the containerfilePath and the containerfile content can aid in debugging by showing the exact path and content being processed.

These changes improve the observability and debuggability of the code with negligible performance impact.

docs/open-source-self-hosting.mdx (7)

95-95: LGTM!

The heading provides clear context for the manual setup steps that follow.


177-177: LGTM!

The deploy command correctly uses the latest CLI version and includes the necessary flags for self-hosted deployments.


287-304: LGTM!

The new "Updating" section provides clear and concise instructions for keeping the self-hosted deployment up-to-date. The commands are correct, and the callout about potentially needing to update the .env file is helpful.

Tools
LanguageTool

[style] ~296-~296: In American English, abbreviations like “etc.” require a period.
Context: ...pulling updated compose files, scripts, etc from our docker repo: ```bash git pull...

(ETC_PERIOD)


305-314: LGTM!

The new "From beta" subsection provides clear instructions for users updating from the beta CLI package images. Pulling changes from the docker repo and restarting services is the correct approach.


315-324: LGTM!

The new "Version locking" section provides clear explanations for why users might want to lock the version of their Docker images. The reasons mentioned are valid and important, and the example of how to specify a different image tag in the .env file is helpful.


Line range hint 336-369: LGTM!

The updated CLI usage examples correctly use the latest CLI version and cover important use cases for self-hosted deployments. The examples are clear and easy to follow.


377-377: LGTM!

The updated deploy command example correctly uses the latest CLI version and includes the necessary flags for self-hosted deployments.

packages/cli-v3/src/deploy/buildImage.ts (6)

17-17: LGTM!

The addition of the optional network property to the BuildImageOptions interface is a valid change. It allows users to specify a Docker network when building images, providing more flexibility in the image-building process.


282-282: LGTM!

The addition of the optional network property to the SelfHostedBuildImageOptions interface is a valid change. It allows users to specify a Docker network when building images in a self-hosted environment, providing more flexibility in the image-building process.


88-88: LGTM!

The network property from the BuildImageOptions interface is correctly passed to the selfHostedBuildImage function. This ensures that the network option is propagated to the self-hosted image-building process.


301-301: LGTM!

The network property from the SelfHostedBuildImageOptions interface is correctly included in the Docker build command using the ternary operator. If the network option is provided, the --network argument is added to the Docker build command, allowing users to specify a Docker network when building images in a self-hosted environment.


465-465: LGTM!

The addition of the Dockerfile syntax declaration # syntax=docker/dockerfile:1 at the beginning of the Dockerfile improves clarity and compatibility with Docker's syntax requirements.


570-570: LGTM!

The addition of the Dockerfile syntax declaration # syntax=docker/dockerfile:1 at the beginning of the Dockerfile improves clarity and compatibility with Docker's syntax requirements.

packages/cli-v3/src/commands/init.ts (1)

197-197: LGTM!

The change modifies the command prompt displayed to users when instructed to start developing. It now checks for the presence of a profile option and appends a --profile argument if it exists, instead of checking the apiUrl against a constant.

This change affects the user experience by providing a different command prompt based on whether a profile option is present or not. Users with a profile option will see the --profile argument included in the command prompt.

The change appears to be intentional and does not introduce any apparent bugs or issues.

packages/cli-v3/src/commands/deploy.ts (3)

58-58: LGTM!

The new optional network parameter in the DeployCommandOptions schema enhances the flexibility of the deployment command by allowing users to specify the networking mode for RUN instructions when using the --self-hosted option. The enum values cover the common networking modes used in containerized environments.


148-148: Looks good!

The new --network <mode> option in the command-line interface provides users with a clear way to set the networking mode for RUN instructions when using the --self-hosted option. The description is clear and concise, explaining the purpose of the option. The naming and style of the option are consistent with other options in the command.


354-354: Looks good to me!

Passing the network value from the options object to the buildImage function integrates the new networking mode parameter into the deployment process. This ensures that the specified networking mode is applied when building the deployment image. The code change is consistent with the addition of the network parameter to the DeployCommandOptions schema and the --network option in the command-line interface.

Copy link

pkg-pr-new bot commented Sep 18, 2024

pnpm add https://pkg.pr.new/triggerdotdev/trigger.dev/@trigger.dev/build@1319
pnpm add https://pkg.pr.new/triggerdotdev/trigger.dev@1319
pnpm add https://pkg.pr.new/triggerdotdev/trigger.dev/@trigger.dev/core@1319
pnpm add https://pkg.pr.new/triggerdotdev/trigger.dev/@trigger.dev/sdk@1319

commit: be90406

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