fix(backend): don't hardcode redis URL, add redis to docker compose

This commit is contained in:
sam 2025-03-04 17:25:07 +01:00
parent 7759225428
commit f99d10ecf0
Signed by: sam
GPG key ID: B4EF20DDE721CAA1
2 changed files with 10 additions and 3 deletions

View file

@ -24,8 +24,7 @@ namespace Foxnouns.Backend.Services;
public class KeyCacheService(Config config)
{
public ConnectionMultiplexer Multiplexer { get; } =
// ConnectionMultiplexer.Connect(config.Database.Redis);
ConnectionMultiplexer.Connect("127.0.0.1:6379");
ConnectionMultiplexer.Connect(config.Database.Redis);
public async Task SetKeyAsync(string key, string value, Duration expireAfter) =>
await Multiplexer

View file

@ -7,6 +7,7 @@ services:
environment:
- "Database:Url=Host=postgres;Database=postgres;Username=postgres;Password=postgres"
- "Database:EnablePooling=true"
- "Database:Redis=redis:6379"
- "Host=0.0.0.0"
- "Port=5000"
- "Logging:MetricsPort=5001"
@ -31,7 +32,7 @@ services:
rate:
image: rate
build: ./rate
build: ./Foxnouns.RateLimiter
environment:
- "PORT=5003"
restart: unless-stopped
@ -52,6 +53,12 @@ services:
volumes:
- postgres_data:/var/lib/postgresql/data
redis:
image: registry.redict.io/redict:7
restart: unless-stopped
volumes:
- redict_data:/data
caddy:
image: docker.io/caddy:2
restart: unless-stopped
@ -67,3 +74,4 @@ volumes:
caddy_data:
caddy_config:
postgres_data:
redict_data: