add REDIS configuration for docker (#63)

This commit is contained in:
Daniel Graf
2025-06-26 15:29:18 +02:00
committed by GitHub
parent 6eb46e9ed7
commit 2495727519
4 changed files with 39 additions and 15 deletions

View File

@@ -142,6 +142,10 @@ docker run -p 8080:8080 \
-e RABBITMQ_PORT=5672 \
-e RABBITMQ_USER=reitti \
-e RABBITMQ_PASSWORD=reitti \
-e REDIS_HOST=redis \
-e REDIS_PORT=6379 \
-e REDIS_USERNAME= \
-e REDIS_PASSWORD=
dedicatedcode/reitti:latest
```
@@ -150,27 +154,32 @@ docker run -p 8080:8080 \
The included `docker-compose.yml` provides a complete setup with:
- PostgreSQL with PostGIS extensions
- RabbitMQ for message processing
- Redis for caching and session storage
- Reitti application with proper networking
- Persistent data volumes
- Health checks and restart policies
### Environment Variables
| Variable | Description | Default |
|----------|-------------|---------|
| `POSTGIS_HOST` | PostgreSQL database host | postgis |
| `POSTGIS_PORT` | PostgreSQL database port | 5432 |
| `POSTGIS_DB` | PostgreSQL database name | reittidb |
| `POSTGIS_USER` | Database username | reitti |
| `POSTGIS_PASSWORD` | Database password | reitti |
| `RABBITMQ_HOST` | RabbitMQ host | rabbitmq |
| `RABBITMQ_PORT` | RabbitMQ port | 5672 |
| `RABBITMQ_USER` | RabbitMQ username | reitti |
| `RABBITMQ_PASSWORD` | RabbitMQ password | reitti |
| `SERVER_PORT` | Application server port | 8080 |
| `APP_UID` | User ID to run the application as | 1000 |
| `APP_GID` | Group ID to run the application as | 1000 |
| `JAVA_OPTS` | JVM options | |
| Variable | Description | Default |
|---------------------|------------------------------------|----------|
| `POSTGIS_HOST` | PostgreSQL database host | postgis |
| `POSTGIS_PORT` | PostgreSQL database port | 5432 |
| `POSTGIS_DB` | PostgreSQL database name | reittidb |
| `POSTGIS_USER` | Database username | reitti |
| `POSTGIS_PASSWORD` | Database password | reitti |
| `RABBITMQ_HOST` | RabbitMQ host | rabbitmq |
| `RABBITMQ_PORT` | RabbitMQ port | 5672 |
| `RABBITMQ_USER` | RabbitMQ username | reitti |
| `RABBITMQ_PASSWORD` | RabbitMQ password | reitti |
| `REDIS_HOST` | Redis host | redis |
| `REDIS_PORT` | Redis port | 6379 |
| `REDIS_USERNAME` | Redis username (optional) | |
| `REDIS_PASSWORD` | Redis password (optional) | |
| `SERVER_PORT` | Application server port | 8080 |
| `APP_UID` | User ID to run the application as | 1000 |
| `APP_GID` | Group ID to run the application as | 1000 |
| `JAVA_OPTS` | JVM options | |
### Tags

View File

@@ -11,6 +11,11 @@ services:
restart: true
redis:
condition: service_healthy
environment:
- REDIS_HOST=redis
- REDIS_PORT=6379
- REDIS_PASSWORD=
- REDIS_DATABASE=0
postgis:
image: postgis/postgis:17-3.5-alpine
environment:

View File

@@ -11,5 +11,9 @@ spring.rabbitmq.port=${RABBITMQ_PORT:5672}
spring.rabbitmq.username=${RABBITMQ_USER:reitti}
spring.rabbitmq.password=${RABBITMQ_PASSWORD:reitti}
spring.data.redis.host=${REDIS_HOST:redis}
spring.data.redis.port=${REDIS_PORT:6397}
spring.data.redis.username=${REDIS_USERNAME:}
spring.data.redis.password=${REDIS_PASSWORD:}
logging.level.root = INFO

View File

@@ -16,6 +16,12 @@ spring.datasource.url=jdbc:postgresql://localhost:5432/reittidb
spring.datasource.username=reitti
spring.datasource.password=reitti
#Redis configuration
spring.data.redis.host=localhost
spring.data.redis.port=6379
spring.data.redis.username=
spring.data.redis.password=
spring.thymeleaf.cache=false