From 2e36b865e2031ecff1b367cf9203779b02eaafcb Mon Sep 17 00:00:00 2001 From: aboutphilippe Date: Mon, 7 Apr 2025 11:36:13 +0530 Subject: [PATCH 01/14] debug env variables on k8s --- agent-reactflow/Dockerfile | 4 +-- agent-reactflow/apps/backend/Dockerfile | 40 ---------------------- agent-reactflow/apps/backend/src/client.ts | 2 ++ 3 files changed, 4 insertions(+), 42 deletions(-) delete mode 100644 agent-reactflow/apps/backend/Dockerfile diff --git a/agent-reactflow/Dockerfile b/agent-reactflow/Dockerfile index 5bc2d28..df56d22 100644 --- a/agent-reactflow/Dockerfile +++ b/agent-reactflow/Dockerfile @@ -65,7 +65,7 @@ RUN npm install -g pnpm@10.6.1 \ && apt-get install -y ca-certificates \ && rm -rf /var/lib/apt/lists/* # Start the application using pnpm. -CMD ["pnpm", "start"] +# CMD ["pnpm", "start"] # # Dummy shell for troubleshooting -# CMD ["sh"] \ No newline at end of file +CMD ["sh"] \ No newline at end of file diff --git a/agent-reactflow/apps/backend/Dockerfile b/agent-reactflow/apps/backend/Dockerfile deleted file mode 100644 index 2417164..0000000 --- a/agent-reactflow/apps/backend/Dockerfile +++ /dev/null @@ -1,40 +0,0 @@ -# ------- Image ---------- - -FROM node:20-bullseye-slim AS installer - -RUN apt-get update \ - && apt-get install -y ca-certificates \ - && rm -rf /var/lib/apt/lists/* - -COPY ./package.json ./app/package.json -COPY ./tsconfig.json ./app/tsconfig.json - - -WORKDIR /app - -RUN npm install - -# ------- Builder ---------- - -FROM node:20-bullseye-slim AS builder -WORKDIR /app -COPY --from=installer /app . -COPY ./src ./src - -RUN npm run build - -# ------- Runner ---------- - -FROM node:20-bullseye-slim AS runner - -RUN addgroup --system --gid 1001 service -RUN adduser --system --uid 1001 service -USER service - -WORKDIR /app - -COPY --from=builder /app . - -ENV NODE_OPTIONS=”--max-old-space-size=4096″ - -CMD ["node", "dist/services"] \ No newline at end of file diff --git a/agent-reactflow/apps/backend/src/client.ts b/agent-reactflow/apps/backend/src/client.ts index 95880db..7aa4a45 100644 --- a/agent-reactflow/apps/backend/src/client.ts +++ b/agent-reactflow/apps/backend/src/client.ts @@ -11,6 +11,8 @@ export const connectionOptions = { apiAddress, }; +console.log('Debug Restack Client connectionOptions:', connectionOptions); + export const client = new Restack( process.env.RESTACK_ENGINE_API_KEY ? connectionOptions : undefined ); From 3c8df1bfda18ca8a7b247d79a29b3b7c166322e2 Mon Sep 17 00:00:00 2001 From: aboutphilippe Date: Mon, 7 Apr 2025 11:56:44 +0530 Subject: [PATCH 02/14] wip --- agent-reactflow/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/agent-reactflow/Dockerfile b/agent-reactflow/Dockerfile index df56d22..5bc2d28 100644 --- a/agent-reactflow/Dockerfile +++ b/agent-reactflow/Dockerfile @@ -65,7 +65,7 @@ RUN npm install -g pnpm@10.6.1 \ && apt-get install -y ca-certificates \ && rm -rf /var/lib/apt/lists/* # Start the application using pnpm. -# CMD ["pnpm", "start"] +CMD ["pnpm", "start"] # # Dummy shell for troubleshooting -CMD ["sh"] \ No newline at end of file +# CMD ["sh"] \ No newline at end of file From ea121b4e992c56b79e5c664373905fc6f131ecaf Mon Sep 17 00:00:00 2001 From: aboutphilippe Date: Mon, 7 Apr 2025 12:12:10 +0530 Subject: [PATCH 03/14] env path --- agent-reactflow/apps/backend/src/client.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/agent-reactflow/apps/backend/src/client.ts b/agent-reactflow/apps/backend/src/client.ts index 7aa4a45..ba6a8a9 100644 --- a/agent-reactflow/apps/backend/src/client.ts +++ b/agent-reactflow/apps/backend/src/client.ts @@ -1,6 +1,9 @@ import Restack from "@restackio/ai"; -import "dotenv/config"; +import dotenv from 'dotenv'; +import path from 'path'; + +dotenv.config({ path: path.resolve(__dirname, '../../.env') }); export const apiAddress = process.env.RESTACK_ENGINE_API_ADDRESS! From 2af8411f19b52457e7a694d4432b0f609c80e793 Mon Sep 17 00:00:00 2001 From: aboutphilippe Date: Mon, 7 Apr 2025 12:12:50 +0530 Subject: [PATCH 04/14] root path --- agent-reactflow/apps/backend/src/client.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/agent-reactflow/apps/backend/src/client.ts b/agent-reactflow/apps/backend/src/client.ts index ba6a8a9..77a5496 100644 --- a/agent-reactflow/apps/backend/src/client.ts +++ b/agent-reactflow/apps/backend/src/client.ts @@ -3,7 +3,7 @@ import Restack from "@restackio/ai"; import dotenv from 'dotenv'; import path from 'path'; -dotenv.config({ path: path.resolve(__dirname, '../../.env') }); +dotenv.config({ path: path.resolve(__dirname, '../../../.env') }); export const apiAddress = process.env.RESTACK_ENGINE_API_ADDRESS! From f07c24443c0fff87b7204aa102bbbf21c7cffc49 Mon Sep 17 00:00:00 2001 From: aboutphilippe Date: Mon, 7 Apr 2025 13:26:31 +0530 Subject: [PATCH 05/14] dummy to test envs --- agent-reactflow/Dockerfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/agent-reactflow/Dockerfile b/agent-reactflow/Dockerfile index 5bc2d28..287587d 100644 --- a/agent-reactflow/Dockerfile +++ b/agent-reactflow/Dockerfile @@ -64,8 +64,9 @@ RUN npm install -g pnpm@10.6.1 \ && apt-get update \ && apt-get install -y ca-certificates \ && rm -rf /var/lib/apt/lists/* -# Start the application using pnpm. -CMD ["pnpm", "start"] + +# Run a dummy shell script to keep the container running for inspection +CMD ["sh", "-c", "while :; do echo 'Container is running...'; sleep 60; done"] # # Dummy shell for troubleshooting # CMD ["sh"] \ No newline at end of file From 3dcf321438cf626bb7c0d77cbde7cea33117497a Mon Sep 17 00:00:00 2001 From: aboutphilippe Date: Mon, 7 Apr 2025 13:39:34 +0530 Subject: [PATCH 06/14] loose env --- agent-reactflow/package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/agent-reactflow/package.json b/agent-reactflow/package.json index d8b5edc..5e91e48 100644 --- a/agent-reactflow/package.json +++ b/agent-reactflow/package.json @@ -2,12 +2,12 @@ "name": "agent-reactflow", "private": true, "scripts": { - "build": "turbo run build", - "dev": "turbo run dev", + "build": "turbo run build --env-mode=loose", + "dev": "turbo run dev --env-mode=loose", "lint": "turbo run lint", "format": "prettier --write \"**/*.{ts,tsx,md}\"", "check-types": "turbo run check-types", - "start": "turbo run start" + "start": "turbo run start --env-mode=loose" }, "devDependencies": { "prettier": "^3.5.3", From 8106cad6ea62cfb16b136cd21c7af3bf2bab14c8 Mon Sep 17 00:00:00 2001 From: aboutphilippe Date: Mon, 7 Apr 2025 13:42:05 +0530 Subject: [PATCH 07/14] fix input --- agent-reactflow/turbo.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/agent-reactflow/turbo.json b/agent-reactflow/turbo.json index 629c519..399ec99 100644 --- a/agent-reactflow/turbo.json +++ b/agent-reactflow/turbo.json @@ -4,8 +4,8 @@ "tasks": { "build": { "dependsOn": ["^build"], - "inputs": ["$TURBO_DEFAULT$", ".env*"], "outputs": [".next/**", "!.next/cache/**"] + }, "lint": { "dependsOn": ["^lint"] From 70c72556f637a6f33bc42feb42a6fcbb979c5aae Mon Sep 17 00:00:00 2001 From: aboutphilippe Date: Mon, 7 Apr 2025 13:43:34 +0530 Subject: [PATCH 08/14] start --- agent-reactflow/Dockerfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/agent-reactflow/Dockerfile b/agent-reactflow/Dockerfile index 287587d..5bc2d28 100644 --- a/agent-reactflow/Dockerfile +++ b/agent-reactflow/Dockerfile @@ -64,9 +64,8 @@ RUN npm install -g pnpm@10.6.1 \ && apt-get update \ && apt-get install -y ca-certificates \ && rm -rf /var/lib/apt/lists/* - -# Run a dummy shell script to keep the container running for inspection -CMD ["sh", "-c", "while :; do echo 'Container is running...'; sleep 60; done"] +# Start the application using pnpm. +CMD ["pnpm", "start"] # # Dummy shell for troubleshooting # CMD ["sh"] \ No newline at end of file From f3218a87e6951dfb148ab32c9b8d6b56c07a2f28 Mon Sep 17 00:00:00 2001 From: aboutphilippe Date: Mon, 7 Apr 2025 13:48:04 +0530 Subject: [PATCH 09/14] cleanup --- agent-reactflow/apps/backend/src/client.ts | 8 +++----- agent-reactflow/package.json | 6 +++--- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/agent-reactflow/apps/backend/src/client.ts b/agent-reactflow/apps/backend/src/client.ts index 77a5496..db458c8 100644 --- a/agent-reactflow/apps/backend/src/client.ts +++ b/agent-reactflow/apps/backend/src/client.ts @@ -1,9 +1,9 @@ import Restack from "@restackio/ai"; -import dotenv from 'dotenv'; -import path from 'path'; +// import dotenv from 'dotenv'; +// import path from 'path'; -dotenv.config({ path: path.resolve(__dirname, '../../../.env') }); +// dotenv.config({ path: path.resolve(__dirname, '../../../.env') }); export const apiAddress = process.env.RESTACK_ENGINE_API_ADDRESS! @@ -14,8 +14,6 @@ export const connectionOptions = { apiAddress, }; -console.log('Debug Restack Client connectionOptions:', connectionOptions); - export const client = new Restack( process.env.RESTACK_ENGINE_API_KEY ? connectionOptions : undefined ); diff --git a/agent-reactflow/package.json b/agent-reactflow/package.json index 5e91e48..d8b5edc 100644 --- a/agent-reactflow/package.json +++ b/agent-reactflow/package.json @@ -2,12 +2,12 @@ "name": "agent-reactflow", "private": true, "scripts": { - "build": "turbo run build --env-mode=loose", - "dev": "turbo run dev --env-mode=loose", + "build": "turbo run build", + "dev": "turbo run dev", "lint": "turbo run lint", "format": "prettier --write \"**/*.{ts,tsx,md}\"", "check-types": "turbo run check-types", - "start": "turbo run start --env-mode=loose" + "start": "turbo run start" }, "devDependencies": { "prettier": "^3.5.3", From ae4bfeb6cbf89a82eb7571b17476518a506cd0bd Mon Sep 17 00:00:00 2001 From: aboutphilippe Date: Mon, 7 Apr 2025 13:52:46 +0530 Subject: [PATCH 10/14] loose envs --- agent-reactflow/package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/agent-reactflow/package.json b/agent-reactflow/package.json index d8b5edc..5e91e48 100644 --- a/agent-reactflow/package.json +++ b/agent-reactflow/package.json @@ -2,12 +2,12 @@ "name": "agent-reactflow", "private": true, "scripts": { - "build": "turbo run build", - "dev": "turbo run dev", + "build": "turbo run build --env-mode=loose", + "dev": "turbo run dev --env-mode=loose", "lint": "turbo run lint", "format": "prettier --write \"**/*.{ts,tsx,md}\"", "check-types": "turbo run check-types", - "start": "turbo run start" + "start": "turbo run start --env-mode=loose" }, "devDependencies": { "prettier": "^3.5.3", From 47ef496e4f1d8ef73733df40f9c025c06b0b90a3 Mon Sep 17 00:00:00 2001 From: aboutphilippe Date: Mon, 7 Apr 2025 13:53:23 +0530 Subject: [PATCH 11/14] cleanup comments --- agent-reactflow/apps/backend/src/client.ts | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/agent-reactflow/apps/backend/src/client.ts b/agent-reactflow/apps/backend/src/client.ts index db458c8..7185c13 100644 --- a/agent-reactflow/apps/backend/src/client.ts +++ b/agent-reactflow/apps/backend/src/client.ts @@ -1,17 +1,12 @@ import Restack from "@restackio/ai"; -// import dotenv from 'dotenv'; -// import path from 'path'; - -// dotenv.config({ path: path.resolve(__dirname, '../../../.env') }); - -export const apiAddress = process.env.RESTACK_ENGINE_API_ADDRESS! +import "dotenv/config"; export const connectionOptions = { engineId: process.env.RESTACK_ENGINE_ID!, address: process.env.RESTACK_ENGINE_ADDRESS!, apiKey: process.env.RESTACK_ENGINE_API_KEY!, - apiAddress, + apiAddress: process.env.RESTACK_ENGINE_API_ADDRESS!, }; export const client = new Restack( From de776d5139c31c46b1b38a9bc0b475433251a553 Mon Sep 17 00:00:00 2001 From: aboutphilippe Date: Mon, 7 Apr 2025 13:53:38 +0530 Subject: [PATCH 12/14] export api address --- agent-reactflow/apps/backend/src/client.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/agent-reactflow/apps/backend/src/client.ts b/agent-reactflow/apps/backend/src/client.ts index 7185c13..e91a83b 100644 --- a/agent-reactflow/apps/backend/src/client.ts +++ b/agent-reactflow/apps/backend/src/client.ts @@ -1,12 +1,12 @@ import Restack from "@restackio/ai"; -import "dotenv/config"; +export const apiAddress = process.env.RESTACK_ENGINE_API_ADDRESS! export const connectionOptions = { engineId: process.env.RESTACK_ENGINE_ID!, address: process.env.RESTACK_ENGINE_ADDRESS!, apiKey: process.env.RESTACK_ENGINE_API_KEY!, - apiAddress: process.env.RESTACK_ENGINE_API_ADDRESS!, + apiAddress, }; export const client = new Restack( From 3b0740f024581ca4c347aa3dc6f915540ba82d2c Mon Sep 17 00:00:00 2001 From: aboutphilippe Date: Mon, 7 Apr 2025 13:54:10 +0530 Subject: [PATCH 13/14] dotenv --- agent-reactflow/apps/backend/src/client.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/agent-reactflow/apps/backend/src/client.ts b/agent-reactflow/apps/backend/src/client.ts index e91a83b..95880db 100644 --- a/agent-reactflow/apps/backend/src/client.ts +++ b/agent-reactflow/apps/backend/src/client.ts @@ -1,5 +1,7 @@ import Restack from "@restackio/ai"; +import "dotenv/config"; + export const apiAddress = process.env.RESTACK_ENGINE_API_ADDRESS! export const connectionOptions = { From d34adb7f3b515e36f89355257e84595646b6ec1d Mon Sep 17 00:00:00 2001 From: aboutphilippe Date: Mon, 7 Apr 2025 14:02:00 +0530 Subject: [PATCH 14/14] add default inputs --- agent-reactflow/turbo.json | 1 + 1 file changed, 1 insertion(+) diff --git a/agent-reactflow/turbo.json b/agent-reactflow/turbo.json index 399ec99..a11b46d 100644 --- a/agent-reactflow/turbo.json +++ b/agent-reactflow/turbo.json @@ -4,6 +4,7 @@ "tasks": { "build": { "dependsOn": ["^build"], + "inputs": ["$TURBO_DEFAULT$", ".env*"], "outputs": [".next/**", "!.next/cache/**"] },