Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Microservices #26

Merged
merged 2 commits into from
Apr 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading