From b95a1890741f895b2af8b2fa8c4914d81fe4548d Mon Sep 17 00:00:00 2001 From: Gerard Clos Date: Thu, 19 Sep 2024 08:42:30 +0200 Subject: [PATCH] chore: added required env vars to dockercompose and removed run-production bin file --- apps/gateway/docker/run-production.sh | 13 ---------- apps/workers/docker/run-production.sh | 13 ---------- docker-compose.yml | 25 +++++++++++++++++++ .../batchEvaluations/runDocumentJob.test.ts | 8 ++++-- 4 files changed, 31 insertions(+), 28 deletions(-) delete mode 100755 apps/gateway/docker/run-production.sh delete mode 100755 apps/workers/docker/run-production.sh diff --git a/apps/gateway/docker/run-production.sh b/apps/gateway/docker/run-production.sh deleted file mode 100755 index db2773b6c..000000000 --- a/apps/gateway/docker/run-production.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -export DATABASE_URL="postgres://latitude:secret@db:5432/latitude_development" - -# Gateway hostname and port -export HOST="0.0.0.0" -export PORT - -docker compose run -it \ - -p $PORT:$PORT \ - -e DATABASE_URL="$DATABASE_URL" \ - -e HOST="$HOST" \ - -e PORT="$PORT" \ - gateway dist/server.js -p $PORT diff --git a/apps/workers/docker/run-production.sh b/apps/workers/docker/run-production.sh deleted file mode 100755 index 5bb5773c5..000000000 --- a/apps/workers/docker/run-production.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -export DATABASE_URL="postgres://latitude:secret@db:5432/latitude_development" - -# Redis -export QUEUE_HOST=redis - -docker compose run -it \ - -e DATABASE_URL="$DATABASE_URL" \ - -e QUEUE_HOST="$QUEUE_HOST" \ - -e LATITUDE_URL="http://localhost:3000" \ - -e LATITUDE_DOMAIN="localhost" \ - -e FROM_MAILER_EMAIL="hello@latitude.so" \ - workers dist/server.js diff --git a/docker-compose.yml b/docker-compose.yml index 547ee4cdd..1ad5b1613 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -40,7 +40,20 @@ services: dockerfile: apps/gateway/docker/Dockerfile profiles: [building] environment: + - CACHE_HOST=redis + - DATABASE_URL=postgresql://latitude:secret@db:5432/latitude + - DEFAULT_PROJECT_ID=1 + - DEFAULT_PROVIDER_API_KEY=test + - FROM_MAILER_EMAIL=jon@winterfell.com + - LATITUDE_DOMAIN=web + - LATITUDE_URL=http://web:8080 - NODE_ENV=production + - QUEUE_HOST=redis + - WEBSOCKETS_SERVER=websockets + - WEBSOCKET_REFRESH_SECRET_TOKEN_KEY=test + - WEBSOCKET_SECRET_TOKEN_KEY=test + - WORKERS_WEBSOCKET_SECRET_TOKEN=test + - HOSTNAME=localhost depends_on: - db - redis @@ -51,7 +64,19 @@ services: dockerfile: apps/workers/docker/Dockerfile profiles: [building] environment: + - CACHE_HOST=redis + - DATABASE_URL=postgresql://latitude:secret@db:5432/latitude + - DEFAULT_PROJECT_ID=1 + - DEFAULT_PROVIDER_API_KEY=test + - FROM_MAILER_EMAIL=jon@winterfell.com + - LATITUDE_DOMAIN=web + - LATITUDE_URL=http://web:8080 - NODE_ENV=production + - QUEUE_HOST=redis + - WEBSOCKETS_SERVER=websockets + - WEBSOCKET_REFRESH_SECRET_TOKEN_KEY=test + - WEBSOCKET_SECRET_TOKEN_KEY=test + - WORKERS_WEBSOCKET_SECRET_TOKEN=test depends_on: - db - redis diff --git a/packages/jobs/src/job-definitions/batchEvaluations/runDocumentJob.test.ts b/packages/jobs/src/job-definitions/batchEvaluations/runDocumentJob.test.ts index 3ff0bd6be..4d4db4a66 100644 --- a/packages/jobs/src/job-definitions/batchEvaluations/runDocumentJob.test.ts +++ b/packages/jobs/src/job-definitions/batchEvaluations/runDocumentJob.test.ts @@ -1,6 +1,7 @@ -import { LogSources } from '@latitude-data/core/browser' +import { LogSources, Providers } from '@latitude-data/core/browser' import * as factories from '@latitude-data/core/factories' import { Result } from '@latitude-data/core/lib/Result' +import { providersEnum } from '@latitude-data/core/schema' import { runDocumentAtCommit } from '@latitude-data/core/services/commits/runDocumentAtCommit' import { env } from '@latitude-data/env' import { Job } from 'bullmq' @@ -48,7 +49,10 @@ describe('runDocumentJob', () => { // Create necessary resources using factories const setup = await factories.createProject({ - documents: { 'test-doc': 'Test content' }, + providers: [{ type: Providers.OpenAI, name: 'Latitude' }], + documents: { + 'test-doc': factories.helpers.createPrompt({ provider: 'Latitude' }), + }, }) workspace = setup.workspace project = setup.project