feat: add network configuration to Docker compose
- Define a custom network 'net1' for services - Attach services to 'net1' network - Ensure connectivity between application components This commit enhances the Docker Compose setup by introducing a custom network. This isolation can help manage service dependencies better and improve communication between services, establishing clearer boundaries. It simplifies networking configuration and lays the groundwork for further scaling if needed.
This commit is contained in:
parent
e1f9118ead
commit
ccb48a387b
14
compose.yaml
14
compose.yaml
@ -8,6 +8,8 @@ services:
|
||||
- DATABASE_URL=postgresql://postgres:${PG_PASSWORD}@db:5432/db
|
||||
- RAILS_MASTER_KEY=${RAILS_MASTER_KEY}
|
||||
- REDIS_URL=redis://redis:6379/0
|
||||
networks:
|
||||
- net1
|
||||
depends_on:
|
||||
- db
|
||||
- redis
|
||||
@ -20,6 +22,8 @@ services:
|
||||
- DATABASE_URL=postgresql://postgres:${PG_PASSWORD}@db:5432/db
|
||||
- RAILS_MASTER_KEY=${RAILS_MASTER_KEY}
|
||||
- REDIS_URL=redis://redis:6379/0
|
||||
networks:
|
||||
- net1
|
||||
depends_on:
|
||||
- db
|
||||
- redis
|
||||
@ -28,6 +32,8 @@ services:
|
||||
image: postgres:16
|
||||
volumes:
|
||||
- ../taw_data/pg:/var/lib/postgresql/data
|
||||
networks:
|
||||
- net1
|
||||
environment:
|
||||
- POSTGRES_PASSWORD=${PG_PASSWORD}
|
||||
- POSTGRES_DB=db
|
||||
@ -36,4 +42,10 @@ services:
|
||||
image: redis:7-alpine
|
||||
volumes:
|
||||
- ../taw_data/redis:/data
|
||||
command: redis-server --appendonly yes
|
||||
networks:
|
||||
- net1
|
||||
command: redis-server --appendonly yes
|
||||
|
||||
networks:
|
||||
net1:
|
||||
driver: bridge
|
Loading…
Reference in New Issue
Block a user