chore: add redis to docker compose files

This commit is contained in:
Ricardo Arturo Cabral Mejía 2022-11-14 23:02:46 -05:00
parent bd79c938eb
commit 59c6f806cb
2 changed files with 42 additions and 2 deletions

View File

@ -3,6 +3,8 @@ services:
build: .
container_name: nostr-ts-relay
environment:
PORT: 8008
NOSTR_CONFIG_DIR: /home/node/
DB_HOST: db
DB_PORT: 5432
DB_USER: nostr_ts_relay
@ -10,14 +12,19 @@ services:
DB_NAME: nostr_ts_relay
DB_MIN_POOL_SIZE: 2
DB_MAX_POOL_SIZE: 10
NOSTR_CONFIG_DIR: /home/node/
PORT: 8008
REDIS_HOST: cache
REDIS_PORT: 6379
REDIS_USER: default
REDIS_PASSWORD: nostr_ts_relay
DEBUG: "worker:*"
user: node:node
volumes:
- $HOME/.nostr:/home/node/
ports:
- 8008:8008
depends_on:
cache:
condition: service_healthy
db:
condition: service_healthy
migrations:
@ -43,6 +50,21 @@ services:
interval: 5s
timeout: 5s
retries: 5
cache:
image: redis:7.0.5-alpine3.16
container_name: cache
volumes:
- cache:/data
command: redis-server --save 20 1 --loglevel warning --requirepass nostr_ts_relay
networks:
default:
ipv4_address: 10.10.10.4
restart: always
healthcheck:
test: [ "CMD", "redis-cli", "ping", "|", "grep", "PONG" ]
interval: 1s
timeout: 5s
retries: 5
migrations:
image: node:18-alpine3.16
container_name: migrations
@ -75,3 +97,4 @@ networks:
volumes:
pgdata:
cache:

View File

@ -11,6 +11,10 @@ services:
DB_PASSWORD: postgres
DB_MIN_POOL_SIZE: 1
DB_MAX_POOL_SIZE: 2
REDIS_HOST: cache-test
REDIS_PORT: 6379
REDIS_USER: default
REDIS_PASSWORD: nostr_ts_relay_test
NOSTR_CONFIG_DIR: /code
volumes:
- ../../src:/code/src
@ -19,6 +23,8 @@ services:
- ../../.test-reports:/code/.test-reports
working_dir: /code
depends_on:
cache-test:
condition: service_healthy
db-test:
condition: service_healthy
migrations-test:
@ -40,6 +46,17 @@ services:
timeout: 5s
start_period: 5s
retries: 0
cache-test:
image: redis:7.0.5-alpine3.16
command: redis-server --save 20 1 --loglevel warning --requirepass nostr_ts_relay_test
networks:
- nostr-ts-relay-test
restart: always
healthcheck:
test: [ "CMD", "redis-cli", "ping", "|", "grep", "PONG" ]
interval: 1s
timeout: 5s
retries: 5
migrations-test:
image: node:18-alpine3.16
environment: