FEAT: Added Redis Caching
This commit is contained in:
@@ -126,6 +126,23 @@ services:
|
||||
- action: rebuild
|
||||
path: ./cms
|
||||
|
||||
# Stands in for the ElastiCache node infrastructure/main.go provisions on the
|
||||
# AWS stacks. Not provisioned through LocalStack like the buckets and the
|
||||
# database are: ElastiCache hands out an endpoint on a port it chooses, and
|
||||
# the literal REDIS_ADDR below has to be known before anything is created.
|
||||
# Nothing here is worth persisting — every entry is derivable from Postgres,
|
||||
# which is the whole point of a cache — so there is no volume.
|
||||
redis:
|
||||
container_name: "${REDIS_DOCKER_NAME:-redis}"
|
||||
image: redis:7-alpine
|
||||
ports:
|
||||
- "127.0.0.1:6379:6379"
|
||||
healthcheck:
|
||||
test: ["CMD", "redis-cli", "ping"]
|
||||
interval: 5s
|
||||
timeout: 3s
|
||||
retries: 10
|
||||
|
||||
discovery:
|
||||
container_name: "${DISCOVERY_DOCKER_NAME:-discovery}"
|
||||
build:
|
||||
@@ -143,6 +160,10 @@ services:
|
||||
- AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY:-test}
|
||||
- AWS_ENDPOINT_URL=${AWS_ENDPOINT_URL:-http://localhost.localstack.cloud:4566}
|
||||
- CATALOGUE_EVENTS_QUEUE_URL=${CATALOGUE_EVENTS_QUEUE_URL:-http://localhost.localstack.cloud:4566/000000000000/discovery-catalogue-events}
|
||||
# The catalogue search's cache — the redis service below, standing in for
|
||||
# ElastiCache. main.go panics without an address but only warns if the
|
||||
# node does not answer: a cold cache means slower searches, not none.
|
||||
- REDIS_ADDR=${REDIS_ADDR:-redis:6379}
|
||||
# Postgres: its own role and database, provisioned alongside the cms ones
|
||||
# by newServiceDatabase, so the two services share no credentials.
|
||||
- DB_HOST=${DISCOVERY_DB_HOST:-localhost.localstack.cloud}
|
||||
@@ -154,6 +175,8 @@ services:
|
||||
depends_on:
|
||||
infra:
|
||||
condition: service_completed_successfully
|
||||
redis:
|
||||
condition: service_healthy
|
||||
develop:
|
||||
watch:
|
||||
# Same as cms: a compiled binary, so every change means a new image.
|
||||
|
||||
Reference in New Issue
Block a user