diff --git a/infra/erpc.ts b/infra/erpc.ts index 61c2c8f..df7fd5c 100644 --- a/infra/erpc.ts +++ b/infra/erpc.ts @@ -61,11 +61,17 @@ export const erpcService = new SstService("Erpc", { image: image.imageUri, // Scaling options scaling: { - min: 1, + // todo: Min two instance since current version keep failing idk why + min: 2, max: 4, cpuUtilization: 80, memoryUtilization: 80, }, + // Container health check + health: { + command: ["CMD-SHELL", "curl -f http://localhost:8080/healthcheck || exit 1"], + startPeriod: "15 seconds" + }, // Logging options logging: { retention: "3 days", diff --git a/packages/erpc/Dockerfile b/packages/erpc/Dockerfile index 7e7844b..e597696 100644 --- a/packages/erpc/Dockerfile +++ b/packages/erpc/Dockerfile @@ -11,6 +11,9 @@ RUN cd /tmp/dev && bun build --outfile ./erpc.js --minify --target node --extern #FROM erpc-dev AS final FROM ghcr.io/erpc/erpc@sha256:c62bd25d011cb0cf354689685edcf81ef49480c532d7b980a1f4cf0be3bdd0ea AS final +# Install curl, will be used for healthcheck +RUN apt-get update && apt-get install -y curl + # Copy the bundled config COPY --from=bundler ./tmp/dev/erpc.js /root/erpc.js