From 13c44d25e0f2b0660b939feeee01a0ae7bd9eb8a Mon Sep 17 00:00:00 2001 From: Andrea Ascari Date: Wed, 1 Jan 2025 21:00:57 +0100 Subject: [PATCH] chore: deploy redis service with docker (#1958) --- compose.yml | 15 ++++++++++++--- deploy/compose.yml | 11 +++++++++++ scripts/docker-deploy.sh | 5 +++-- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/compose.yml b/compose.yml index 95ef6b6f4..d36a05ae8 100644 --- a/compose.yml +++ b/compose.yml @@ -49,6 +49,16 @@ services: # timeout: 20s # retries: 3 + redis.liexp.dev: + restart: always + image: 'redis:7.2' + ports: + - '127.0.0.1:6379:6379' + volumes: + - redis-data:/data + networks: + - reverseproxy + api-base: build: context: . @@ -66,6 +76,7 @@ services: depends_on: - db.liexp.dev - fra1.space.liexp.dev + - redis.liexp.dev volumes: - api-node-modules:/usr/src/app/node_modules - ./packages/@liexp:/usr/src/app/packages/@liexp:ro @@ -96,9 +107,6 @@ services: environment: TG_BOT_POLLING: "true" mem_limit: 512M - depends_on: - - db.liexp.dev - - fra1.space.liexp.dev networks: - reverseproxy @@ -188,6 +196,7 @@ volumes: web-node-modules: {} admin-node-modules: {} space-data: {} + redis-data: {} networks: reverseproxy: diff --git a/deploy/compose.yml b/deploy/compose.yml index 6873a85ab..812bdaf40 100644 --- a/deploy/compose.yml +++ b/deploy/compose.yml @@ -30,6 +30,8 @@ services: start_period: 30s command: pnpm start mem_limit: 1G + depends_on: + - redis worker: extends: api-base @@ -40,6 +42,7 @@ services: mem_limit: 512M depends_on: - telegram-bot-api + - redis network_mode: "host" ai-bot: @@ -76,6 +79,14 @@ services: max-file: 5 max-size: 10m + redis: + restart: always + image: redis:7.2 + ports: + - "127.0.0.1:6379:6379" + volumes: + - ./redis-data:/data + telegram-bot-api: image: aiogram/telegram-bot-api:latest env_file: diff --git a/scripts/docker-deploy.sh b/scripts/docker-deploy.sh index 465ff1b18..b511bf3d4 100755 --- a/scripts/docker-deploy.sh +++ b/scripts/docker-deploy.sh @@ -48,6 +48,7 @@ ssh $SSH_DOMAIN "bash -s $username" << "EOF" mkdir -p ./temp/tg/messages mkdir -p ./temp/media mkdir -p ./temp/queue + mkdir -p ./redis-data mkdir -p ./ai-bot-temp chown -R pptruser:pptruser ./config @@ -57,8 +58,8 @@ ssh $SSH_DOMAIN "bash -s $username" << "EOF" export API_UID=$(id pptruser -u) export API_GID=$(id pptruser -g) - docker compose --env-file .env.api pull api web - docker compose --env-file .env.api up --build --force-recreate -d --wait api worker + docker compose --env-file .env.api pull api web redis + docker compose --env-file .env.api up --build --force-recreate -d --wait api worker redis docker compose --env-file .env.web up --build --force-recreate -d --wait --no-deps web docker system prune -f docker builder prune -f --all