Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 4 additions & 13 deletions docs/github-actions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -134,16 +134,11 @@ You should use the version you run locally during dev and manual deploy. The cur

## Self-hosting

When self-hosting, you will have to take a few additional steps:
When self-hosting, you need to:

- Specify the `TRIGGER_API_URL` environment variable. You can add it to the GitHub secrets the same way as the access token. This should point at your webapp domain, for example: `https://trigger.example.com`
- Setup docker as you will need to build and push the image to your registry. On [Trigger.dev Cloud](https://cloud.trigger.dev) this is all done remotely.
- Set up Docker Buildx in your CI environment for building images locally.
- Add your registry credentials to the GitHub secrets.
- Use the `--self-hosted` and `--push` flags when deploying.

<Tip>If you're self-hosting v4, the `--self-hosted` and `--push` flags are **NOT** needed.</Tip>

Other than that, your GitHub action file will look very similar to the one above:
- Specify the `TRIGGER_API_URL` environment variable pointing to your webapp domain, for example: `https://trigger.example.com`

<CodeGroup>

Expand All @@ -170,13 +165,11 @@ jobs:
- name: Install dependencies
run: npm install

# docker setup - part 1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
version: latest

# docker setup - part 2
- name: Login to DockerHub
uses: docker/login-action@v3
with:
Expand All @@ -186,11 +179,9 @@ jobs:
- name: 🚀 Deploy Trigger.dev
env:
TRIGGER_ACCESS_TOKEN: ${{ secrets.TRIGGER_ACCESS_TOKEN }}
# required when self-hosting
TRIGGER_API_URL: ${{ secrets.TRIGGER_API_URL }}
# deploy with additional flags
run: |
npx trigger.dev@latest deploy --self-hosted --push
npx trigger.dev@latest deploy
```

</CodeGroup>
52 changes: 8 additions & 44 deletions docs/snippets/cli-commands-deploy.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ npx trigger.dev@latest deploy [path]
Turn off syncing environment variables with the Trigger.dev instance.
</ParamField>

<ParamField body="Local build" type="--local-build">
Force building the deployment image locally using your local Docker. This is automatic when self-hosting.
</ParamField>

### Common options

These options are available on most commands.
Expand All @@ -85,50 +89,10 @@ These options are available on most commands.

### Self-hosting

These options are typically used when [self-hosting](/open-source-self-hosting) or for local development.

<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="Skip deploying the image" type="--skip-deploy | -D">
Load the built image into your local docker.
</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`. Will automatically enable
`--push`.
</ParamField>

<ParamField body="Push image" type="--push">
When using the `--self-hosted` flag, push the image to the registry.
</ParamField>

<ParamField body="Namespace" type="--namespace">
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>

<ParamField body="Network" type="--network">
The networking mode for RUN instructions when using `--self-hosted`.
</ParamField>

## Examples

### Push to Docker Hub (self-hosted)

An example of deploying to Docker Hub when using a self-hosted setup:
When [self-hosting](/self-hosting/overview), builds are performed locally by default. Once you've logged in to your self-hosted instance using the CLI, you can deploy with:

```bash
npx trigger.dev@latest deploy \
--self-hosted \
--load-image \
--registry docker.io \
--namespace mydockerhubusername
npx trigger.dev@latest deploy
```

For CI/CD environments, set `TRIGGER_ACCESS_TOKEN` and `TRIGGER_API_URL` environment variables. See the [GitHub Actions guide](/github-actions#self-hosting) for more details.