update dockercompose

This commit is contained in:
Emily
2024-09-28 14:21:53 +02:00
parent 69bb6fb03c
commit 9403aebbb9
8 changed files with 130 additions and 70 deletions

View File

@@ -1,10 +1,20 @@
shared/node_modules shared/node_modules
shared/.output shared/.output
scripts/node_modules
lyx-ui/node_modules lyx-ui/node_modules
lyx-ui/.nuxt lyx-ui/.nuxt
lyx-ui/.output lyx-ui/.output
producer/node_modules
producer/scripts/start_dev.js
producer/ecosystem.config.cjs
consumer/node_modules
consumer/scripts/start_dev.js
consumer/ecosystem.config.cjs
dashboard/node_modules dashboard/node_modules
dashboard/.nuxt dashboard/.nuxt
dashboard/.output dashboard/.output
@@ -12,4 +22,5 @@ dashboard/explains
dashboard/tests dashboard/tests
dashboard/.env dashboard/.env
dashboard/winston-*.ndjson dashboard/winston-*.ndjson
dashboard/ecosystem.config.cjs

38
consumer/Dockerfile Normal file
View File

@@ -0,0 +1,38 @@
# Start with a minimal Node.js base image
FROM node:21-alpine as base
# Install pnpm globally with caching to avoid reinstalling if nothing has changed
RUN npm i -g pnpm
# Set the working directory
WORKDIR /home/app
# Copy only package-related files to leverage caching
COPY --link ./scripts/package.json ./scripts/pnpm-lock.yaml ./scripts/
COPY --link ./shared/package.json ./shared/pnpm-lock.yaml ./shared/
COPY --link ./consumer/package.json ./consumer/pnpm-lock.yaml ./consumer/
# Install dependencies for each package
WORKDIR /home/app/scripts
RUN pnpm install --frozen-lockfile
WORKDIR /home/app/shared
RUN pnpm install --frozen-lockfile
WORKDIR /home/app/consumer
RUN pnpm install --frozen-lockfile
# Now copy the rest of the source files
WORKDIR /home/app
COPY --link ../scripts ./scripts
COPY --link ../shared ./shared
COPY --link ../consumer ./consumer
# Build the consumer
WORKDIR /home/app/consumer
RUN pnpm run build_all
# Start the application
CMD ["node", "/home/app/consumer/dist/consumer/src/index.js"]

View File

@@ -19,7 +19,9 @@
"compile": "tsc", "compile": "tsc",
"build": "node ../scripts/build.js", "build": "node ../scripts/build.js",
"create_db": "cd scripts && ts-node create_database.ts", "create_db": "cd scripts && ts-node create_database.ts",
"build_all": "npm run compile && npm run build && npm run create_db" "build_all": "npm run compile && npm run build && npm run create_db",
"docker-build": "docker build -t litlyx-consumer -f Dockerfile ../",
"docker-inspect": "docker run -it litlyx-consumer sh"
}, },
"keywords": [], "keywords": [],
"author": "Emily", "author": "Emily",

View File

@@ -34,6 +34,7 @@ COPY --link ./shared ./shared
# Build the dashboard # Build the dashboard
WORKDIR /home/app/dashboard WORKDIR /home/app/dashboard
RUN pnpm run build RUN pnpm run build
# Use a smaller base image for the final production build # Use a smaller base image for the final production build

View File

