diff --git a/docs/cli-deploy-commands.mdx b/docs/cli-deploy-commands.mdx new file mode 100644 index 000000000..2ced0fdca --- /dev/null +++ b/docs/cli-deploy-commands.mdx @@ -0,0 +1,9 @@ +--- +title: "CLI deploy options" +sidebarTitle: "Deploy" +description: "Use these options to help deploy your tasks to Trigger.dev." +--- + +import CliDeployCommands from '/snippets/cli-commands-deploy.mdx'; + + \ No newline at end of file diff --git a/docs/cli-deploy.mdx b/docs/cli-deploy.mdx index e84a42a02..fc40005f3 100644 --- a/docs/cli-deploy.mdx +++ b/docs/cli-deploy.mdx @@ -4,90 +4,8 @@ description: "The `trigger.dev deploy` command can be used to manually deploy." --- import ComingSoon from '/snippets/coming-soon-generic.mdx'; +import CliDeployCommands from '/snippets/cli-commands-deploy.mdx'; -You run the command like this: - - - -```bash npm -npx trigger.dev@beta deploy -``` - -```bash pnpm -pnpm dlx trigger.dev@beta deploy -``` - -```bash yarn -yarn dlx trigger.dev@beta deploy -``` - - - -Will fail in CI if any version mismatches are detected. Ensure everything runs locally first using the [dev](/cli-dev) command and don't bypass the version checks! - -It performs a few steps to deploy: - -1. Optionally updates packages when running locally. -2. Typechecks the code. -3. Compiles and bundles the code. -4. Checks that [environment variables](/deploy-environment-variables) are set. -5. Deploys the code to the cloud. -6. Registers the tasks as a new version in the environment (prod by default). - -You can also setup [GitHub Actions](/github-actions) to deploy your tasks automatically. - -## Options - -### Environment `--env` or `-e` - -Defaults to `prod` but you can specify `staging`. - -### Skip typecheck `--skip-typecheck` or `-T` - -Skips the pre-build typecheck step. - -### Build platform `--build-platform` - -The platform to build the deployment image for. Defaults to `linux/amd64`. - -### Log level `--log-level` or `-l` - -The log level to use (debug, info, log, warn, error, none). Defaults to `log`. - -### Set config filename `--config` or `-c` - -The name of the config file, found where the command is run from. Defaults to `trigger.config.ts`. - -### Set the projectRef `--project-ref` or `-p` - -The project ref. Required if there is no config file. - -### Self-hosted options - -These options are usually only relevant to self-hosters or for local development. - -#### Skip deploying the image `--skip-deploy` or `-D` - -Load the built image into your local docker. - -#### Self-hosted (builds locally) `--self-hosted` - -Builds and loads the image using your local docker. Use the `--registry` option to specify the registry to push the image to when using `--self-hosted`, or just use `--push` to push to the default registry. - -#### Registry `--registry` - - - -The registry to push the image to when using --self-hosted. - -#### Push image `--push` - -When using the --self-hosted flag, push the image to the default registry. (defaults to false when not using --registry) - -#### Tag the image `--tag` - - - -Specify the tag to use when pushing the image to the registry. + {/* todo add options, remove the reference docs */} diff --git a/docs/cli-dev-commands.mdx b/docs/cli-dev-commands.mdx new file mode 100644 index 000000000..cc9d76ab5 --- /dev/null +++ b/docs/cli-dev-commands.mdx @@ -0,0 +1,9 @@ +--- +title: "CLI dev command" +sidebarTitle: "Dev" +description: "The `trigger.dev dev` command is used to run your tasks locally." +--- + +import CliDevCommands from "/snippets/cli-commands-develop.mdx"; + + \ No newline at end of file diff --git a/docs/cli-dev.mdx b/docs/cli-dev.mdx index 7e67e2687..d6e5fee10 100644 --- a/docs/cli-dev.mdx +++ b/docs/cli-dev.mdx @@ -3,67 +3,6 @@ title: "CLI dev command" description: "The `trigger.dev dev` command is used to run your tasks locally." --- -This runs a server on your machine that can execute Trigger.dev tasks: +import CliDevCommands from "/snippets/cli-commands-develop.mdx"; - - -```bash npm -npx trigger.dev@beta dev -``` - -```bash pnpm -pnpm dlx trigger.dev@beta dev -``` - -```bash yarn -yarn dlx trigger.dev@beta dev -``` - - - -It will first perform an update check to prevent version mismatches, failed deploys, and other errors. You will always be prompted first. - -You will see in the terminal that the server is running and listening for requests. When you run a task, you will see it in the terminal along with a link to view it in the dashboard. - -It is worth noting that each task runs in a separate Node process. This means that if you have a long-running task, it will not block other tasks from running. - -## Options - -### Attaching a local debugger - -You can use the `--debugger` flag to run the server in debug mode. This will allow you to attach a debugger to the server and debug your tasks. - - - -```bash npm -npx trigger.dev@beta dev --debugger -``` - -```bash pnpm -pnpm dlx trigger.dev@beta dev --debugger -``` - -```bash yarn -yarn dlx trigger.dev@beta dev --debugger -``` - - - -### Concurrently running the terminal - -Install the concurrently package as a dev dependency: - -```ts -concurrently --raw --kill-others npm:dev:remix npm:dev:trigger -``` - -Then add something like this in your package.json scripts. This assumes you're running Next.js so swap that bit out if you're not: - -```json -"scripts": { - "dev": "concurrently --raw --kill-others npm:dev:*", - "dev:next": "next dev", - "dev:trigger": "npx trigger.dev@beta dev", - //... -} -``` + \ No newline at end of file diff --git a/docs/cli-development-commands.mdx b/docs/cli-development-commands.mdx new file mode 100644 index 000000000..4a0f5384b --- /dev/null +++ b/docs/cli-development-commands.mdx @@ -0,0 +1,9 @@ +--- +title: "CLI development commands" +sidebarTitle: "Development commands" +description: "Use these commands to help develop your tasks locally." +--- + +import CliDevelopCommands from '/snippets/cli-commands-develop.mdx'; + + \ No newline at end of file diff --git a/docs/cli-init-commands.mdx b/docs/cli-init-commands.mdx new file mode 100644 index 000000000..f83b07139 --- /dev/null +++ b/docs/cli-init-commands.mdx @@ -0,0 +1,67 @@ +--- +title: "CLI init command" +sidebarTitle: "Init" +description: "Use these options when running the CLI `init` command." +--- + +Run the command like this: + + + +```bash npm +npx trigger.dev@beta init +``` + +```bash pnpm +pnpm dlx trigger.dev@beta init +``` + +```bash yarn +yarn dlx trigger.dev@beta init +``` + + + +## Options + + + The project ref to use when initializing the project. + + + + The version of the `@trigger.dev/sdk` package to install. Defaults to `3.0.0-beta.56`. + + + + Skip installing the `@trigger.dev/sdk` package. + + + + Override the existing config file if it exists. + + + + Additional arguments to pass to the package manager. Accepts CSV for multiple args. + + + + The login profile to use. Defaults to "default". + + + + Override the default API URL. If not specified, it uses `https://api.trigger.dev`. + + + + The CLI log level to use. Options are `debug`, `info`, `log`, `warn`, `error`, and `none`. This does not affect the log level of your trigger.dev tasks. Defaults to "log". + + + + Opt-out of sending telemetry data. + + +## Standard options + + + Shows the help information for the command. + \ No newline at end of file diff --git a/docs/cli-introduction.mdx b/docs/cli-introduction.mdx new file mode 100644 index 000000000..b718f0202 --- /dev/null +++ b/docs/cli-introduction.mdx @@ -0,0 +1,27 @@ +--- +title: "Introduction" +description: "The Trigger.dev CLI has a number of options and commands to help you develop locally, self host, and deploy your tasks." +--- + +## Standard options + + + Displays a list of all help commands. + + + + Displays the version number. + + +## Commands + +| Command | Description | +| :------------------------------------------------------- | :--------------------------------------------------------------------- | +| [Login](/cli-login-commands) | Login with Trigger.dev so you can perform authenticated actions. | +| [Init](/cli-init-commands) | Initialize your existing project for development with Trigger.dev. | +| [Dev](/cli-dev-commands) | Run your Trigger.dev tasks locally. | +| [Deploy](/cli-deploy-commands) | Deploy your Trigger.dev v3 project to the cloud. | +| [Whoami](/cli-whoami-commands) | Display the current logged in user and project details. | +| [Logout](/cli-logout-commands) | Logout of Trigger.dev. | +| [List-profiles](/cli-list-profiles-commands) | List all of your CLI profiles. | +| [Update](/cli-update-commands) | Updates all `@trigger.dev/*` packages to match the CLI version. | \ No newline at end of file diff --git a/docs/cli-list-profiles-commands.mdx b/docs/cli-list-profiles-commands.mdx new file mode 100644 index 000000000..416347dd7 --- /dev/null +++ b/docs/cli-list-profiles-commands.mdx @@ -0,0 +1,40 @@ +--- +title: "CLI list profiles command" +sidebarTitle: "List profiles" +description: "Use these options when using the `list-profiles` CLI command." +--- + +Run the command like this: + + + +```bash npm +npx trigger.dev@beta list-profiles +``` + +```bash pnpm +pnpm dlx trigger.dev@beta list-profiles +``` + +```bash yarn +yarn dlx trigger.dev@beta list-profiles +``` + + + +## Options + + + The CLI log level to use. Options are `debug`, `info`, `log`, `warn`, `error`, and `none`. This does not affect the log level of your trigger.dev tasks. Defaults to `log`. + + + + Opt-out of sending telemetry data. + + + +## Standard options + + + Shows the help information for the command. + \ No newline at end of file diff --git a/docs/cli-login-commands.mdx b/docs/cli-login-commands.mdx new file mode 100644 index 000000000..085055744 --- /dev/null +++ b/docs/cli-login-commands.mdx @@ -0,0 +1,51 @@ +--- +title: "CLI login command" +sidebarTitle: "Login" +description: "Use these options when logging in to Trigger.dev using the CLI." +--- + +Run the command like this: + + + +```bash npm +npx trigger.dev@beta login +``` + +```bash pnpm +pnpm dlx trigger.dev@beta login +``` + +```bash yarn +yarn dlx trigger.dev@beta login +``` + + + +## Options + + + Specifies the login profile to use. If not provided, it defaults to "default". + + + + Overrides the default API URL. If not specified, it uses `https://api.trigger.dev`. + + + + Sets the CLI log level. Available options are `debug`, `info`, `log`, `warn`, `error`, and `none`. This setting doesn't affect the log level of your trigger.dev tasks. The default is `log`. + + + + Opts out of sending telemetry data. + + +## Standard options + + + Displays the version number of the CLI. + + + + Shows the help information for the command. + \ No newline at end of file diff --git a/docs/cli-logout-commands.mdx b/docs/cli-logout-commands.mdx new file mode 100644 index 000000000..5031ce33f --- /dev/null +++ b/docs/cli-logout-commands.mdx @@ -0,0 +1,48 @@ +--- +title: "CLI logout command" +sidebarTitle: "Logout" +description: "Use these options when using the `logout` CLI command." +--- + +Run the command like this: + + + +```bash npm +npx trigger.dev@beta logout +``` + +```bash pnpm +pnpm dlx trigger.dev@beta logout +``` + +```bash yarn +yarn dlx trigger.dev@beta logout +``` + + + +## Options + + + The login profile to use. Defaults to `default`. + + + + Override the API URL. Defaults to `https://api.trigger.dev`. + + + + The CLI log level to use. Options are `debug`, `info`, `log`, `warn`, `error`, and `none`. This does not affect the log level of your trigger.dev tasks. Defaults to `log`. + + + + Opt-out of sending telemetry data. + + + +## Standard options + + + Shows the help information for the command. + \ No newline at end of file diff --git a/docs/cli-update-commands.mdx b/docs/cli-update-commands.mdx new file mode 100644 index 000000000..e4b63145f --- /dev/null +++ b/docs/cli-update-commands.mdx @@ -0,0 +1,40 @@ +--- +title: "CLI update command" +sidebarTitle: "Update" +description: "Use these options when using the `update` CLI command." +--- + +Run the command like this: + + + +```bash npm +npx trigger.dev@beta update +``` + +```bash pnpm +pnpm dlx trigger.dev@beta update +``` + +```bash yarn +yarn dlx trigger.dev@beta update +``` + + + +## Options + + + The CLI log level to use. Options are `debug`, `info`, `log`, `warn`, `error`, and `none`. This does not affect the log level of your trigger.dev tasks. Defaults to `log`. + + + + Opt-out of sending telemetry data. + + + +## Standard options + + + Shows the help information for the command. + \ No newline at end of file diff --git a/docs/cli-whoami-commands.mdx b/docs/cli-whoami-commands.mdx new file mode 100644 index 000000000..284b32ecd --- /dev/null +++ b/docs/cli-whoami-commands.mdx @@ -0,0 +1,48 @@ +--- +title: "CLI whoami command" +sidebarTitle: "Whoami" +description: "Use these options to display the current logged in user and project details." +--- + +Run the command like this: + + + +```bash npm +npx trigger.dev@beta whoami +``` + +```bash pnpm +pnpm dlx trigger.dev@beta whoami +``` + +```bash yarn +yarn dlx trigger.dev@beta whoami +``` + + + +## Options + + + The login profile to use. Defaults to `default`. + + + + Override the API URL. Defaults to `https://api.trigger.dev`. + + + + The CLI log level to use. Options are `debug`, `info`, `log`, `warn`, `error`, and `none`. This does not affect the log level of your trigger.dev tasks. Defaults to `log`. + + + + Opt-out of sending telemetry data. + + + +## Standard options + + + Shows the help information for the command. + \ No newline at end of file diff --git a/docs/mint.json b/docs/mint.json index fb88187e5..5f2341169 100644 --- a/docs/mint.json +++ b/docs/mint.json @@ -182,6 +182,25 @@ } ] }, + { + "group": "CLI", + "pages": [ + "cli-introduction", + { + "group": "Commands", + "pages": [ + "cli-login-commands", + "cli-init-commands", + "cli-dev-commands", + "cli-deploy-commands", + "cli-whoami-commands", + "cli-logout-commands", + "cli-list-profiles-commands", + "cli-update-commands" + ] + } + ] + }, { "group": "Open source", "pages": ["open-source-self-hosting", "open-source-contributing", "github-repo"] diff --git a/docs/snippets/cli-commands-deploy.mdx b/docs/snippets/cli-commands-deploy.mdx new file mode 100644 index 000000000..241f22fb9 --- /dev/null +++ b/docs/snippets/cli-commands-deploy.mdx @@ -0,0 +1,84 @@ +Run the command like this: + + + +```bash npm +npx trigger.dev@beta deploy +``` + +```bash pnpm +pnpm dlx trigger.dev@beta deploy +``` + +```bash yarn +yarn dlx trigger.dev@beta deploy +``` + + + +This will fail in CI if any version mismatches are detected. Ensure everything runs locally first using the [dev](/cli-dev) command and don't bypass the version checks! + +It performs a few steps to deploy: + +1. Optionally updates packages when running locally. +2. Typechecks the code. +3. Compiles and bundles the code. +4. Checks that [environment variables](/deploy-environment-variables) are set. +5. Deploys the code to the cloud. +6. Registers the tasks as a new version in the environment (prod by default). + +You can also setup [GitHub Actions](/github-actions) to deploy your tasks automatically. + +## Options + + + Defaults to `prod` but you can specify `staging`. + + + + Skips the pre-build typecheck step. + + + + Skip checking for `@trigger.dev` package updates. + + + + The platform to build the deployment image for. Defaults to `linux/amd64`. + + + + The log level to use (debug, info, log, warn, error, none). Defaults to `log`. + + + + The name of the config file, found where the command is run from. Defaults to `trigger.config.ts`. + + + + The project ref. Required if there is no config file. + + +## Self-hosting + +These options are typically used when [self-hosting](/open-source-self-hosting) or for local development. + + + Load the built image into your local docker. + + + + Builds and loads the image using your local docker. Use the `--registry` option to specify the registry to push the image to when using `--self-hosted`, or just use `--push` to push to the default registry. + + + + **This option is coming soon.** The registry to push the image to when using --self-hosted. + + + + When using the --self-hosted flag, push the image to the default registry. (defaults to false when not using --registry) + + + + **This option is coming soon.** Specify the tag to use when pushing the image to the registry. + \ No newline at end of file diff --git a/docs/snippets/cli-commands-develop.mdx b/docs/snippets/cli-commands-develop.mdx new file mode 100644 index 000000000..d333f0d17 --- /dev/null +++ b/docs/snippets/cli-commands-develop.mdx @@ -0,0 +1,102 @@ +This runs a server on your machine that can execute Trigger.dev tasks: + + + +```bash npm +npx trigger.dev@beta dev +``` + +```bash pnpm +pnpm dlx trigger.dev@beta dev +``` + +```bash yarn +yarn dlx trigger.dev@beta dev +``` + + + +It will first perform an update check to prevent version mismatches, failed deploys, and other errors. You will always be prompted first. + +You will see in the terminal that the server is running and listening for requests. When you run a task, you will see it in the terminal along with a link to view it in the dashboard. + +It is worth noting that each task runs in a separate Node process. This means that if you have a long-running task, it will not block other tasks from running. + +## Options + + + The name of the config file, found at [path]. + + + + The project ref. Required if there is no config file. + + + + You can use this flag to run the server in debug mode. This will allow you to attach a debugger to the server and debug your tasks. + + + +```bash npm +npx trigger.dev@beta dev --debugger +``` + +```bash pnpm +pnpm dlx trigger.dev@beta dev --debugger +``` + +```bash yarn +yarn dlx trigger.dev@beta dev --debugger +``` + + + + + + Enable OpenTelemetry debugging. + + + + Skip checking for `@trigger.dev` package updates. + + + + The login profile to use. Defaults to `default`. + + + + Override the API URL. Defaults to `https://api.trigger.dev`. + + + + The CLI log level to use. Options are `debug`, `info`, `log`, `warn`, `error`, and `none`. This does not affect the log level of your trigger.dev tasks. Defaults to `log`. + + + + Opt-out of sending telemetry data. + + +## Standard options + + + Shows the help information for the command. + + +## Concurrently running the terminal + +Install the concurrently package as a dev dependency: + +```ts +concurrently --raw --kill-others npm:dev:remix npm:dev:trigger +``` + +Then add something like this in your package.json scripts. This assumes you're running Next.js so swap that bit out if you're not: + +```json +"scripts": { + "dev": "concurrently --raw --kill-others npm:dev:*", + "dev:next": "next dev", + "dev:trigger": "npx trigger.dev@beta dev", + //... +} +``` \ No newline at end of file diff --git a/docs/triggering.mdx b/docs/triggering.mdx index 38eb43f9e..c20565f55 100644 --- a/docs/triggering.mdx +++ b/docs/triggering.mdx @@ -9,7 +9,7 @@ Trigger tasks **from your backend**: | -------------------------------- | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `tasks.trigger()` | Anywhere | Triggers a task and gets a handle you can use to fetch and manage the run. [Read more](#tasks-trigger) | | `tasks.batchTrigger()` | Anywhere | Triggers a task multiple times and gets a handle you can use to fetch and manage the runs. [Read more](#tasks-batchtrigger) | -| `tasks.triggerAndPoll()` | Anywhere | Triggers a task and then polls the run until it’s complete. [Read more](#tasks-triggerandpoll) | +| `tasks.triggerAndPoll()` | Anywhere | Triggers a task and then polls the run until it’s complete. [Read more](#tasks-triggerandpoll) | Trigger tasks **from inside a run**: diff --git a/docs/versioning.mdx b/docs/versioning.mdx index 8c3ef00f4..1e6170a9d 100644 --- a/docs/versioning.mdx +++ b/docs/versioning.mdx @@ -49,8 +49,6 @@ Every deployment creates a new version of all tasks for that environment. When a task has an uncaught error it will [retry](/errors-retrying), assuming you have not set `maxAttempts` to 0. Retries are locked to the original version of the run. -If all the attempts have failed you can start a [reattempt](/reattempting-replaying). This will be version locked to the original version of the run. - ## Replays -A "replay" is a new run of a task that uses the same inputs but will use the latest version of the code. This is useful when you fix a bug and want to re-run a task with the same inputs. See [replays](/reattempting-replaying) for more information. +A "replay" is a new run of a task that uses the same inputs but will use the latest version of the code. This is useful when you fix a bug and want to re-run a task with the same inputs. See [replaying](/replaying) for more information. diff --git a/docs/writing-tasks-introduction.mdx b/docs/writing-tasks-introduction.mdx index 4261e6408..03cbd5fdd 100644 --- a/docs/writing-tasks-introduction.mdx +++ b/docs/writing-tasks-introduction.mdx @@ -9,7 +9,7 @@ Before digging deeper into the details of writing tasks, you should read the [fu ## Writing tasks | Topic | Description | -| ----------------------------------------------------| ------------------------------------------------------------------------------------------------------------------------- | +| :---------------------------------------------------| :------------------------------------------------------------------------------------------------------------------------ | | [Logging](/logging) | View and send logs and traces from your tasks. | | [Errors & retrying](/errors-retrying) | How to deal with errors and write reliable tasks. | | [Wait](/wait) | Wait for periods of time or for external events to occur before continuing. |