Commit Graph

32 Commits

Author SHA1 Message Date
Eric Allam 2aabb994cf Install the protobuf compiler in the docker builder stage 2024-02-12 16:58:57 +00:00
Eric Allam baf3a84cda v3 dev cli command + more (#894) 2024-02-12 14:24:32 +00:00
nicktrn 225614fea3 Feature: ARM builds (#821)
* Add native ARM runner

* Switch to arch-agnostic manifest digest

* Set correct latest tag
2024-01-02 15:48:53 +00:00
Eric Allam 6ebd435e81 Feature: Run execution concurrency limits (#750)
* WIP execution concurrency controls implemented via Redis

- Split up resuming a run and executing a run
- Added some new statuses to better show what is going on in a run
- Removed preprocessing runs

* WIP

* Convert to using ZSETs and adding env vars

* Removed unused import

* Improve run number generation using advistory locks, and only on start

* More execution concurrency stuff

* Add support for job concurrency limits and concurrency limit groups

* Create wild-swans-battle.md

* Increase slots refresh timeout to 10s

* Try to fix Redis connection issues

* Don’t be so strict about the APP_ENV

* Add the blank tls option to the normal redis client as well

* Add docs
2023-11-28 16:21:06 +00:00
Eric Allam 044d38e390 Improvement: Auto Execution Yielding (#612)
* Auto-yield run execution to help prevent duplicate task executions

* Add auto-yield config to endpoints

* Refactor run execution with buffer and limits

Introduced constants RUN_CHUNK_EXECUTION_BUFFER and MAX_RUN_CHUNK_EXECUTION_LIMIT. Adjusted PerformRunExecutionV2Service to use the new constants to fine-tune execution timings and buffers.

* Add endpoint probing functionality

Added new `RESPONSE_TIMEOUT_STATUS_CODES` in `consts.ts` to manage timeout responses. Additional functions `detectResponseIsTimeout(response: Response)` was added in `endpoint.server.ts` to detect if a response was a timeout based on the status codes from `RESPONSE_TIMEOUT_STATUS_CODES`.

Update actions to use new endpoint probing endpoint service. This allows for the early probing of endpoints to determine if they're up and running.

A new class `ProbeEndpointService` was created in `probeEndpoint.server.ts` which makes HTTP requests to a given endpoint and updates its properties based on the result.

Finally, `detectResponseIsTimeout(response)` is used in `performRunExecutionV2.server.ts` for marking the execution as succeeded when facing a timeout.

* Refactored probe method in EndpointApi class

The probe method of the EndpointApi class has been refactored to remove the error handling part and it now takes a timeout sent from the client directly. The corresponding changes were also made in the ProbeEndpointService and TriggerClient objects to reflect the alterations in the probe method.

The error handling related to the timeout has been removed and the responsibility of handling the timeout has been shifted to the client. Thus, the probe method has been greatly simplified. The `probeEndpoint.server.ts` file was also changed to accommodate the change in behavior of the probe result.

In the `triggerClient.ts` the timeout for probe is now read from the incoming request object. For backward compatibility, if no timeout is provided in the request, the default value of 15 minutes is used.

* Remove performRunExecution v1 enqueue function
* Better document limits and add docs on increasing function timeouts
* Upgrade webapp docker container to use 18.18.2
* force clients to yield when a run is executing in a gracefully shutting down worker
* Renamed task `key` to `cacheKey` and added more task documentation
* Index the `@trigger.dev/sdk` version on Endpoints
2023-10-20 17:44:10 +01:00
Eric Allam c8aaea8ad0 Improvements: Gracefully shutdown to prevent locked jobs (#648)
🚀 Publish Trigger.dev Docker / typecheck (push) Failing after 6s
🚀 Publish Trigger.dev Docker / units (push) Failing after 5s
🚀 Publish Trigger.dev Docker / e2e (push) Failing after 6s
🚀 Publish Trigger.dev Docker / publish (push) Has been skipped
* WIP

* Report ECS task info on startup and shutdown

* Fixed lifecycle name

* Re-add terminus

* Require the build dir when http server is disabled

* Remove unnecessary logs

* Implement graceful shutdown in ZodWorker

* Re-order some code

* Increase the keepAliveTimeout to 65 seconds to prevent LB 502 errors
2023-10-19 11:18:19 +01:00
Eric Allam c922d24941 Adding simulate graphile job to easily debug graceful shutdown retries in docker image 2023-10-16 16:04:05 +01:00
Eric Allam c0d5292b06 Attempt to fix pgadmin error in tests 2023-10-09 18:22:38 +01:00
nicktrn ca031a72e7 Add pgAdmin (#533) 2023-10-09 16:57:28 +01:00
Eric Allam 24d892e322 Merges 573 with fix for Dockerfile (#578)
* update prisma to 5.4.1 (#573)

* Get prisma 5.4.1 to work in the Dockerfile

---------

Co-authored-by: Karthik <kartim316@gmail.com>
2023-10-06 15:10:43 +01:00
arika 5c1e002233 Fix: Magic link login not working properly when booted from docker (#390)
* fix: use NODE_ENV when starting from docker image

When starting from `pnpm run start`, NODE_ENV is fixed to production, causing problems like #186.
So, I added `start_docker`, a process dedicated to docker, and started from it.
The process is exactly the same as `start` except that NODE_ENV is not overwritten.

* fix: align execution name with others

* Change: command name to match review
2023-09-08 11:06:06 +01:00
Eric Allam b1b9321ad2 Job run performance improvements and adding "worker only" mode (#360)
* WIP job run performance improvements

- Added a `perf` tool to better measure job run performance under heavy load
- Removed `runFinished` job (not really needed)
- startQueuedRuns now uses a jobKey with replace
- Fixed an issue with ZodWorker when using jobKey

* Publish improvement docker images

* fixed the improvement docker publishing

* Downgrade back to prisma 4.16.0 because 5.1.x broke docker builds

* Changes to how queued runs work

- Split the worker into two different workers, one dedicated to performRunExecution
- Schedule performRunExecution in a single place, with a queue and using a round robin manually controlled concurrency
- Remove startQueuedRuns
- All runs are queued before they are started
- Setting the worker maxPoolSize to the same as the worker concurrency
- Starting to be able to split the docker image

* Remove queue name from startRun graphile job

* Make the prisma connection pool stuff configurable through env vars

* Hardcode (for now) the max concurrent runs limit

* Rewrite performRunExecution to be more performant

PerformRunExecutionV2:

- Does not create and manage jobRunExecution records
- Does not reimplement retrying, uses graphile worker retrying instead

I’ve kept around PerformRunExecutionV1 so this works when deploying. Definitely needs LOTS of testing

* Fix issues with cached tasks

- Limit the size of the cached tasks sent when executing a run, using the knapsack problem dynamic programming approach
- Actually USE the cached tasks in IO by using the idempotencyKey instead of the task ID
- Remove output from all logs
- Added a stress test job catalog

* Forgot to commit the logger updates

* Never log connectionString

* Login to docker hub to get around rate limits

* Add additional logging to the graphile workers

* Fix the *_ENABLED  env vars

* Allow adding and removing jobs to be done from the webapp

* Don’t set the job to failed if it’s being retried

* Deprecated queue options in the job and removed startPosition. Now using the job/env combo as the job queue name

* Dequeung jobs doesn’t check if the runner is initialized

* Fixed issues with retrying a run getting stuck on a cancelled task, and errors from parsing the results of dequeing a job

* Remove queued round robin thing that isn’t used anymore

* Added slack to job catalog

* Better forwards compat

* Added long delay

* Fixed lock file
2023-08-18 15:25:26 +01:00
Matt Aitken 9f649d2a27 Lock prisma to 5.1.1 2023-08-14 16:52:30 +01:00
Chigala 0a20b6e05a chore: updated prisma from version 4.16.0 to 5.1.0 (#254)
* chore: update prisma from version 4.16.0 to 5.1.0

* fixed the ts-errors due to the prisma update

---------

Co-authored-by: Matt Aitken <matt@mattaitken.com>
2023-08-14 16:36:40 +01:00
nicktrn 603ffbc426 docs: add supabase guide (#297)
* docs: add supabase guide

* feat: add support for external connection poolers

* chore: use .env symlink in database package

* chore: remove database .env.example

* docs: finish supabase pooling section

* docs: fix small typo

* docs: replace prisma with app wording

* docs: fix up supabase pooling section

* fix: deleted too much in contributing docs

* docs: change pooling heading

* docs: reduce linux shaming

* docs: include direct connection url in fly.io
2023-08-11 15:51:54 +01:00
Eric Allam 8405b337f9 Fix seed files by copying any .node query engine file in entrypoint.sh 2023-08-02 10:21:41 +01:00
Eric Allam 767e09ee18 New integration: @trigger.dev/supabase (#203)
* WIP supabase integration

* supabase oauth working

* Supabase database triggers

* Specify postgres:14

* Limit refreshOAuthToken jobs to 10 attempts

* Better displaying types and removing onChange for now

* WIP on the supabase db client

* Finishing the supabase-js integration

* Adding changeset

* Added supabase to the integration catalogs, and added an optional icon to Integrations

* Reworking how we handle types for the triggers (wip)

* Update fully over to the new way to define supabase triggers

* Go back to using the type for the event name

* Add back in the icon to the JobListPresenter since it was moved from the ProjectPresenter

* Remove unused import
2023-07-26 18:01:27 +01:00
Eric Allam 51e6a74eda Lock turborepo to a specific version (1.10.10 breaks our Docker builds) 2023-07-25 13:37:40 +01:00
Eric Allam 1dfe7e0ab5 Updated dev-compose.yml and added some scripts to run it in package.json 2023-07-20 10:31:39 +01:00
SSHari 439ecf4a7f chore: 🤖 improve migrations for docker container startup 2023-07-19 21:34:16 -04:00
SSHari 04ce02bb5d feat: 🎸 update Docker image to use best practices 2023-07-18 16:10:13 -04:00
Matt Aitken 761e89108b Docker prisma generate uses the same semver as the package.json 2023-07-12 17:35:27 +01:00
Eric Allam 79a0532e1d Handle OS signals in the docker container
🚀 Publish Trigger.dev Docker / publish (push) Has been cancelled
🚀 Publish Trigger.dev Docker / ʦ TypeScript (push) Has been cancelled
2023-07-04 14:36:59 +01:00
Eric Allam 03c4d9504f Cleanup the docker compose services stuff 2023-06-26 15:09:31 +01:00
James Ritchie 80b4916094 docker .env links to root .env 2023-06-26 14:45:03 +01:00
Eric Allam 31d8669c9d Make github auth optional and better name the env vars 2023-06-22 17:42:51 +01:00
Eric Allam 0e82f6287a Try and fix the fly entrypoint issues 2023-06-22 16:54:14 +01:00
Eric Allam 909b4a5432 More fly work 2023-06-22 16:26:55 +01:00
Eric Allam c034035aba Working on deploying to fly 2023-06-22 16:09:08 +01:00
Eric Allam b9e8e084a8 chmod the wait-for-it script 2023-06-22 13:54:47 +01:00
Eric Allam ff60b71321 Quiet npx output 2023-06-22 13:48:19 +01:00
Eric Allam 8bba30e290 Initial Docker and docker compose setup 2023-06-21 17:07:17 +01:00