Skip to content

Commit

Permalink
🚑 Redis q!
Browse files Browse the repository at this point in the history
  • Loading branch information
Rachid F committed Jun 1, 2024
1 parent 659dc5a commit 0f87492
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 4 deletions.
3 changes: 1 addition & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ DISTRIBUTION=selfhosted # selfhosted or managed
OAUTH_REDIRECT_BASE=http://localhost:3000
JWT_SECRET=secret_jwt
ENCRYPT_CRYPTO_SECRET_KEY="0123456789abcdef0123456789abcdef"
BACKEND_PORT=3000
BACKEND_HOSTNAME="0.0.0.0"
#Managed only
SENTRY_DSN=

Expand All @@ -16,6 +14,7 @@ SENTRY_DSN=
# REDIS
REDIS_HOST=redis
REDIS_PORT=6379
REDIS_USER=default
REDIS_PASS=A3vniod98Zbuvn9u5
# ================================================

Expand Down
9 changes: 8 additions & 1 deletion docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ services:
JWT_SECRET: ${JWT_SECRET}
REDIS_HOST: ${REDIS_HOST}
REDIS_PASS: ${REDIS_PASS}
REDIS_USER: ${REDIS_USER}
REDIS_PORT: ${REDIS_PORT}
ENCRYPT_CRYPTO_SECRET_KEY: ${ENCRYPT_CRYPTO_SECRET_KEY}
HUBSPOT_CRM_CLOUD_CLIENT_ID: ${HUBSPOT_CRM_CLOUD_CLIENT_ID}
Expand Down Expand Up @@ -136,7 +137,13 @@ services:
- ./redis-data:/data
networks:
- backend

healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s

webapp-nextjs:
build:
dockerfile: ./apps/client-ts/Dockerfile.dev
Expand Down
9 changes: 9 additions & 0 deletions docker-compose.source.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ services:
DISTRIBUTION: ${DISTRIBUTION}
JWT_SECRET: ${JWT_SECRET}
REDIS_HOST: ${REDIS_HOST}
REDIS_USER: ${REDIS_USER}
REDIS_PASS: ${REDIS_PASS}
BACKEND_PORT: ${BACKEND_PORT}
ENCRYPT_CRYPTO_SECRET_KEY: ${ENCRYPT_CRYPTO_SECRET_KEY}
Expand Down Expand Up @@ -117,6 +118,8 @@ services:
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
networks:
- backend
healthcheck:
Expand All @@ -136,6 +139,12 @@ services:
- ./redis-data:/data
networks:
- backend
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s

webapp-next:
build:
Expand Down
7 changes: 7 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ services:
DISTRIBUTION: ${DISTRIBUTION}
JWT_SECRET: ${JWT_SECRET}
REDIS_HOST: ${REDIS_HOST}
REDIS_USER: ${REDIS_USER}
REDIS_PASS: ${REDIS_PASS}
REDIS_PORT: ${REDIS_PORT}
ENCRYPT_CRYPTO_SECRET_KEY: ${ENCRYPT_CRYPTO_SECRET_KEY}
Expand Down Expand Up @@ -130,6 +131,12 @@ services:
- ./redis-data:/data
networks:
- backend
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s


magic-link-frontend:
Expand Down
3 changes: 2 additions & 1 deletion packages/api/src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ import { ThrottlerGuard, ThrottlerModule } from '@nestjs/throttler';
host: process.env.REDIS_HOST || 'redis',
port: Number(process.env.REDIS_PORT) || 6379,
password: process.env.REDIS_PASS,
username: process.env.REDIS_USER || 'default'
},
}),
],
Expand All @@ -92,4 +93,4 @@ import { ThrottlerGuard, ThrottlerModule } from '@nestjs/throttler';
},
],
})
export class AppModule {}
export class AppModule {}

0 comments on commit 0f87492

Please sign in to comment.