bug: [v4] Self-hosted tutorial bugs (with suggested fixes)
Provide environment information
WSL2 Linux 6.6 Ubuntu 24.04.2 LTS
Describe the bug
When following the v4 self-hosted setup guide: https://trigger.dev/docs/self-hosting/docker
1. env.example (fix noted below)
Small fix to .env.example is needed. On the corepack-offline-rc.0 tag for webapp:
webapp-1 |
webapp-1 | > @trigger.dev/[email protected] db:migrate:deploy /triggerdotdev/internal-packages/database
webapp-1 | > prisma migrate deploy
webapp-1 |
webapp-1 | Prisma schema loaded from prisma/schema.prisma
webapp-1 | Datasource "db": PostgreSQL database "main", schema "public" at "postgres:5432"
webapp-1 | Error: P1000: Authentication failed against database server at `postgres`, the provided database credentials for `postgres` are not valid.
webapp-1 |
webapp-1 |
webapp-1 | Please make sure to provide valid database credentials for the database server at `postgres`.
webapp-1 | /triggerdotdev/internal-packages/database:
webapp-1 | ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL @trigger.dev/[email protected] db:migrate:deploy: `prisma migrate deploy`
webapp-1 | Exit status 1
There is some misalignment of .env.example and the postgres config in docker-compose.yml... these settings worked eventually just for tutorial sake:
# Postgres
# ... prod warning ...
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
POSTGRES_DB=postgres
DATABASE_URL=postgresql://postgres:postgres@postgres:5432/main?schema=public&sslmode=disable
DIRECT_URL=postgresql://postgres:postgres@postgres:5432/main?schema=public&sslmode=disable
2. Task Creation CLI for task creation fails (from the "Get started in 3 minutes" home screen)
dev@machine:~/trigger.dev/hosting/docker$ npx trigger.dev@latest init -p proj_secret -a http://localhost:8030
Trigger.dev (3.3.17)
------------------------------------------------------
┌ Initializing project
│
◇ Retrieved your account details for <email>
│
◇ Configuring project "Project" (proj_secret)
│
◇ Failed to install @trigger.dev/sdk@latest. Rerun command with --log-level debug for more details
X Error: Command failed with exit code 1: corepack pnpm add @trigger.dev/sdk@latest
ERR_PNPM_ADDING_TO_ROOT Running this command will add the dependency to the workspace root, which might not be what you want - if you really meant it, make it explicit by running this command again with the -w flag (or --workspace-root). If you don't want to see this warning anymore, you may set the ignore-workspace-root-check setting to true.
This is mainly a n00b user issue, but that command has to be run in a fresh folder vs the /hosting/docker pwd where users will be if they're following the tutorial steps. I was thinking it was some special final init step for the self-hosted env...
Reproduction repo
N/A
To reproduce
Follow v4 Docker tutorial
Additional information
No response
Thanks for the follow-up!
- env.example (fix noted below)
I just tried with the latest main version and a fresh compose project and it worked with the defaults. I think it's possible you have an old .env.example version. It should look like this now:
https://github.com/triggerdotdev/trigger.dev/blob/3c93783e8bfb8e311aa3d384b12578f15e8e3b2d/hosting/docker/.env.example#L26-L33
Would you mind trying again with a fresh clone and fresh compose project? Maybe just test in the docker/webapp dir: docker compose -p trigger-test up
- CLI for task creation fails on a similar corepack issue
Two things:
- The
latestpackage version still points to v3 until v4 goes GA next month. You'll want to runnpx trigger.dev@v4-beta init ..instead - We used to have a
--pkg-argsflag to deal with this but it looks like it's now broken. You could addignore-workspace-root-check=trueto your.npmrcand try again.
Also just as an additional note, for self-hosting queries it might be worth joining the dedicated #self-hosters channel on Discord.
@nicktrn I tried a completely fresh pull of the main branch just for you, but same errors. Did a docker image rm <all-containers> and rm -rf trigger.dev before that.
No worries though, workarounds in place and thanks for pointing out the Discord, will stick to that vs GH Issues.
That's really surprising, I wonder why I couldn't reproduce it. If there's an issue we should definitely fix it. Did you update your .env based on the new example file?
@nicktrn #1 ended up being a docker issue. docker image rm does not also docker volume rm, even though it does trash the postgres data file... Removing all docker leftover clutter = things worked for #1 on fresh start.