Files
triggerdotdev--trigger.dev/docs/snippets/cli-commands-deploy.mdx
T
Eric Allam cf13fbdf32 Updating docs for the move from beta -> latest (with new build system) (#1299)
* Add triggerAndWait().unwrap() to more easily get at the output or throw the subtask error

* Add taskId and runId to SubtaskUnwrapError

* WIP docs update beta -> latest

* trigger.dev init now adds @trigger.dev/build to devDependencies

* How it works doc

* Restructure some docs and update the cli commands

* Config file docs, plus aptGet and ffmpeg extensions

* Update to latest from beta docs

* Add runtime to templates

* Add --runtime option to the init CLI command

* A bunch more doc updates after feedback

* Document triggerAndWait with unwrap and result types

* beta -> latest in the webapp

* CLI update check no longer references beta

* Add major release

* Leave changeset beta, back to normal package release

* Fixed default dirs option in init command

* exclude windows-yarn variation of cli e2e tests because it’s buggy

* Remove cache to try and fix yarn e2e test workflow errors
2024-09-16 15:30:32 +01:00

111 lines
3.3 KiB
Plaintext

Run the command like this:
<CodeGroup>
```bash npm
npx trigger.dev@latest deploy
```
```bash pnpm
pnpm dlx trigger.dev@latest deploy
```
```bash yarn
yarn dlx trigger.dev@latest deploy
```
</CodeGroup>
<Warning>
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!
</Warning>
It performs a few steps to deploy:
1. Optionally updates packages when running locally.
2. Compiles and bundles the code.
3. Deploys the code to the Trigger.dev instance.
4. 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
<ParamField body="Environment" type="--env | -e">
Defaults to `prod` but you can specify `staging`.
</ParamField>
<ParamField body="Set config filename" type="--config | -c">
The name of the config file, found where the command is run from. Defaults to `trigger.config.ts`.
</ParamField>
<ParamField body="Env file" type="--env">
Load environment variables from a file. This will only hydrate the `process.env` of the CLI
process, not the tasks.
</ParamField>
<ParamField body="Dry run" type="--dry-run">
Create a deployable build but don't deploy it. Prints out the build path so you can inspect it.
</ParamField>
<ParamField body="Skip update check" type="--skip-update-check">
Skip checking for `@trigger.dev` package updates.
</ParamField>
<ParamField body="Set the projectRef" type="--project-ref | -p">
The project ref. Required if there is no config file.
</ParamField>
<ParamField body="Log level" type="--log-level | -l">
The log level to use (debug, info, log, warn, error, none). Defaults to `log`.
</ParamField>
<ParamField body="Skip syncing env vars" type="--skip-sync-env-vars">
Turn off syncing environment variables with the Trigger.dev instance.
</ParamField>
## Self-hosting
These options are typically used when [self-hosting](/open-source-self-hosting) or for local development.
<ParamField body="Skip deploying the image" type="--skip-deploy | -D">
Load the built image into your local docker.
</ParamField>
<ParamField body="Self-hosted (builds locally)" type="--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.
</ParamField>
<ParamField body="Load image" type="--load-image">
Loads the image into your local docker after building it.
</ParamField>
<ParamField body="Registry" type="--registry">
Specify the registry to push the image to when using `--self-hosted`.
</ParamField>
<ParamField body="Push image" type="--push">
When using the --self-hosted flag, push the image to the registry.
</ParamField>
<ParamField body="Namespace" type="--namepsace">
The namespace to use when pushing the image to the registry. For example, if pushing to Docker
Hub, the namespace is your Docker Hub username.
</ParamField>
### Push to Docker Hub
An example of deploying to Docker Hub when using a self-hosted setup:
```bash
npx trigger.dev@latest deploy \
--self-hosted \
--load-image \
--push \
--registry docker.io \
--namespace mydockerhubusername
```