From 4ca57abf0b40b17479e9e0799180844763cc77f6 Mon Sep 17 00:00:00 2001 From: TangoBeeAkto Date: Wed, 5 Nov 2025 11:26:55 +0530 Subject: [PATCH 1/4] refactor: rename MiniRuntimeContainer to MiniRuntimeContainerNginx and update related configurations --- package-lock.json | 4 ++-- package.json | 2 +- src/index.ts | 18 +++++++++--------- worker-configuration.d.ts | 4 ++-- wrangler.jsonc | 18 +++++++++--------- 5 files changed, 23 insertions(+), 23 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2e8c678..9bcecbf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { - "name": "cloudflare-mini-runtime-container", + "name": "cloudflare-mini-runtime-container-nginx", "version": "1.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "cloudflare-mini-runtime-container", + "name": "cloudflare-mini-runtime-container-nginx", "version": "1.0.0", "dependencies": { "@cloudflare/containers": "^0.0.19", diff --git a/package.json b/package.json index f7d7e0a..ea20e7b 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "cloudflare-mini-runtime-container", + "name": "cloudflare-mini-runtime-container-nginx", "description": "Build a Container-enabled Worker", "version": "1.0.0", "private": true, diff --git a/src/index.ts b/src/index.ts index 4c60cde..12d55b4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -3,7 +3,7 @@ import { Hono } from "hono"; const INSTANCE_COUNT = 3; -export class MiniRuntimeContainer extends Container { +export class MiniRuntimeContainerNginx extends Container { // Port the container listens on (default: 8080) defaultPort = 8080; // Time before container sleeps due to inactivity (default: 30s) @@ -11,7 +11,7 @@ export class MiniRuntimeContainer extends Container { // Environment variables passed to the container envVars = { - AKTO_LOG_LEVEL: "DEBUG", + AKTO_LOG_LEVEL: "INFO", DATABASE_ABSTRACTOR_SERVICE_TOKEN: "", DATABASE_ABSTRACTOR_SERVICE_URL: "https://cyborg.akto.io", AKTO_TRAFFIC_QUEUE_THRESHOLD: "100", @@ -40,8 +40,8 @@ export class MiniRuntimeContainer extends Container { // Create Hono app with proper typing for Cloudflare Workers type Environment = { - readonly MINI_RUNTIME_CONTAINER: DurableObjectNamespace - readonly AKTO_TRAFFIC_QUEUE: Queue + readonly MINI_RUNTIME_CONTAINER_NGINX: DurableObjectNamespace + readonly AKTO_TRAFFIC_QUEUE_NGINX: Queue } const app = new Hono<{ Bindings: Environment; @@ -101,9 +101,9 @@ export default { const normalized = normalizeBatchData({ batchData: payload }) const result = JSON.stringify(normalized) - const containerInstance = getRandom(env.MINI_RUNTIME_CONTAINER, INSTANCE_COUNT) - const containerId = env.MINI_RUNTIME_CONTAINER.idFromName(`/container/${containerInstance}`) - const container = env.MINI_RUNTIME_CONTAINER.get(containerId) + const containerInstance = getRandom(env.MINI_RUNTIME_CONTAINER_NGINX, INSTANCE_COUNT) + const containerId = env.MINI_RUNTIME_CONTAINER_NGINX.idFromName(`/container/${containerInstance}`) + const container = env.MINI_RUNTIME_CONTAINER_NGINX.get(containerId) const req = new Request("http://internal/upload", { method: "POST", @@ -126,14 +126,14 @@ export default { // 🔒 requeue each message one by one before next batch for (const m of batchSlice) { - await env.AKTO_TRAFFIC_QUEUE.send(m.body) + await env.AKTO_TRAFFIC_QUEUE_NGINX.send(m.body) } } } catch (err) { console.error("Error sending messages to container:", err) for (const m of batchSlice) { - await env.AKTO_TRAFFIC_QUEUE.send(m.body) + await env.AKTO_TRAFFIC_QUEUE_NGINX.send(m.body) } } } diff --git a/worker-configuration.d.ts b/worker-configuration.d.ts index 6a4aac2..a67bc0b 100644 --- a/worker-configuration.d.ts +++ b/worker-configuration.d.ts @@ -4,10 +4,10 @@ declare namespace Cloudflare { interface GlobalProps { mainModule: typeof import("./src/index"); - durableNamespaces: "MiniRuntimeContainer"; + durableNamespaces: "MiniRuntimeContainerNginx"; } interface Env { - MINI_RUNTIME_CONTAINER: DurableObjectNamespace; + MINI_RUNTIME_CONTAINER_NGINX: DurableObjectNamespace; } } interface Env extends Cloudflare.Env {} diff --git a/wrangler.jsonc b/wrangler.jsonc index 7191267..d79e500 100644 --- a/wrangler.jsonc +++ b/wrangler.jsonc @@ -4,7 +4,7 @@ */ { "$schema": "node_modules/wrangler/config-schema.json", - "name": "mini-runtime-worker", + "name": "mini-runtime-worker-nginx", "main": "src/index.ts", "compatibility_date": "2025-05-23", "compatibility_flags": [ @@ -15,25 +15,25 @@ }, "containers": [ { - "class_name": "MiniRuntimeContainer", - "image": "YOUR_PUSHED_IMAGE_URL_HERE", - "max_instances": 6, + "class_name": "MiniRuntimeContainerNginx", + "image": "registry.cloudflare.com/53a10bdb35f546522193c9670ad3e7e5/mr:nayan", + "max_instances": 3, "instance_type": "standard", - "name": "mini-runtime-containers" + "name": "mini-runtime-containers-nginx" } ], "durable_objects": { "bindings": [ { - "class_name": "MiniRuntimeContainer", - "name": "MINI_RUNTIME_CONTAINER" + "class_name": "MiniRuntimeContainerNginx", + "name": "MINI_RUNTIME_CONTAINER_NGINX" } ] }, "queues": { "consumers": [ { - "queue": "akto-traffic-queue", + "queue": "akto-traffic-queue-nginx", "max_batch_size": 5, "max_batch_timeout": 30, "max_retries": 3, @@ -43,7 +43,7 @@ "migrations": [ { "new_sqlite_classes": [ - "MiniRuntimeContainer" + "MiniRuntimeContainerNginx" ], "tag": "v1" } From dffec8a4262281589c8d5c7ff6a30bc3294458af Mon Sep 17 00:00:00 2001 From: rakshak Date: Tue, 11 Nov 2025 19:37:55 +0530 Subject: [PATCH 2/4] added mini runtime container changes for ch-robinson --- package-lock.json | 4 ++-- package.json | 2 +- src/index.ts | 16 ++++++++-------- worker-configuration.d.ts | 4 ++-- wrangler.jsonc | 14 +++++++------- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9bcecbf..4918083 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { - "name": "cloudflare-mini-runtime-container-nginx", + "name": "cloudflare-mini-runtime-container-ch-robinson", "version": "1.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "cloudflare-mini-runtime-container-nginx", + "name": "cloudflare-mini-runtime-container-ch-robinson", "version": "1.0.0", "dependencies": { "@cloudflare/containers": "^0.0.19", diff --git a/package.json b/package.json index ea20e7b..e01c040 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "cloudflare-mini-runtime-container-nginx", + "name": "cloudflare-mini-runtime-container-ch-robinson", "description": "Build a Container-enabled Worker", "version": "1.0.0", "private": true, diff --git a/src/index.ts b/src/index.ts index 12d55b4..d3fa827 100644 --- a/src/index.ts +++ b/src/index.ts @@ -3,7 +3,7 @@ import { Hono } from "hono"; const INSTANCE_COUNT = 3; -export class MiniRuntimeContainerNginx extends Container { +export class MiniRuntimeContainerChRobinson extends Container { // Port the container listens on (default: 8080) defaultPort = 8080; // Time before container sleeps due to inactivity (default: 30s) @@ -40,8 +40,8 @@ export class MiniRuntimeContainerNginx extends Container { // Create Hono app with proper typing for Cloudflare Workers type Environment = { - readonly MINI_RUNTIME_CONTAINER_NGINX: DurableObjectNamespace - readonly AKTO_TRAFFIC_QUEUE_NGINX: Queue + readonly MINI_RUNTIME_CONTAINER_CH_ROBINSON: DurableObjectNamespace + readonly AKTO_TRAFFIC_QUEUE_CH_ROBINSON: Queue } const app = new Hono<{ Bindings: Environment; @@ -101,9 +101,9 @@ export default { const normalized = normalizeBatchData({ batchData: payload }) const result = JSON.stringify(normalized) - const containerInstance = getRandom(env.MINI_RUNTIME_CONTAINER_NGINX, INSTANCE_COUNT) - const containerId = env.MINI_RUNTIME_CONTAINER_NGINX.idFromName(`/container/${containerInstance}`) - const container = env.MINI_RUNTIME_CONTAINER_NGINX.get(containerId) + const containerInstance = getRandom(env.MINI_RUNTIME_CONTAINER_CH_ROBINSON, INSTANCE_COUNT) + const containerId = env.MINI_RUNTIME_CONTAINER_CH_ROBINSON.idFromName(`/container/${containerInstance}`) + const container = env.MINI_RUNTIME_CONTAINER_CH_ROBINSON.get(containerId) const req = new Request("http://internal/upload", { method: "POST", @@ -126,14 +126,14 @@ export default { // 🔒 requeue each message one by one before next batch for (const m of batchSlice) { - await env.AKTO_TRAFFIC_QUEUE_NGINX.send(m.body) + await env.AKTO_TRAFFIC_QUEUE_CH_ROBINSON.send(m.body) } } } catch (err) { console.error("Error sending messages to container:", err) for (const m of batchSlice) { - await env.AKTO_TRAFFIC_QUEUE_NGINX.send(m.body) + await env.AKTO_TRAFFIC_QUEUE_CH_ROBINSON.send(m.body) } } } diff --git a/worker-configuration.d.ts b/worker-configuration.d.ts index a67bc0b..71b4d46 100644 --- a/worker-configuration.d.ts +++ b/worker-configuration.d.ts @@ -4,10 +4,10 @@ declare namespace Cloudflare { interface GlobalProps { mainModule: typeof import("./src/index"); - durableNamespaces: "MiniRuntimeContainerNginx"; + durableNamespaces: "MiniRuntimeContainerChRobinson"; } interface Env { - MINI_RUNTIME_CONTAINER_NGINX: DurableObjectNamespace; + MINI_RUNTIME_CONTAINER_CH_ROBINSON: DurableObjectNamespace; } } interface Env extends Cloudflare.Env {} diff --git a/wrangler.jsonc b/wrangler.jsonc index d79e500..ed8c9de 100644 --- a/wrangler.jsonc +++ b/wrangler.jsonc @@ -4,7 +4,7 @@ */ { "$schema": "node_modules/wrangler/config-schema.json", - "name": "mini-runtime-worker-nginx", + "name": "mini-runtime-worker-ch-robinson", "main": "src/index.ts", "compatibility_date": "2025-05-23", "compatibility_flags": [ @@ -15,25 +15,25 @@ }, "containers": [ { - "class_name": "MiniRuntimeContainerNginx", + "class_name": "MiniRuntimeContainerChRobinson", "image": "registry.cloudflare.com/53a10bdb35f546522193c9670ad3e7e5/mr:nayan", "max_instances": 3, "instance_type": "standard", - "name": "mini-runtime-containers-nginx" + "name": "mini-runtime-containers-ch-robinson" } ], "durable_objects": { "bindings": [ { - "class_name": "MiniRuntimeContainerNginx", - "name": "MINI_RUNTIME_CONTAINER_NGINX" + "class_name": "MiniRuntimeContainerChRobinson", + "name": "MINI_RUNTIME_CONTAINER_CH_ROBINSON" } ] }, "queues": { "consumers": [ { - "queue": "akto-traffic-queue-nginx", + "queue": "akto-traffic-queue-ch-robinson", "max_batch_size": 5, "max_batch_timeout": 30, "max_retries": 3, @@ -43,7 +43,7 @@ "migrations": [ { "new_sqlite_classes": [ - "MiniRuntimeContainerNginx" + "MiniRuntimeContainerChRobinson" ], "tag": "v1" } From c9db5d4bd0fb3c2724a4b52e1f97732a68bcdcdb Mon Sep 17 00:00:00 2001 From: rakshak Date: Wed, 12 Nov 2025 10:24:40 +0530 Subject: [PATCH 3/4] removed duplicate entry from tsconfig.json --- tsconfig.json | 1 - 1 file changed, 1 deletion(-) diff --git a/tsconfig.json b/tsconfig.json index 81003b4..2523004 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -15,7 +15,6 @@ "moduleResolution": "Bundler", /* Specify type package names to be included without being referenced in a source file. */ "types": [ - "./worker-configuration.d.ts", "./worker-configuration.d.ts", "node" ], From 4a56686dc58870cbf540e518720a7c2c65a496d7 Mon Sep 17 00:00:00 2001 From: rakshak Date: Mon, 24 Nov 2025 23:26:26 +0530 Subject: [PATCH 4/4] evenup deployment --- package-lock.json | 4 ++-- package.json | 2 +- src/index.ts | 16 ++++++++-------- worker-configuration.d.ts | 6 +++--- wrangler.jsonc | 14 +++++++------- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4918083..986f20d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { - "name": "cloudflare-mini-runtime-container-ch-robinson", + "name": "cloudflare-mini-runtime-container-evenup", "version": "1.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "cloudflare-mini-runtime-container-ch-robinson", + "name": "cloudflare-mini-runtime-container-evenup", "version": "1.0.0", "dependencies": { "@cloudflare/containers": "^0.0.19", diff --git a/package.json b/package.json index e01c040..9c3ef28 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "cloudflare-mini-runtime-container-ch-robinson", + "name": "cloudflare-mini-runtime-container-evenup", "description": "Build a Container-enabled Worker", "version": "1.0.0", "private": true, diff --git a/src/index.ts b/src/index.ts index d3fa827..2039713 100644 --- a/src/index.ts +++ b/src/index.ts @@ -3,7 +3,7 @@ import { Hono } from "hono"; const INSTANCE_COUNT = 3; -export class MiniRuntimeContainerChRobinson extends Container { +export class MiniRuntimeContainerEvenup extends Container { // Port the container listens on (default: 8080) defaultPort = 8080; // Time before container sleeps due to inactivity (default: 30s) @@ -40,8 +40,8 @@ export class MiniRuntimeContainerChRobinson extends Container { // Create Hono app with proper typing for Cloudflare Workers type Environment = { - readonly MINI_RUNTIME_CONTAINER_CH_ROBINSON: DurableObjectNamespace - readonly AKTO_TRAFFIC_QUEUE_CH_ROBINSON: Queue + readonly MINI_RUNTIME_CONTAINER_EVENUP: DurableObjectNamespace + readonly AKTO_TRAFFIC_QUEUE_EVENUP: Queue } const app = new Hono<{ Bindings: Environment; @@ -101,9 +101,9 @@ export default { const normalized = normalizeBatchData({ batchData: payload }) const result = JSON.stringify(normalized) - const containerInstance = getRandom(env.MINI_RUNTIME_CONTAINER_CH_ROBINSON, INSTANCE_COUNT) - const containerId = env.MINI_RUNTIME_CONTAINER_CH_ROBINSON.idFromName(`/container/${containerInstance}`) - const container = env.MINI_RUNTIME_CONTAINER_CH_ROBINSON.get(containerId) + const containerInstance = getRandom(env.MINI_RUNTIME_CONTAINER_EVENUP, INSTANCE_COUNT) + const containerId = env.MINI_RUNTIME_CONTAINER_EVENUP.idFromName(`/container/${containerInstance}`) + const container = env.MINI_RUNTIME_CONTAINER_EVENUP.get(containerId) const req = new Request("http://internal/upload", { method: "POST", @@ -126,14 +126,14 @@ export default { // 🔒 requeue each message one by one before next batch for (const m of batchSlice) { - await env.AKTO_TRAFFIC_QUEUE_CH_ROBINSON.send(m.body) + await env.AKTO_TRAFFIC_QUEUE_EVENUP.send(m.body) } } } catch (err) { console.error("Error sending messages to container:", err) for (const m of batchSlice) { - await env.AKTO_TRAFFIC_QUEUE_CH_ROBINSON.send(m.body) + await env.AKTO_TRAFFIC_QUEUE_EVENUP.send(m.body) } } } diff --git a/worker-configuration.d.ts b/worker-configuration.d.ts index 71b4d46..e8f9ec8 100644 --- a/worker-configuration.d.ts +++ b/worker-configuration.d.ts @@ -1,13 +1,13 @@ /* eslint-disable */ -// Generated by Wrangler by running `wrangler types` (hash: 2f06098408f1a9d51f0d36bfe7e86e07) +// Generated by Wrangler by running `wrangler types` (hash: f0e8f350d714bf48b41b51188cb56565) // Runtime types generated with workerd@1.20250917.0 2025-05-23 nodejs_compat declare namespace Cloudflare { interface GlobalProps { mainModule: typeof import("./src/index"); - durableNamespaces: "MiniRuntimeContainerChRobinson"; + durableNamespaces: "MiniRuntimeContainerEvenup"; } interface Env { - MINI_RUNTIME_CONTAINER_CH_ROBINSON: DurableObjectNamespace; + MINI_RUNTIME_CONTAINER_EVENUP: DurableObjectNamespace; } } interface Env extends Cloudflare.Env {} diff --git a/wrangler.jsonc b/wrangler.jsonc index ed8c9de..51c254b 100644 --- a/wrangler.jsonc +++ b/wrangler.jsonc @@ -4,7 +4,7 @@ */ { "$schema": "node_modules/wrangler/config-schema.json", - "name": "mini-runtime-worker-ch-robinson", + "name": "mini-runtime-worker-evenup", "main": "src/index.ts", "compatibility_date": "2025-05-23", "compatibility_flags": [ @@ -15,25 +15,25 @@ }, "containers": [ { - "class_name": "MiniRuntimeContainerChRobinson", + "class_name": "MiniRuntimeContainerEvenup", "image": "registry.cloudflare.com/53a10bdb35f546522193c9670ad3e7e5/mr:nayan", "max_instances": 3, "instance_type": "standard", - "name": "mini-runtime-containers-ch-robinson" + "name": "mini-runtime-containers-evenup" } ], "durable_objects": { "bindings": [ { - "class_name": "MiniRuntimeContainerChRobinson", - "name": "MINI_RUNTIME_CONTAINER_CH_ROBINSON" + "class_name": "MiniRuntimeContainerEvenup", + "name": "MINI_RUNTIME_CONTAINER_EVENUP" } ] }, "queues": { "consumers": [ { - "queue": "akto-traffic-queue-ch-robinson", + "queue": "akto-traffic-queue-evenup", "max_batch_size": 5, "max_batch_timeout": 30, "max_retries": 3, @@ -43,7 +43,7 @@ "migrations": [ { "new_sqlite_classes": [ - "MiniRuntimeContainerChRobinson" + "MiniRuntimeContainerEvenup" ], "tag": "v1" }