diff --git a/apps/gateway/docker/Dockerfile b/apps/gateway/docker/Dockerfile index 8516732ca..efa3dacd9 100644 --- a/apps/gateway/docker/Dockerfile +++ b/apps/gateway/docker/Dockerfile @@ -51,7 +51,6 @@ RUN --mount=type=cache,id=pnpm,target=/pnpm/store \ pnpm turbo build --filter="${PROJECT}..." RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm prune --prod --no-optional -RUN rm -rf ./**/*/src FROM alpine AS runner diff --git a/apps/gateway/docker/run-production.sh b/apps/gateway/docker/run-production.sh index 3f4545450..09f398827 100755 --- a/apps/gateway/docker/run-production.sh +++ b/apps/gateway/docker/run-production.sh @@ -6,13 +6,13 @@ export REDIS_PORT=6379 export REDIS_HOST=redis # Gateway hostname and port -export GATEWAY_HOSTNAME="0.0.0.0" -export GATEWAY_PORT='8080' +export HOST="0.0.0.0" +export PORT docker compose run -it \ - -p $GATEWAY_PORT:$GATEWAY_PORT \ + -p $PORT:$PORT \ -e DATABASE_URL="$DATABASE_URL" \ -e REDIS_HOST="$REDIS_HOST" \ - -e GATEWAY_HOSTNAME="$GATEWAY_HOSTNAME" \ - -e GATEWAY_PORT="$GATEWAY_PORT" \ - gateway dist/server.js -p $GATEWAY_PORT + -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 513efb6a5..114833793 100644 --- a/apps/gateway/src/common/env.ts +++ b/apps/gateway/src/common/env.ts @@ -5,13 +5,12 @@ import { z } from 'zod' const isDev = process.env.NODE_ENV === 'development' const isTest = process.env.NODE_ENV === 'test' -const hasHardcodedEnv = isDev || isTest let localEnv = {} -if (hasHardcodedEnv) { +if (isDev || isTest) { localEnv = { - GATEWAY_HOSTNAME: 'localhost', - GATEWAY_PORT: isTest ? '8788' : '8787', + HOSTNAME: 'localhost', + PORT: isTest ? '8788' : '8787', } } @@ -23,8 +22,8 @@ export default createEnv({ REDIS_HOST: z.string(), REDIS_PORT: z.coerce.number().optional(), REDIS_PASSWORD: z.string().optional(), - GATEWAY_HOSTNAME: z.string().optional().default('localhost'), - GATEWAY_PORT: z.coerce.number().optional(), + HOSTNAME: z.string().default('localhost'), + PORT: z.coerce.number(), }, runtimeEnv: { ...process.env, diff --git a/apps/gateway/src/server.ts b/apps/gateway/src/server.ts index adc13ab18..8effe3d2d 100644 --- a/apps/gateway/src/server.ts +++ b/apps/gateway/src/server.ts @@ -6,11 +6,11 @@ serve( { fetch: app.fetch, overrideGlobalObjects: undefined, - port: env.GATEWAY_PORT, - hostname: env.GATEWAY_HOSTNAME, + hostname: env.HOSTNAME, + port: env.PORT, }, (info) => { - console.log(`Listening on http://${env.GATEWAY_HOSTNAME}:${info.port}`) + console.log(`Listening on http://${env.HOSTNAME}:${info.port}`) }, ) diff --git a/apps/infra/Pulumi.core.yaml b/apps/infra/Pulumi.core.yaml index e37e59cd6..387b51751 100644 --- a/apps/infra/Pulumi.core.yaml +++ b/apps/infra/Pulumi.core.yaml @@ -2,6 +2,8 @@ encryptionsalt: v1:K+dTqOgU40c=:v1:xzsAOOiJEEAsdCQ4:Oe7NKHjXdYdZrcrrBa1/0yolY5M3 config: infra:DATABASE_PASSWORD: secure: v1:WABt/tJjfsAKMplU:RRLtj5mTu301x4sn2Tr91u4O0Msd3mWVJutcDg== + infra:MAILER_API_KEY: + secure: v1:Br02wGwX0UOAZiNp:wIzQFfWCzWygBRCVJNDs/ZP65EXEAIFhduPOOniN6EOeXPyJ4UHjOefPyO2bhOBkR5E3CWLmQBsVjIGrGwAHZYZCQg== infra:albSecurityGroup: secure: v1:HCwWQvcrwQE9Py6E:U5ibuWwH2MNAooASzaHOnSS3pKNhuJHZTh2pnHcSYKRPuuMJ infra:bastionAccountId: diff --git a/apps/infra/src/core/elasticCache.ts b/apps/infra/src/core/elasticCache.ts index 48ba11596..c607c7622 100644 --- a/apps/infra/src/core/elasticCache.ts +++ b/apps/infra/src/core/elasticCache.ts @@ -34,5 +34,30 @@ const cacheCluster = new aws.elasticache.Cluster('LatitudeLLMCacheCluster', { securityGroupIds: [SecurityGroup.id], }) +const queueParameterGroup = new aws.elasticache.ParameterGroup( + 'LatitudeLLMQueueParameterGroup', + { + family: 'redis6.x', + description: 'Custom parameter group for queue cluster', + parameters: [ + { + name: 'maxmemory-policy', + value: 'noeviction', + }, + ], + }, +) + +const queueCluster = new aws.elasticache.Cluster('LatitudeLLMQueueCluster', { + engine: 'redis', + nodeType: 'cache.t3.micro', + numCacheNodes: 1, + port: 6379, + subnetGroupName: subnetGroup.name, + securityGroupIds: [SecurityGroup.id], + parameterGroupName: queueParameterGroup.name, +}) + // Export the cluster endpoint and port export const cacheEndpoint = cacheCluster.cacheNodes[0].address +export const queueEndpoint = queueCluster.cacheNodes[0].address diff --git a/apps/infra/src/core/index.ts b/apps/infra/src/core/index.ts index 07c5354a9..af5345661 100644 --- a/apps/infra/src/core/index.ts +++ b/apps/infra/src/core/index.ts @@ -4,3 +4,4 @@ export * from './elasticCache' export * from './ec2' export * from './ecs' export * from './iam' +export * from './secrets' diff --git a/apps/infra/src/core/secrets.ts b/apps/infra/src/core/secrets.ts new file mode 100644 index 000000000..b3962e942 --- /dev/null +++ b/apps/infra/src/core/secrets.ts @@ -0,0 +1,16 @@ +import * as aws from '@pulumi/aws' +import * as pulumi from '@pulumi/pulumi' + +const cfg = new pulumi.Config() + +const mailerApiKey = new aws.secretsmanager.Secret('MAILER_API_KEY', { + description: 'API key for the mailer service', + name: 'MAILER_API_KEY', +}) + +new aws.secretsmanager.SecretVersion('MAILER_API_KEY_VERSION', { + secretId: mailerApiKey.id, + secretString: cfg.requireSecret('MAILER_API_KEY'), +}) + +export const mailerApiKeyArn = mailerApiKey.arn diff --git a/apps/infra/src/deployments/gateway.ts b/apps/infra/src/deployments/gateway.ts index 4cc1ea903..24dfa32cc 100644 --- a/apps/infra/src/deployments/gateway.ts +++ b/apps/infra/src/deployments/gateway.ts @@ -10,7 +10,7 @@ import { resolve, vpcId, } from '../shared' -import { coreStack, dbUrl } from './shared' +import { coreStack, environment } from './shared' const DNS_ADDRESS = 'gateway.latitude.so' @@ -18,6 +18,7 @@ const DNS_ADDRESS = 'gateway.latitude.so' const repo = new aws.ecr.Repository('latitude-llm-gateway-repo') // Build and push the Docker image +const token = await aws.ecr.getAuthorizationToken() const image = new docker.Image('LatitudeLLMGatewayImage', { build: { platform: 'linux/amd64', @@ -25,92 +26,53 @@ const image = new docker.Image('LatitudeLLMGatewayImage', { dockerfile: resolve('../../../apps/gateway/docker/Dockerfile'), }, imageName: pulumi.interpolate`${repo.repositoryUrl}:latest`, - registry: repo.registryId.apply(async (registryId) => { - const credentials = await aws.ecr.getCredentials({ - registryId, - }) - const decodedCredentials = Buffer.from( - credentials.authorizationToken, - 'base64', - ).toString('ascii') - const [username, password] = decodedCredentials.split(':') - return { - server: credentials.proxyEndpoint, - username, - password: pulumi.secret(password), - } - }), + registry: { + server: repo.repositoryUrl, + username: token.userName, + password: pulumi.secret(token.password), + }, }) // Create a Fargate task definition const containerName = 'LatitudeLLMGatewayContainer' - // Create the log group const logGroup = new aws.cloudwatch.LogGroup('LatitudeLLMGatewayLogGroup', { name: '/ecs/LatitudeLLMGateway', retentionInDays: 7, }) -const cacheEndpoint = coreStack.requireOutput('cacheEndpoint') -const taskDefinition = cacheEndpoint.apply((cacheEndpoint) => - dbUrl.apply((dbUrl) => - logGroup.name.apply( - (logGroupName) => - new aws.ecs.TaskDefinition('LatitudeLLMGatewayTaskDefinition', { - family: 'LatitudeLLMTaskFamily', - cpu: '256', - memory: '512', - networkMode: 'awsvpc', - requiresCompatibilities: ['FARGATE'], - executionRoleArn: ecsTaskExecutionRole, - containerDefinitions: pulumi - .output(image.imageName) - .apply((imageName) => - JSON.stringify([ - { - name: containerName, - image: imageName, - essential: true, - portMappings: [ - { - containerPort: 8080, - hostPort: 8080, - protocol: 'tcp', - }, - ], - environment: [ - { - name: 'DATABASE_URL', - value: dbUrl, - }, - { - name: 'REDIS_HOST', - value: cacheEndpoint, - }, - { - name: 'GATEWAY_HOSTNAME', - value: '0.0.0.0', - }, - { - name: 'GATEWAY_PORT', - value: '8080', - }, - ], - logConfiguration: { - logDriver: 'awslogs', - options: { - 'awslogs-group': logGroupName, - 'awslogs-region': 'eu-central-1', - 'awslogs-stream-prefix': 'ecs', - }, - }, - }, - ]), - ), - }), - ), - ), -) +const taskDefinition = pulumi + .all([logGroup.name, image.imageName, environment]) + .apply( + ([logGroupName, imageName, environment]) => + new aws.ecs.TaskDefinition('LatitudeLLMGatewayTaskDefinition', { + family: 'LatitudeLLMTaskFamily', + cpu: '256', + memory: '512', + networkMode: 'awsvpc', + requiresCompatibilities: ['FARGATE'], + executionRoleArn: ecsTaskExecutionRole, + containerDefinitions: JSON.stringify([ + { + name: containerName, + image: imageName, + essential: true, + portMappings: [ + { containerPort: 8080, hostPort: 8080, protocol: 'tcp' }, + ], + environment, + logConfiguration: { + logDriver: 'awslogs', + options: { + 'awslogs-group': logGroupName, + 'awslogs-region': 'eu-central-1', + 'awslogs-stream-prefix': 'ecs', + }, + }, + }, + ]), + }), + ) const targetGroup = new aws.lb.TargetGroup('LatitudeLLMGatewayTg', { port: 8080, diff --git a/apps/infra/src/deployments/shared.ts b/apps/infra/src/deployments/shared.ts index 2412734f1..7f7b5d80e 100644 --- a/apps/infra/src/deployments/shared.ts +++ b/apps/infra/src/deployments/shared.ts @@ -15,5 +15,30 @@ const dbPassword = dbPasswordSecretId.apply((secretId) => }) .then((secret) => secret.secretString), ) +const mailerApiKeyArn = coreStack.requireOutput('mailerApiKeyArn') +const cacheEndpoint = coreStack.requireOutput('cacheEndpoint') +const mailerApiKey = mailerApiKeyArn.apply((arn) => { + const secret = aws.secretsmanager.getSecretVersionOutput({ + secretId: arn, + }) + + return secret.secretString +}) export const dbUrl = pulumi.interpolate`postgresql://${dbUsername}:${dbPassword}@${dbEndpoint}/${dbName}?sslmode=verify-full&sslrootcert=/app/packages/core/src/assets/eu-central-1-bundle.pem` +export const environment = pulumi + .all([cacheEndpoint, dbUrl, mailerApiKey]) + .apply(() => { + return [ + { name: 'HOSTNAME', value: '0.0.0.0' }, + { name: 'PORT', value: '8080' }, + { name: 'DATABASE_URL', value: dbUrl }, + { name: 'REDIS_HOST', value: cacheEndpoint }, + { name: 'GATEWAY_HOSTNAME', value: 'gateway.latitude.so' }, + { name: 'GATEWAY_SSL', value: 'true' }, + { name: 'LATITUDE_DOMAIN', value: 'latitude.so' }, + { name: 'LATITUDE_URL', value: 'https://app.latitude.so' }, + { name: 'FROM_MAILER_EMAIL', value: 'hello@latitude.so' }, + { name: 'MAILER_API_KEY', value: mailerApiKey }, + ] + }) diff --git a/apps/infra/src/deployments/web.ts b/apps/infra/src/deployments/web.ts index 900a07067..5893e1ded 100644 --- a/apps/infra/src/deployments/web.ts +++ b/apps/infra/src/deployments/web.ts @@ -10,7 +10,7 @@ import { resolve, vpcId, } from '../shared' -import { coreStack, dbUrl } from './shared' +import { coreStack, environment } from './shared' const DNS_ADDRESS = 'app.latitude.so' @@ -18,6 +18,7 @@ const DNS_ADDRESS = 'app.latitude.so' const repo = new aws.ecr.Repository('latitude-llm-app-repo') // Build and push the Docker image +const token = await aws.ecr.getAuthorizationToken() const image = new docker.Image('LatitudeLLMAppImage', { build: { platform: 'linux/amd64', @@ -25,21 +26,11 @@ const image = new docker.Image('LatitudeLLMAppImage', { dockerfile: resolve('../../../apps/web/docker/Dockerfile'), }, imageName: pulumi.interpolate`${repo.repositoryUrl}:latest`, - registry: repo.registryId.apply(async (registryId) => { - const credentials = await aws.ecr.getCredentials({ - registryId, - }) - const decodedCredentials = Buffer.from( - credentials.authorizationToken, - 'base64', - ).toString('ascii') - const [username, password] = decodedCredentials.split(':') - return { - server: credentials.proxyEndpoint, - username, - password: pulumi.secret(password), - } - }), + registry: { + server: repo.repositoryUrl, + username: token.userName, + password: pulumi.secret(token.password), + }, }) // Create a Fargate task definition @@ -49,91 +40,54 @@ const logGroup = new aws.cloudwatch.LogGroup('LatitudeLLMAppLogGroup', { name: '/ecs/LatitudeLLMApp', retentionInDays: 7, }) -const cacheEndpoint = coreStack.requireOutput('cacheEndpoint') -const taskDefinition = cacheEndpoint.apply((cacheEndpoint) => - dbUrl.apply((dbUrl) => - logGroup.name.apply( - (logGroupName) => - new aws.ecs.TaskDefinition('LatitudeLLMAppTaskDefinition', { - family: 'LatitudeLLMTaskFamily', - cpu: '256', - memory: '512', - networkMode: 'awsvpc', - requiresCompatibilities: ['FARGATE'], - executionRoleArn: ecsTaskExecutionRole, - containerDefinitions: pulumi - .output(image.imageName) - .apply((imageName) => { - const environment = [ - { - name: 'HOSTNAME', - value: '0.0.0.0', - }, - { - name: 'PORT', - value: '8080', - }, - { - name: 'DATABASE_URL', - value: dbUrl, - }, - { - name: 'REDIS_HOST', - value: cacheEndpoint, - }, - { - name: 'GATEWAY_HOSTNAME', - value: 'gateway.latitude.so', - }, - { - name: 'GATEWAY_SSL', - value: 'true', - }, - ] - return JSON.stringify([ - { - name: containerName, - image: imageName, - essential: true, - portMappings: [ - { - containerPort: 8080, - hostPort: 8080, - protocol: 'tcp', - }, - ], - environment, - logConfiguration: { - logDriver: 'awslogs', - options: { - 'awslogs-group': logGroupName, - 'awslogs-region': 'eu-central-1', - 'awslogs-stream-prefix': 'ecs', - }, - }, - }, - { - name: 'db-migrate', - image: imageName, - command: ['pnpm', '--prefix', 'packages/core', 'db:migrate'], - essential: false, - environment, - logConfiguration: { - logDriver: 'awslogs', - options: { - 'awslogs-group': logGroupName, - 'awslogs-region': 'eu-central-1', - 'awslogs-stream-prefix': 'ecs', - }, - }, - }, - ]) - }), - }), - ), - ), -) +const taskDefinition = pulumi + .all([logGroup.name, image.imageName, environment]) + .apply( + ([logGroupName, imageName, environment]) => + new aws.ecs.TaskDefinition('LatitudeLLMAppTaskDefinition', { + family: 'LatitudeLLMTaskFamily', + cpu: '256', + memory: '512', + networkMode: 'awsvpc', + requiresCompatibilities: ['FARGATE'], + executionRoleArn: ecsTaskExecutionRole, + containerDefinitions: JSON.stringify([ + { + name: containerName, + image: imageName, + essential: true, + portMappings: [ + { containerPort: 8080, hostPort: 8080, protocol: 'tcp' }, + ], + environment, + logConfiguration: { + logDriver: 'awslogs', + options: { + 'awslogs-group': logGroupName, + 'awslogs-region': 'eu-central-1', + 'awslogs-stream-prefix': 'ecs', + }, + }, + }, + { + name: 'db-migrate', + image: imageName, + command: ['pnpm', '--prefix', 'packages/core', 'db:migrate'], + essential: false, + environment, + logConfiguration: { + logDriver: 'awslogs', + options: { + 'awslogs-group': logGroupName, + 'awslogs-region': 'eu-central-1', + 'awslogs-stream-prefix': 'ecs', + }, + }, + }, + ]), + }), + ) const targetGroup = new aws.lb.TargetGroup('LatitudeLLMAppTg', { port: 8080, diff --git a/apps/infra/src/deployments/workers.ts b/apps/infra/src/deployments/workers.ts index f3bd1cc09..a8469d41f 100644 --- a/apps/infra/src/deployments/workers.ts +++ b/apps/infra/src/deployments/workers.ts @@ -9,12 +9,13 @@ import { privateSubnets, resolve, } from '../shared' -import { coreStack, dbUrl } from './shared' +import { coreStack, environment } from './shared' // Create an ECR repository const repo = new aws.ecr.Repository('latitude-llm-workers-repo') // Build and push the Docker image +const token = await aws.ecr.getAuthorizationToken() const image = new docker.Image('LatitudeLLMWorkersImage', { build: { platform: 'linux/amd64', @@ -22,21 +23,11 @@ const image = new docker.Image('LatitudeLLMWorkersImage', { dockerfile: resolve('../../../apps/workers/docker/Dockerfile'), }, imageName: pulumi.interpolate`${repo.repositoryUrl}:latest`, - registry: repo.registryId.apply(async (registryId) => { - const credentials = await aws.ecr.getCredentials({ - registryId, - }) - const decodedCredentials = Buffer.from( - credentials.authorizationToken, - 'base64', - ).toString('ascii') - const [username, password] = decodedCredentials.split(':') - return { - server: credentials.proxyEndpoint, - username, - password: pulumi.secret(password), - } - }), + registry: { + server: repo.repositoryUrl, + username: token.userName, + password: pulumi.secret(token.password), + }, }) // Create a Fargate task definition @@ -46,54 +37,41 @@ const logGroup = new aws.cloudwatch.LogGroup('LatitudeLLMWorkersLogGroup', { name: '/ecs/LatitudeLLMWorkers', retentionInDays: 7, }) -const cacheEndpoint = coreStack.requireOutput('cacheEndpoint') -const taskDefinition = cacheEndpoint.apply((cacheEndpoint) => - dbUrl.apply((dbUrl) => - logGroup.name.apply( - (logGroupName) => - new aws.ecs.TaskDefinition('LatitudeLLMWorkersTaskDefinition', { - family: 'LatitudeLLMTaskFamily', - cpu: '256', - memory: '512', - networkMode: 'awsvpc', - requiresCompatibilities: ['FARGATE'], - executionRoleArn: ecsTaskExecutionRole, - containerDefinitions: pulumi - .output(image.imageName) - .apply((imageName) => - JSON.stringify([ - { - name: containerName, - image: imageName, - essential: true, - environment: [ - { - name: 'DATABASE_URL', - value: dbUrl, - }, - { - name: 'REDIS_HOST', - value: cacheEndpoint, - }, - ], - logConfiguration: { - logDriver: 'awslogs', - options: { - 'awslogs-group': logGroupName, - 'awslogs-region': 'eu-central-1', - 'awslogs-stream-prefix': 'ecs', - }, - }, - }, - ]), - ), - }), - ), - ), -) -const cluster = coreStack.requireOutput('cluster') as pulumi.Output +const taskDefinition = pulumi + .all([logGroup.name, image.imageName, environment]) + .apply( + ([logGroupName, imageName, environment]) => + new aws.ecs.TaskDefinition('LatitudeLLMWorkersTaskDefinition', { + family: 'LatitudeLLMTaskFamily', + cpu: '256', + memory: '512', + networkMode: 'awsvpc', + requiresCompatibilities: ['FARGATE'], + executionRoleArn: ecsTaskExecutionRole, + containerDefinitions: JSON.stringify([ + { + name: containerName, + image: imageName, + essential: true, + portMappings: [ + { containerPort: 8080, hostPort: 8080, protocol: 'tcp' }, + ], + environment, + logConfiguration: { + logDriver: 'awslogs', + options: { + 'awslogs-group': logGroupName, + 'awslogs-region': 'eu-central-1', + 'awslogs-stream-prefix': 'ecs', + }, + }, + }, + ]), + }), + ) +const cluster = coreStack.requireOutput('cluster') as pulumi.Output export const service = new aws.ecs.Service('LatitudeLLMWorkers', { cluster: cluster.arn, taskDefinition: taskDefinition.arn, diff --git a/apps/web/docker/Dockerfile b/apps/web/docker/Dockerfile index 158a8d565..acc1d58c1 100644 --- a/apps/web/docker/Dockerfile +++ b/apps/web/docker/Dockerfile @@ -51,25 +51,32 @@ RUN --mount=type=cache,id=pnpm,target=/pnpm/store \ pnpm turbo build --filter="${PROJECT}..." RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm prune --prod --no-optional -RUN rm -rf ./**/*/src # PRODUCTION FROM alpine AS runner ARG PROJECT_PATH +WORKDIR /app + ENV NODE_ENV=production -# Unpriviledged user RUN addgroup --system --gid 1001 nodejs RUN adduser --system --uid 1001 nextjs -USER nextjs -WORKDIR /app +COPY --from=builder packages/core/src/assets . +COPY --from=builder /app/apps/web/public ./public -COPY --from=builder --chown=nodejs:latitude /app . +# Set the correct permission for prerender cache +RUN mkdir .next +RUN chown nextjs:nodejs .next -WORKDIR /app/${PROJECT_PATH} +COPY --from=builder --chown=nodejs:nextjs /app/apps/web/.next/standalone ./ +COPY --from=builder --chown=nodejs:nextjs /app/apps/web/.next/static ./.next/static + +WORKDIR /app/apps/web + +USER nextjs ARG PORT=8080 ARG HOSTNAME="0.0.0.0" @@ -81,4 +88,4 @@ ENV NEXT_TELEMETRY_DISABLED=1 EXPOSE $PORT -CMD node .next/standalone/apps/web/server.js -p $PORT -h $HOSTNAME +CMD node server.js -p $PORT -h $HOSTNAME diff --git a/apps/workers/docker/Dockerfile b/apps/workers/docker/Dockerfile index 9bec2c812..4fc780b31 100644 --- a/apps/workers/docker/Dockerfile +++ b/apps/workers/docker/Dockerfile @@ -51,7 +51,6 @@ RUN --mount=type=cache,id=pnpm,target=/pnpm/store \ pnpm turbo build --filter="${PROJECT}..." RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm prune --prod --no-optional -RUN rm -rf ./**/*/src FROM alpine AS runner diff --git a/apps/workers/tsup.config.ts b/apps/workers/tsup.config.ts index 874bbf03c..aad1d8410 100644 --- a/apps/workers/tsup.config.ts +++ b/apps/workers/tsup.config.ts @@ -27,5 +27,6 @@ export default defineConfig({ '@latitude-data/env', '@latitude-data/jobs', '@latitude-data/core', + '@latitude-data/mailers', ], }) diff --git a/package.json b/package.json index c61a9693f..28cebab93 100644 --- a/package.json +++ b/package.json @@ -72,7 +72,6 @@ "react-dom": "^18.3.1", "react-resizable": "^3.0.5", "react-textarea-autosize": "^8.5.3", - "svelte": "^4.2.19", "tailwind-merge": "^2.4.0", "tailwindcss": "^3.4.4", "tailwindcss-animate": "^1.0.7", @@ -81,5 +80,9 @@ "vue": "^3.4.38", "zod": "^3.23.8", "zustand": "^4.5.4" + }, + "optionalDependencies": { + "svelte": "^4.2.19", + "vue": "^3.4.38" } } diff --git a/packages/core/package.json b/packages/core/package.json index 4941d51bf..5fb37867c 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -38,7 +38,6 @@ "@ai-sdk/mistral": "^0.0.38", "@ai-sdk/openai": "^0.0.54", "@faker-js/faker": "^8.4.1", - "@latitude-data/jobs": "workspace:^", "@latitude-data/compiler": "workspace:^", "@latitude-data/env": "workspace:^", "@latitude-data/eslint-config": "workspace:*", diff --git a/packages/env/src/index.ts b/packages/env/src/index.ts index f681159df..12143907c 100644 --- a/packages/env/src/index.ts +++ b/packages/env/src/index.ts @@ -38,7 +38,7 @@ export const env = createEnv({ server: { NODE_ENV: z.string(), DATABASE_URL: z.string().url(), - REDIS_PORT: z.coerce.number(), + REDIS_PORT: z.coerce.number().optional().default(6379), REDIS_HOST: z.string(), REDIS_PASSWORD: z.string().optional(), LATITUDE_URL: z.string().url(), diff --git a/packages/jobs/package.json b/packages/jobs/package.json index 943092dca..5835bc26d 100644 --- a/packages/jobs/package.json +++ b/packages/jobs/package.json @@ -21,7 +21,7 @@ "zod": "^3.23.8" }, "peerDependencies": { - "@latitude-data/core": "workspace:*", + "@latitude-data/core": "workspace:^", "bullmq": "^5.8.7", "ioredis": "^5.4.1", "zod": "^3.23.8" diff --git a/packages/sdks/typescript/rollup.config.mjs b/packages/sdks/typescript/rollup.config.mjs index 7986585ef..fb8d85357 100644 --- a/packages/sdks/typescript/rollup.config.mjs +++ b/packages/sdks/typescript/rollup.config.mjs @@ -10,7 +10,10 @@ const aliasEntries = { entries: [ { find: '$sdk', replacement: path.resolve(__dirname, 'src') }, { find: '$core', replacement: path.resolve(__dirname, '../../core') }, - { find: '$compiler', replacement: path.resolve(__dirname, '../../compiler') } + { + find: '$compiler', + replacement: path.resolve(__dirname, '../../compiler'), + }, ], } const EXTERNALS = ['@t3-oss/env-core', 'zod'] diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9382ef7bf..c65d3ac3c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -122,9 +122,6 @@ importers: react-textarea-autosize: specifier: ^8.5.3 version: 8.5.3(@types/react@18.3.0)(react@18.3.1) - svelte: - specifier: ^4.2.19 - version: 4.2.19 tailwind-merge: specifier: ^2.4.0 version: 2.4.0 @@ -140,15 +137,19 @@ importers: uuid: specifier: ^10.0.0 version: 10.0.0 - vue: - specifier: ^3.4.38 - version: 3.4.38(typescript@5.5.4) zod: specifier: ^3.23.8 version: 3.23.8 zustand: specifier: ^4.5.4 version: 4.5.4(@types/react@18.3.0)(react@18.3.1) + optionalDependencies: + svelte: + specifier: ^4.2.19 + version: 4.2.19 + vue: + specifier: ^3.4.38 + version: 3.4.38(typescript@5.5.4) devDependencies: '@babel/parser': specifier: ^7.25.4 @@ -486,6 +487,9 @@ importers: packages/core: dependencies: + '@latitude-data/jobs': + specifier: workspace:^ + version: link:../jobs '@latitude-data/mailers': specifier: workspace:^ version: link:../mailers @@ -514,9 +518,6 @@ importers: '@latitude-data/eslint-config': specifier: workspace:* version: link:../../tools/eslint - '@latitude-data/jobs': - specifier: workspace:^ - version: link:../jobs '@latitude-data/typescript-config': specifier: workspace:* version: link:../../tools/typescript @@ -608,7 +609,7 @@ importers: packages/jobs: dependencies: '@latitude-data/core': - specifier: workspace:* + specifier: workspace:^ version: link:../core '@latitude-data/env': specifier: workspace:*