Skip to content

Commit

Permalink
fix: redis connection
Browse files Browse the repository at this point in the history
  • Loading branch information
leoferreiralima committed Jun 19, 2024
1 parent 037aca9 commit e5e5c09
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 11 deletions.
28 changes: 20 additions & 8 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
services:
wishlist-app:
build:
context: .
dockerfile: Dockerfile
image: leoferreiralima/wishlist:latest
ports:
- "8000:8000"
environment:
- SPRING_PROFILES_ACTIVE=dev
- SPRING_DATA_MONGODB_URI=mongodb://root:secret@mongo:27017/wishlist
- SPRING_PROFILES_ACTIVE=prod
- SPRING_DATA_MONGODB_URI=mongodb://root:secret@mongo:27017/?authSource=admin
- SPRING_REDIS_HOST=redis
- SPRING_REDIS_PORT=6379
networks:
- wishlist_network
depends_on:
- mongo
- redis
labels:
org.springframework.boot.ignore: true
mongo:
image: 'mongo:latest'
environment:
Expand All @@ -24,6 +22,8 @@ services:
- '27017:27017'
volumes:
- mongo_data:/data/db
networks:
- wishlist_network
mongo-express:
image: mongo-express:latest
ports:
Expand All @@ -33,20 +33,32 @@ services:
- ME_CONFIG_MONGODB_ADMINUSERNAME=root
- ME_CONFIG_MONGODB_ADMINPASSWORD=secret
- ME_CONFIG_MONGODB_SERVER=mongo
networks:
- wishlist_network
depends_on:
- mongo
redis:
image: 'redis:latest'
ports:
- '6379:6379'
volumes:
- redis_data:/data
networks:
- wishlist_network
redis-gui:
image: rediscommander/redis-commander:latest
ports:
- "8082:8081"
environment:
- REDIS_HOSTS=local:redis:6379
networks:
- wishlist_network
depends_on:
- redis
volumes:
mongo_data:
redis_data:
redis_data:

networks:
wishlist_network:
driver: bridge
6 changes: 3 additions & 3 deletions src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ spring:
uri: ${SPRING_DATA_MONGODB_URI:mongodb://root:secret@localhost:27017/?authSource=admin}
database: wishlist
auto-index-creation: true
redis:
host: ${SPRING_REDIS_HOST:localhost}
port: ${SPRING_REDIS_PORT:6379}
redis:
host: ${SPRING_REDIS_HOST:redis}
port: ${SPRING_REDIS_PORT:6379}
wishlist:
user-max-limit: 20
redis:
Expand Down

0 comments on commit e5e5c09

Please sign in to comment.