Skip to content

Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥

Make worker Express server port configurable via environment variable (#1748)

devin-ai-integration[bot]b28d4f72f874
diff --git a/.github/workflows/test-server-self-host.yml b/.github/workflows/test-server-self-host.yml
index 6209f2369..aff1167a7 100644
--- a/.github/workflows/test-server-self-host.yml
+++ b/.github/workflows/test-server-self-host.yml
@@ -6,9 +6,7 @@ on:
- main
env:
- PORT: 3002
REDIS_URL: redis://localhost:6379
- HOST: 0.0.0.0
ENV: ${{ secrets.ENV }}
TEST_SUITE_SELF_HOSTED: true
USE_GO_MARKDOWN_PARSER: true
@@ -100,9 +98,15 @@ jobs:
working-directory: ./
- name: Start server
run: npm run start:production > api.log 2>&1 &
+ env:
+ PORT: 3002
+ HOST: 0.0.0.0
working-directory: ./apps/api
- name: Start worker
run: npm run workers > worker.log 2>&1 &
+ env:
+ PORT: 3005
+ HOST: 0.0.0.0
working-directory: ./apps/api
- name: Start playwright
if: matrix.engine == 'playwright'
diff --git a/.github/workflows/test-server.yml b/.github/workflows/test-server.yml
index df25b00e1..c30056257 100644
--- a/.github/workflows/test-server.yml
+++ b/.github/workflows/test-server.yml
@@ -7,11 +7,9 @@ on:
env:
BULL_AUTH_KEY: ${{ secrets.BULL_AUTH_KEY }}
- HOST: ${{ secrets.HOST }}
POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }}
POSTHOG_HOST: ${{ secrets.POSTHOG_HOST }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
- PORT: ${{ secrets.PORT }}
REDIS_URL: ${{ secrets.REDIS_URL }}
SUPABASE_ANON_TOKEN: ${{ secrets.SUPABASE_ANON_TOKEN }}
SUPABASE_SERVICE_TOKEN: ${{ secrets.SUPABASE_SERVICE_TOKEN }}
@@ -101,10 +99,16 @@ jobs:
working-directory: ./apps/api/sharedLibs/pdf-parser
- name: Start the application
run: npm run start:production > api.log 2>&1 &
+ env:
+ PORT: 3002
+ HOST: 0.0.0.0
working-directory: ./apps/api
id: start_app
- name: Start worker
run: npm run workers > worker.log 2>&1 &
+ env:
+ PORT: 3005
+ HOST: 0.0.0.0
working-directory: ./apps/api
id: start_workers
- name: Start index worker
diff --git a/SELF_HOST.md b/SELF_HOST.md
index a716688f6..dd61faf7f 100644
--- a/SELF_HOST.md
+++ b/SELF_HOST.md
@@ -42,6 +42,8 @@ Create an `.env` in the root directory using the template below.
PORT=3002
HOST=0.0.0.0
+# Note: PORT is used by both the main API server and worker liveness check endpoint
+
# To turn on DB authentication, you need to set up Supabase.
USE_DB_AUTHENTICATION=false
diff --git a/apps/api/src/services/queue-worker.ts b/apps/api/src/services/queue-worker.ts
index 57eb1c0a9..f59640c72 100644
--- a/apps/api/src/services/queue-worker.ts
+++ b/apps/api/src/services/queue-worker.ts
@@ -1620,8 +1620,9 @@ app.get("/liveness", (req, res) => {
}
});
-app.listen(3005, () => {
- _logger.info("Liveness endpoint is running on port 3005");
+const workerPort = process.env.PORT || 3005;
+app.listen(workerPort, () => {
+ _logger.info(`Liveness endpoint is running on port ${workerPort}`);
});
(async () => {