@@ -11,7 +11,7 @@
"test": "vitest", "test": "vitest",
"docker-build": "docker build -t litlyx-dashboard -f Dockerfile ../", "docker-build": "docker build -t litlyx-dashboard -f Dockerfile ../",
"docker-inspect": "docker run -it litlyx-dashboard sh", "docker-inspect": "docker run -it litlyx-dashboard sh",
"docker-run": "docker run -p 3000:3000 --name litlyx-dashboard litlyx-dashboard" "docker-run": "docker run -p 3000:3000 litlyx-dashboard"
}, },
"dependencies": { "dependencies": {
"@getbrevo/brevo": "^2.2.0", "@getbrevo/brevo": "^2.2.0",

View File

@@ -2,62 +2,57 @@ services:
mongo: mongo:
image: mongo image: mongo
environment: environment:
# Change with your database username
MONGO_INITDB_ROOT_USERNAME: litlyx MONGO_INITDB_ROOT_USERNAME: litlyx
# Change with your database password
MONGO_INITDB_ROOT_PASSWORD: litlyx MONGO_INITDB_ROOT_PASSWORD: litlyx
# Uncomment to expose database # Uncomment to expose database
# ports: # ports:
# - 27017:27017 # - 27017:27017
volumes: volumes:
- mongo-data:/data/db - mongo-data:/data/db
cache: cache:
image: redis:alpine image: redis:alpine
restart: always restart: always
# Uncomment to expose redis # Uncomment to expose redis
# ports: # ports:
# - "6379:6379" # - "6379:6379"
# Change with "--requirepass YOUR_REDIS_PASSWORD"
command: redis-server --save 20 1 --loglevel warning --requirepass litlyx command: redis-server --save 20 1 --loglevel warning --requirepass litlyx
# producer: producer:
# image: litlyx-producer image: litlyx-producer
# restart: always restart: always
# ports: ports:
# - "3099:3099" - "3099:3099"
# environment: environment:
# PORT: "3099" PORT: "3099"
# REDIS_URL: "redis://cache" REDIS_URL: "redis://cache"
# REDIS_USERNAME: "default" REDIS_USERNAME: "default"
# REDIS_PASSWORD: "litlyx" # Change with your redis password
# STREAM_NAME: "lib-events" REDIS_PASSWORD: "litlyx"
# build: STREAM_NAME: "LITLYX"
# dockerfile: ./producer/Dockerfile build:
dockerfile: ./producer/Dockerfile
# broker: consumer:
# image: litlyx-consumer image: litlyx-consumer
# restart: always restart: always
# ports: environment:
# - "3999:3999" # Optional - Used to send welcome and quota emails
# environment: # EMAIL_SERVICE: "Brevo"
# BREVO_API_KEY: ""
# # Optional - Used to send welcome and quota emails # Change "litlyx:litlyx" with "mongodb://YOUR_MONGO_USERNAME:YOUR_MONGO_PASSWORD"
MONGO_CONNECTION_STRING: "mongodb://litlyx:litlyx@mongo:27017/SimpleMetrics?readPreference=primaryPreferred&authSource=admin"
# # NUXT_EMAIL_SERVICE: "Brevo" REDIS_URL: "redis://cache"
# # NUXT_BREVO_API_KEY: "" REDIS_USERNAME: "default"
# Change with your redis password
# PORT: "3999" REDIS_PASSWORD: "litlyx"
# MONGO_CONNECTION_STRING: "mongodb://litlyx:litlyx@mongo:27017/SimpleMetrics?readPreference=primaryPreferred&authSource=admin" STREAM_NAME: "LITLYX"
# REDIS_URL: "redis://cache" GROUP_NAME: "DATABASE"
# REDIS_USERNAME: "default" build:
# REDIS_PASSWORD: "litlyx" dockerfile: ./broker/Dockerfile
# STREAM_NAME: "lib-events"
# build:
# dockerfile: ./broker/Dockerfile
dashboard: dashboard:
image: litlyx-dashboard image: litlyx-dashboard
@@ -66,57 +61,48 @@ services:
- "3000:3000" - "3000:3000"
environment: environment:
NUXT_PORT: "3000" NUXT_PORT: "3000"
# Change "litlyx:litlyx" with "mongodb://YOUR_MONGO_USERNAME:YOUR_MONGO_PASSWORD"
NUXT_MONGO_CONNECTION_STRING: 'mongodb://litlyx:litlyx@mongo:27017/SimpleMetrics?readPreference=primaryPreferred&authSource=admin' NUXT_MONGO_CONNECTION_STRING: 'mongodb://litlyx:litlyx@mongo:27017/SimpleMetrics?readPreference=primaryPreferred&authSource=admin'
NUXT_REDIS_URL: "redis://cache" NUXT_REDIS_URL: "redis://cache"
NUXT_REDIS_USERNAME: "default" NUXT_REDIS_USERNAME: "default"
# Change with your redis password
NUXT_REDIS_PASSWORD: "litlyx" NUXT_REDIS_PASSWORD: "litlyx"
# Optional - Used for Lit, the AI analyst # Optional - Used for Lit, the AI analyst
# NUXT_AI_ORG: 'OPEN_AI_ORGANIZATION' # NUXT_AI_ORG: 'OPEN_AI_ORGANIZATION'
# NUXT_AI_PROJECT: 'OPEN_AI_PROJECT' # NUXT_AI_PROJECT: 'OPEN_AI_PROJECT'
# NUXT_AI_KEY: 'OPEN_AI_KEY' # NUXT_AI_KEY: 'OPEN_AI_KEY'
# Optional - Used to send welcome and quota emails # Optional - Used to send welcome and quota emails
# NUXT_EMAIL_SERVICE: "Brevo" # NUXT_EMAIL_SERVICE: "Brevo"
# NUXT_BREVO_API_KEY: "" # NUXT_BREVO_API_KEY: ""
# Change with your jwt secret
NUXT_AUTH_JWT_SECRET: "litlyx_jwt_secret" NUXT_AUTH_JWT_SECRET: "litlyx_jwt_secret"
# Optional - Used to register / login via google # Optional - Used to register / login via google
# NUXT_GOOGLE_AUTH_CLIENT_ID: "" # NUXT_GOOGLE_AUTH_CLIENT_ID: ""
# NUXT_GOOGLE_AUTH_CLIENT_SECRET: "" # NUXT_GOOGLE_AUTH_CLIENT_SECRET: ""
# NO_AUTH or GOOGLE # NO_AUTH or GOOGLE
NUXT_PUBLIC_AUTH_MODE: 'NO_AUTH' NUXT_PUBLIC_AUTH_MODE: 'NO_AUTH'
# Default user created in NO_AUTH mode # Default user created in NO_AUTH mode
NUXT_NOAUTH_USER_EMAIL: 'default@user.com' NUXT_NOAUTH_USER_EMAIL: 'default@user.com'
NUXT_NOAUTH_USER_NAME: "defaultuser" NUXT_NOAUTH_USER_NAME: "defaultuser"
# Optional - Used for tests # Optional - Used for tests
# NUXT_STRIPE_SECRET_TEST: "" # NUXT_STRIPE_SECRET_TEST: ""
# NUXT_STRIPE_WH_SECRET_TEST: "" # NUXT_STRIPE_WH_SECRET_TEST: ""
# Optional - Stripe secret - Used to change plans of the projects # Optional - Stripe secret - Used to change plans of the projects
# NUXT_STRIPE_SECRET: "" # NUXT_STRIPE_SECRET: ""
# NUXT_STRIPE_WH_SECRET: "" # NUXT_STRIPE_WH_SECRET: ""
build: build:
dockerfile: ./dashboard/Dockerfile dockerfile: ./dashboard/Dockerfile
#args: #args:
# Optional - Used to register / login via google # Optional - Used to register / login via google
# GOOGLE_AUTH_CLIENT_ID: "" # GOOGLE_AUTH_CLIENT_ID: ""
volumes: volumes:

38
producer/Dockerfile Normal file
View File

@@ -0,0 +1,38 @@
# Start with a minimal Node.js base image
FROM node:21-alpine as base
# Install pnpm globally with caching to avoid reinstalling if nothing has changed
RUN npm i -g pnpm
# Set the working directory
WORKDIR /home/app
# Copy only package-related files to leverage caching
COPY --link ./scripts/package.json ./scripts/pnpm-lock.yaml ./scripts/
COPY --link ./shared/package.json ./shared/pnpm-lock.yaml ./shared/
COPY --link ./producer/package.json ./producer/pnpm-lock.yaml ./producer/
# Install dependencies for each package
WORKDIR /home/app/scripts
RUN pnpm install --frozen-lockfile
WORKDIR /home/app/shared
RUN pnpm install --frozen-lockfile
WORKDIR /home/app/producer
RUN pnpm install --frozen-lockfile
# Now copy the rest of the source files
WORKDIR /home/app
COPY --link ../scripts ./scripts
COPY --link ../shared ./shared
COPY --link ../producer ./producer
# Build the producer
WORKDIR /home/app/producer
RUN pnpm run build_all
# Start the application
CMD ["node", "/home/app/producer/dist/producer/src/index.js"]

18
scripts/pnpm-lock.yaml generated
View File

@@ -7,14 +7,10 @@ settings:
importers: importers:
.: .:
dependencies: devDependencies:
glob: glob:
specifier: ^11.0.0 specifier: ^11.0.0
version: 11.0.0 version: 11.0.0
devDependencies:
'@types/node':
specifier: ^22.5.5
version: 22.5.5
packages: packages:
@@ -26,9 +22,6 @@ packages:
resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==} resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==}
engines: {node: '>=14'} engines: {node: '>=14'}
'@types/node@22.5.5':
resolution: {integrity: sha512-Xjs4y5UPO/CLdzpgR6GirZJx36yScjh73+2NlLlkFRSoQN8B0DpfXPdZGnvVmLRLOsqDpOfTNv7D9trgGhmOIA==}
ansi-regex@5.0.1: ansi-regex@5.0.1:
resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==} resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==}
engines: {node: '>=8'} engines: {node: '>=8'}
@@ -142,9 +135,6 @@ packages:
resolution: {integrity: sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==} resolution: {integrity: sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==}
engines: {node: '>=12'} engines: {node: '>=12'}
undici-types@6.19.8:
resolution: {integrity: sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==}
which@2.0.2: which@2.0.2:
resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==} resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==}
engines: {node: '>= 8'} engines: {node: '>= 8'}
@@ -172,10 +162,6 @@ snapshots:
'@pkgjs/parseargs@0.11.0': '@pkgjs/parseargs@0.11.0':
optional: true optional: true
'@types/node@22.5.5':
dependencies:
undici-types: 6.19.8
ansi-regex@5.0.1: {} ansi-regex@5.0.1: {}
ansi-regex@6.1.0: {} ansi-regex@6.1.0: {}
@@ -279,8 +265,6 @@ snapshots:
dependencies: dependencies:
ansi-regex: 6.1.0 ansi-regex: 6.1.0
undici-types@6.19.8: {}
which@2.0.2: which@2.0.2:
dependencies: dependencies:
isexe: 2.0.0 isexe: 2.0.0