Skip to content

Commit

Permalink
Merge pull request #26 from TogetherCrew/microservices
Browse files Browse the repository at this point in the history
Microservices
  • Loading branch information
cyri113 authored Apr 13, 2024
2 parents c0860f5 + 9604c4e commit 0aeaf03
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 43 deletions.
21 changes: 13 additions & 8 deletions .env.example
Original file line number Diff line number Diff line change
@@ -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
NEO4J_USER=neo4j
NEO4J_PASS=password
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ WORKDIR /usr/src/app

COPY package*.json ./

RUN npm i -g @nestjs/cli
RUN npm i --production --force

COPY . .
Expand Down
70 changes: 35 additions & 35 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 0aeaf03

Please sign in to comment.