diff --git a/apps/gateway/docker/run-production.sh b/apps/gateway/docker/run-production.sh index 09f398827..db2773b6c 100755 --- a/apps/gateway/docker/run-production.sh +++ b/apps/gateway/docker/run-production.sh @@ -1,10 +1,6 @@ #!/bin/bash export DATABASE_URL="postgres://latitude:secret@db:5432/latitude_development" -# Redis -export REDIS_PORT=6379 -export REDIS_HOST=redis - # Gateway hostname and port export HOST="0.0.0.0" export PORT @@ -12,7 +8,6 @@ export PORT docker compose run -it \ -p $PORT:$PORT \ -e DATABASE_URL="$DATABASE_URL" \ - -e REDIS_HOST="$REDIS_HOST" \ -e HOST="$HOST" \ -e PORT="$PORT" \ gateway dist/server.js -p $PORT diff --git a/apps/gateway/src/common/env.ts b/apps/gateway/src/common/env.ts index 114833793..922e5e959 100644 --- a/apps/gateway/src/common/env.ts +++ b/apps/gateway/src/common/env.ts @@ -19,9 +19,6 @@ export default createEnv({ process.env.BUILDING_CONTAINER == 'true' || process.env.NODE_ENV === 'test', server: { DATABASE_URL: z.string(), - REDIS_HOST: z.string(), - REDIS_PORT: z.coerce.number().optional(), - REDIS_PASSWORD: z.string().optional(), HOSTNAME: z.string().default('localhost'), PORT: z.coerce.number(), }, diff --git a/apps/infra/src/core/elasticCache.ts b/apps/infra/src/core/elasticCache.ts index 4c07acb48..b541ef6d0 100644 --- a/apps/infra/src/core/elasticCache.ts +++ b/apps/infra/src/core/elasticCache.ts @@ -25,14 +25,14 @@ const SecurityGroup = new aws.ec2.SecurityGroup('LatitudeLLMCacheSg', { }) // Create an ElastiCache cluster -const cacheCluster = new aws.elasticache.Cluster('LatitudeLLMCacheCluster', { - engine: 'redis', - nodeType: 'cache.t3.micro', - numCacheNodes: 1, - port: 6379, - subnetGroupName: subnetGroup.name, - securityGroupIds: [SecurityGroup.id], -}) +// const cacheCluster = new aws.elasticache.Cluster('LatitudeLLMCacheCluster', { +// engine: 'redis', +// nodeType: 'cache.t3.micro', +// numCacheNodes: 1, +// port: 6379, +// subnetGroupName: subnetGroup.name, +// securityGroupIds: [SecurityGroup.id], +// }) const queueParameterGroup = new aws.elasticache.ParameterGroup( 'LatitudeLLMQueueParameterGroup', @@ -60,5 +60,5 @@ const queueCluster = new aws.elasticache.Cluster('LatitudeLLMQueueCluster', { }) // Export the cluster endpoint and port -export const cacheEndpoint = cacheCluster.cacheNodes[0].address +// export const cacheEndpoint = cacheCluster.cacheNodes[0].address export const queueEndpoint = queueCluster.cacheNodes[0].address diff --git a/apps/infra/src/deployments/shared.ts b/apps/infra/src/deployments/shared.ts index 28652564c..d03777149 100644 --- a/apps/infra/src/deployments/shared.ts +++ b/apps/infra/src/deployments/shared.ts @@ -9,7 +9,7 @@ const dbPasswordSecretId = coreStack.requireOutput('dbPasswordSecretId') const dbEndpoint = coreStack.requireOutput('dbEndpoint') const dbName = coreStack.requireOutput('dbName') const mailerApiKeyArn = coreStack.requireOutput('mailerApiKeyArn') -const cacheEndpoint = coreStack.requireOutput('cacheEndpoint') +const queueEndpoint = coreStack.requireOutput('queueEndpoint') const awsAccessKeyArn = coreStack.requireOutput('awsAccessKeyArn') const awsAccessSecretArn = coreStack.requireOutput('awsAccessSecretArn') const sentryDsnArn = coreStack.requireOutput('sentryDsnArn') @@ -38,7 +38,7 @@ export const environment = pulumi .all([ awsAccessKey, awsAccessSecret, - cacheEndpoint, + queueEndpoint, dbUrl, mailerApiKey, sentryDsn, @@ -50,7 +50,7 @@ export const environment = pulumi { name: 'HOSTNAME', value: '0.0.0.0' }, { name: 'PORT', value: '8080' }, { name: 'DATABASE_URL', value: dbUrl }, - { name: 'REDIS_HOST', value: cacheEndpoint }, + { name: 'QUEUE_HOST', value: queueEndpoint }, { name: 'GATEWAY_HOSTNAME', value: 'gateway.latitude.so' }, { name: 'GATEWAY_SSL', value: 'true' }, { name: 'LATITUDE_DOMAIN', value: 'latitude.so' }, diff --git a/apps/web/docker/run-production.sh b/apps/web/docker/run-production.sh index 24b676c52..329f3a94c 100755 --- a/apps/web/docker/run-production.sh +++ b/apps/web/docker/run-production.sh @@ -1,8 +1,4 @@ #!/bin/bash export DATABASE_URL="postgres://latitude:secret@db:5432/latitude_development" -# Redis -export REDIS_PORT=6379 -export REDIS_HOST=redis - docker compose up web diff --git a/apps/web/src/env.ts b/apps/web/src/env.ts index f555293a7..a8d6fb3fb 100644 --- a/apps/web/src/env.ts +++ b/apps/web/src/env.ts @@ -9,9 +9,6 @@ export default createEnv({ server: { NODE_ENV: z.string(), DATABASE_URL: z.string(), - REDIS_HOST: z.string(), - REDIS_PORT: z.coerce.number().optional(), - REDIS_PASSWORD: z.string().optional(), GATEWAY_HOSTNAME: z.string(), GATEWAY_PORT: z.coerce.number().optional(), GATEWAY_SSL: z @@ -23,9 +20,6 @@ export default createEnv({ runtimeEnv: { NODE_ENV: process.env.NODE_ENV, DATABASE_URL: process.env.DATABASE_URL, - REDIS_HOST: process.env.REDIS_HOST, - REDIS_PORT: process.env.REDIS_PORT, - REDIS_PASSWORD: process.env.REDIS_PASSWORD, GATEWAY_HOSTNAME: process.env.GATEWAY_HOSTNAME, GATEWAY_PORT: process.env.GATEWAY_PORT, GATEWAY_SSL: process.env.GATEWAY_SSL, diff --git a/apps/workers/docker/run-production.sh b/apps/workers/docker/run-production.sh index 8d63d516e..a21ca5954 100755 --- a/apps/workers/docker/run-production.sh +++ b/apps/workers/docker/run-production.sh @@ -2,10 +2,9 @@ export DATABASE_URL="postgres://latitude:secret@db:5432/latitude_development" # Redis -export REDIS_PORT=6379 -export REDIS_HOST=redis +export QUEUE_HOST=redis docker compose run -it \ -e DATABASE_URL="$DATABASE_URL" \ - -e REDIS_HOST="$REDIS_HOST" \ + -e QUEUE_HOST="$QUEUE_HOST" \ workers dist/server.js diff --git a/apps/workers/src/env.ts b/apps/workers/src/env.ts index 505213795..0098256a6 100644 --- a/apps/workers/src/env.ts +++ b/apps/workers/src/env.ts @@ -8,14 +8,14 @@ export default createEnv({ process.env.BUILDING_CONTAINER == 'true' || process.env.NODE_ENV === 'test', server: { DATABASE_URL: z.string(), - REDIS_HOST: z.string(), - REDIS_PORT: z.coerce.number().optional(), - REDIS_PASSWORD: z.string().optional(), + QUEUE_HOST: z.string(), + QUEUE_PORT: z.coerce.number().optional(), + QUEUE_PASSWORD: z.string().optional(), }, runtimeEnv: { DATABASE_URL: process.env.DATABASE_URL, - REDIS_HOST: process.env.REDIS_HOST, - REDIS_PORT: process.env.REDIS_PORT, - REDIS_PASSWORD: process.env.REDIS_PASSWORD, + QUEUE_HOST: process.env.QUEUE_HOST, + QUEUE_PORT: process.env.QUEUE_PORT, + QUEUE_PASSWORD: process.env.QUEUE_PASSWORD, }, }) diff --git a/packages/env/src/index.ts b/packages/env/src/index.ts index 7ae330ded..0c6724f18 100644 --- a/packages/env/src/index.ts +++ b/packages/env/src/index.ts @@ -22,8 +22,8 @@ if (environment !== 'production') { { NODE_ENV: environment, DATABASE_URL: `postgres://latitude:secret@localhost:5432/latitude_${environment}`, - REDIS_PORT: '6379', - REDIS_HOST: '0.0.0.0', + QUEUE_PORT: '6379', + QUEUE_HOST: '0.0.0.0', GATEWAY_HOSTNAME: 'localhost', GATEWAY_PORT: '8787', GATEWAY_SSL: 'false', @@ -46,9 +46,9 @@ export const env = createEnv({ server: { NODE_ENV: z.string(), DATABASE_URL: z.string().url(), - REDIS_PORT: z.coerce.number().optional().default(6379), - REDIS_HOST: z.string(), - REDIS_PASSWORD: z.string().optional(), + QUEUE_PORT: z.coerce.number().optional().default(6379), + QUEUE_HOST: z.string(), + QUEUE_PASSWORD: z.string().optional(), LATITUDE_URL: z.string().url(), MAILER_API_KEY: z.string().optional(), FROM_MAILER_EMAIL: z.string(), diff --git a/packages/jobs/src/utils/connection.ts b/packages/jobs/src/utils/connection.ts index 71e69ef8b..eb1024626 100644 --- a/packages/jobs/src/utils/connection.ts +++ b/packages/jobs/src/utils/connection.ts @@ -3,7 +3,7 @@ import { env } from '@latitude-data/env' import { buildConnection } from '../connection' export const connection = buildConnection({ - host: env.REDIS_HOST, - port: env.REDIS_PORT, - password: env.REDIS_PASSWORD, + host: env.QUEUE_HOST, + port: env.QUEUE_PORT, + password: env.QUEUE_PASSWORD, }) diff --git a/turbo.json b/turbo.json index 9aa30d288..def8704cb 100644 --- a/turbo.json +++ b/turbo.json @@ -5,9 +5,9 @@ "BUILDING_CONTAINER", "LATITUDE_API_KEY", "DATABASE_URL", - "REDIS_HOST", - "REDIS_PORT", - "REDIS_PASSWORD", + "QUEUE_HOST", + "QUEUE_PORT", + "QUEUE_PASSWORD", "USE_LOCALHOST", "GATEWAY_HOSTNAME", "GATEWAY_PORT",