From 4570b086eaa67865b95e053fe1fc85905a7b3f75 Mon Sep 17 00:00:00 2001 From: Cyrille Derche Date: Sat, 13 Apr 2024 19:52:59 +0200 Subject: [PATCH 1/2] add .env.example --- .env.example | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/.env.example b/.env.example index 663c73c..dbcd4a8 100644 --- a/.env.example +++ b/.env.example @@ -1,11 +1,16 @@ -NODE_ENV=development -PORT=3000 +TELEGRAM_TOKEN=GENERATE_WITH_BOTFATHER -API_ID=YOUR_TELEGRAM_API_ID -API_HASH=YOUR_TELEGRAM_API_HASH -SESSION=YOUR_TELEGRAM_SESSION +RMQ_HOST=localhost +RMQ_PORT=5672 +RMQ_USER=guest +RMQ_PASS=guest -NEO4J_HOST=neo4j +MONGO_HOST=localhost +MONGO_PORT=27017 +MONGO_USER=root +MONGO_PASS=pass + +NEO4J_HOST=localhost NEO4J_PORT=7687 -NEO4J_USERNAME=neo4j -NEO4J_PASSWORD=password \ No newline at end of file +NEO4J_USER=neo4j +NEO4J_PASS=password \ No newline at end of file From 9604c4ed8bb18fd1d86862ce4105ff13aa3bb8ab Mon Sep 17 00:00:00 2001 From: Cyrille Derche Date: Sat, 13 Apr 2024 19:53:14 +0200 Subject: [PATCH 2/2] Update Dockerfile and docker-compose --- Dockerfile | 1 + docker-compose.yml | 70 +++++++++++++++++++++++----------------------- 2 files changed, 36 insertions(+), 35 deletions(-) diff --git a/Dockerfile b/Dockerfile index 74b0a11..1250383 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,6 +22,7 @@ WORKDIR /usr/src/app COPY package*.json ./ +RUN npm i -g @nestjs/cli RUN npm i --production --force COPY . . diff --git a/docker-compose.yml b/docker-compose.yml index 81bae60..cc2a98d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,22 @@ version: '3.9' +x-telegram-common: + &telegram-common + build: + context: . + dockerfile: Dockerfile + target: production + restart: unless-stopped + env_file: + - ./.env + depends_on: + rabbitmq: + condition: service_healthy + neo4j: + condition: service_healthy + mongodb: + condition: service_healthy + services: mongodb: container_name: mongodb @@ -51,42 +68,25 @@ services: - NEO4J_PLUGINS=["apoc", "graph-data-science"] - NEO4J_dbms_security_procedures_unrestricted=apoc.*,gds.* - NEO4J_AUTH=neo4j/password + healthcheck: + test: ["CMD" ,"wget", "http://localhost:7474"] + interval: 1m30s + timeout: 10s + retries: 2 + start_period: 40s - # bot: - # container_name: bot - # build: - # context: . - # dockerfile: Dockerfile - # target: development - # command: npm run start:dev bot - # restart: unless-stopped - # env_file: - # - .env - # volumes: - # - .:/usr/src/app - # - ./node_modules:/usr/src/app/node_modules - # depends_on: - # rabbitmq: - # condition: service_healthy - - # event-store: - # container_name: event-store - # build: - # context: . - # dockerfile: Dockerfile - # target: development - # command: npm run start:dev event-store - # restart: unless-stopped - # env_file: - # - .env - # volumes: - # - .:/usr/src/app - # - ./node_modules:/usr/src/app/node_modules - # depends_on: - # mongodb: - # condition: service_healthy - # rabbitmq: - # condition: service_healthy + telegram-bot: + <<: [*telegram-common] + container_name: telegram-bot + command: npm run start bot + telegram-events: + <<: [*telegram-common] + container_name: telegram-events + command: npm run start event-store + telegram-graph: + <<: [*telegram-common] + container_name: telegram-graph + command: npm run start graph-store volumes: mongo_data: