Skip to content
This repository was archived by the owner on Apr 1, 2026. It is now read-only.

Commit 5f43a26

Browse files
committed
fix: added guide on how you build the trigger.dev apps
1 parent f863960 commit 5f43a26

File tree

3 files changed

+39
-223
lines changed

3 files changed

+39
-223
lines changed

BUILD.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Webapp
2+
3+
```shell
4+
docker buildx build \
5+
--platform linux/amd64 \
6+
-f docker/Dockerfile \
7+
--build-arg BUILD_APP_VERSION=spaak-version \
8+
--build-arg BUILD_GIT_SHA=e2010087d6448c51633e22902dc7cc41489a7682 \
9+
--build-arg BUILD_GIT_REF_NAME=spaak-version \
10+
--build-arg BUILD_TIMESTAMP_SECONDS=$(date +%s) \
11+
-t ghcr.io/spaak-technologies/trigger-webapp:latest \
12+
--push \
13+
.
14+
```
15+
16+
17+
# Supervisor
18+
19+
```shell
20+
docker buildx build \
21+
--platform linux/amd64 \
22+
-f apps/supervisor/Containerfile \
23+
-t ghcr.io/spaak-technologies/trigger-supervisor:latest \
24+
--push \
25+
.
26+
```

apps/webapp/app/services/runsReplicationService.server.ts

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ export type RunsReplicationServiceOptions = {
5757
leaderLockExtendIntervalMs?: number;
5858
leaderLockAcquireAdditionalTimeMs?: number;
5959
leaderLockRetryIntervalMs?: number;
60-
leaderElectionRetryIntervalMs?: number;
6160
ackIntervalSeconds?: number;
6261
acknowledgeTimeoutMs?: number;
6362
logger?: Logger;
@@ -86,7 +85,6 @@ export type RunsReplicationServiceEvents = {
8685
batchFlushed: [
8786
{ flushId: string; taskRunInserts: TaskRunInsertArray[]; payloadInserts: PayloadInsertArray[] }
8887
];
89-
leaderElection: [boolean];
9088
};
9189

9290
export class RunsReplicationService {
@@ -235,27 +233,21 @@ export class RunsReplicationService {
235233
tracer: options.tracer,
236234
});
237235

238-
this._replicationClient.events.on(
239-
"data",
240-
async ({ lsn, log, parseDuration }: { lsn: string; log: PgoutputMessage; parseDuration: bigint }) => {
241-
this.#handleData(lsn, log, parseDuration);
242-
}
243-
);
236+
this._replicationClient.events.on("data", async ({ lsn, log, parseDuration }) => {
237+
this.#handleData(lsn, log, parseDuration);
238+
});
244239

245-
this._replicationClient.events.on(
246-
"heartbeat",
247-
async ({ lsn, shouldRespond }: { lsn: string; shouldRespond: boolean }) => {
248-
if (this._isShuttingDown) return;
249-
if (this._isShutDownComplete) return;
240+
this._replicationClient.events.on("heartbeat", async ({ lsn, shouldRespond }) => {
241+
if (this._isShuttingDown) return;
242+
if (this._isShutDownComplete) return;
250243

251-
if (shouldRespond) {
252-
this._lastAcknowledgedLsn = lsn;
253-
await this._replicationClient.acknowledge(lsn);
254-
}
244+
if (shouldRespond) {
245+
this._lastAcknowledgedLsn = lsn;
246+
await this._replicationClient.acknowledge(lsn);
255247
}
256-
);
248+
});
257249

258-
this._replicationClient.events.on("error", (error: Error) => {
250+
this._replicationClient.events.on("error", (error) => {
259251
this.logger.error("Replication client error", {
260252
error,
261253
});
@@ -271,17 +263,14 @@ export class RunsReplicationService {
271263
this._isSubscribed = true;
272264
});
273265

274-
this._replicationClient.events.on("acknowledge", ({ lsn }: { lsn: string }) => {
266+
this._replicationClient.events.on("acknowledge", ({ lsn }) => {
275267
this.logger.debug("Acknowledged", { lsn });
276268
});
277269

278-
this._replicationClient.events.on("leaderElection", (isLeader: boolean) => {
270+
this._replicationClient.events.on("leaderElection", (isLeader) => {
279271
this.logger.info("Leader election", { isLeader });
280272
this._isSubscribed = isLeader;
281273

282-
// Forward the event to external listeners
283-
this.events.emit("leaderElection", isLeader);
284-
285274
if (!isLeader && !this._isShuttingDown) {
286275
this.#scheduleLeaderElectionRetry();
287276
}

apps/webapp/test/runsReplicationService.leaderElection.test.ts

Lines changed: 0 additions & 199 deletions
This file was deleted.

0 commit comments

Comments
 (0)