Skip to content

Commit

Permalink
Feat(docker): Separated query database and command database
Browse files Browse the repository at this point in the history
  • Loading branch information
Raphsodyz committed Jun 6, 2024
1 parent bbd75b3 commit 6621263
Showing 1 changed file with 26 additions and 7 deletions.
33 changes: 26 additions & 7 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ networks:
name: futurespaceweb

services:
postgresql:
command-database:
image: "postgres:16.1"
hostname: postgresql
hostname: postgresql-command
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER}"]
interval: 5s
Expand All @@ -23,8 +23,26 @@ services:
- ./Infrastructure/Persistence/Migrations/Launch.data/spacedevs_data.sql:/migrations/seed/spacedevs_data.sql:ro
- ./Infrastructure/Persistence/Migrations/Launch.data/seeddatabase.sh:/docker-entrypoint-initdb.d/seeddatabase.sh:ro
environment:
- POSTGRES_USER=root
- POSTGRES_PASSWORD=root
- POSTGRES_USER=command
- POSTGRES_PASSWORD=command
- POSTGRES_DB=futurespacedb

query-database:
image: "postgres:16.1"
hostname: postgresql-query
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER}"]
interval: 5s
timeout: 5s
retries: 20
start_period: 10s
volumes:
- ./Infrastructure/Persistence/Migrations/migrations.sql:/migrations/migrations.sql:ro
- ./Infrastructure/Persistence/Migrations/Launch.data/spacedevs_data.sql:/migrations/seed/spacedevs_data.sql:ro
- ./Infrastructure/Persistence/Migrations/Launch.data/seeddatabase.sh:/docker-entrypoint-initdb.d/seeddatabase.sh:ro
environment:
- POSTGRES_USER=query
- POSTGRES_PASSWORD=query
- POSTGRES_DB=futurespacedb

api:
Expand All @@ -33,10 +51,11 @@ services:
dockerfile: dockerfile
hostname: api
depends_on:
- postgresql
- command-database
- query-database
environment:
- DB_QUERY_CONNECTION_STRING=Host=postgresql;Username=root;Password=root;Database=futurespacedb;Connection Pruning Interval=1;Connection Idle Lifetime=2;Enlist=false;No Reset On Close=true;MinPoolSize=1;MaxPoolSize=1024;Include Error Detail=True;
- DB_COMMAND_CONNECTION_STRING=Host=postgresql;Username=root;Password=root;Database=futurespacedb;Connection Pruning Interval=1;Connection Idle Lifetime=2;Enlist=false;No Reset On Close=true;MinPoolSize=1;MaxPoolSize=1024;Include Error Detail=True;
- DB_QUERY_CONNECTION_STRING=Host=query-database;Username=query;Password=query;Database=futurespacedb;Connection Pruning Interval=1;Connection Idle Lifetime=2;Enlist=false;No Reset On Close=true;MinPoolSize=1;MaxPoolSize=1024;Include Error Detail=True;
- DB_COMMAND_CONNECTION_STRING=Host=command-database;Username=command;Password=command;Database=futurespacedb;Connection Pruning Interval=1;Connection Idle Lifetime=2;Enlist=false;No Reset On Close=true;MinPoolSize=1;MaxPoolSize=1024;Include Error Detail=True;
- ASPNETCORE_URLS=http://+:5000;

nginx:
Expand Down

0 comments on commit 6621263

Please sign in to comment.