diff --git a/.env.sample b/.env.sample index dd127d74a..8e6955733 100644 --- a/.env.sample +++ b/.env.sample @@ -10,9 +10,17 @@ PIXL_DB_USER=pixl PIXL_DB_PASSWORD= SKIP_ALEMBIC=false +# Orthanc Raw PostgreSQL instance +ORTHANC_RAW_DB_HOST=postgres +ORTHANC_RAW_DB_PORT=5432 +ORTHANC_RAW_DB_NAME=pixl +ORTHANC_RAW_DB_USER=pixl +ORTHANC_RAW_DB_PASSWORD= + # Exposed ports HASHER_API_PORT= -POSTGRES_PORT= +POSTGRES_PIXL_DB_PORT= +POSTGRES_ORTHANC_RAW_DB_PORT= ORTHANC_ANON_DICOM_PORT= ORTHANC_ANON_WEB_PORT= ORTHANC_RAW_DICOM_PORT= diff --git a/cli/README.md b/cli/README.md index 374c358bd..5ddd3de25 100644 --- a/cli/README.md +++ b/cli/README.md @@ -44,8 +44,8 @@ RABBITMQ_PORT=7008 RABBITMQ_USERNAME=rabbitmq_username RABBITMQ_PASSWORD=rabbitmq_password -POSTGRES_HOST=localhost -POSTGRES_PORT=7001 +POSTGRES_PIXL_DB_HOST=localhost +POSTGRES_PIXL_DB_PORT=7001 PIXL_DB_USER=pixl_db_username PIXL_DB_PASSWORD=pixl_db_password PIXL_DB_NAME=pixl diff --git a/cli/src/pixl_cli/_config.py b/cli/src/pixl_cli/_config.py index 7a4f578cc..6d2f4ca80 100644 --- a/cli/src/pixl_cli/_config.py +++ b/cli/src/pixl_cli/_config.py @@ -29,8 +29,8 @@ "password": config("RABBITMQ_PASSWORD"), }, "postgres": { - "host": config("POSTGRES_HOST"), - "port": int(config("POSTGRES_PORT")), + "host": config("POSTGRES_PIXL_DB_HOST"), + "port": int(config("POSTGRES_PIXL_DB_PORT")), "username": config("PIXL_DB_USER"), "password": config("PIXL_DB_PASSWORD"), "database": config("PIXL_DB_NAME"), diff --git a/docker-compose.yml b/docker-compose.yml index 0f4c753b3..22cd1c8f0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -46,6 +46,13 @@ x-pixl-db: &pixl-db PIXL_DB_PASSWORD: ${PIXL_DB_PASSWORD} PIXL_DB_NAME: ${PIXL_DB_NAME} +x-orthanc-raw-db: &orthanc-raw-db + ORTHANC_RAW_DB_HOST: ${ORTHANC_RAW_DB_HOST} + ORTHANC_RAW_DB_PORT: ${ORTHANC_RAW_DB_PORT} + ORTHANC_RAW_DB_USER: ${ORTHANC_RAW_DB_USER} + ORTHANC_RAW_DB_PASSWORD: ${ORTHANC_RAW_DB_PASSWORD} + ORTHANC_RAW_DB_NAME: ${ORTHANC_RAW_DB_NAME} + x-azure-keyvault: &azure-keyvault AZURE_CLIENT_ID: ${EXPORT_AZ_CLIENT_ID} AZURE_CLIENT_SECRET: ${EXPORT_AZ_CLIENT_PASSWORD} @@ -186,7 +193,7 @@ services: platform: linux/amd64 command: /run/secrets environment: - <<: [*pixl-db, *proxy-common, *pixl-common-env] + <<: [*orthanc-raw-db, *proxy-common, *pixl-common-env] ORTHANC_NAME: "PIXL: Raw" ORTHANC_USERNAME: ${ORTHANC_RAW_USERNAME} ORTHANC_PASSWORD: ${ORTHANC_RAW_PASSWORD} @@ -359,9 +366,9 @@ services: args: <<: *build-args-common environment: - POSTGRES_USER: ${PIXL_DB_USER} - POSTGRES_PASSWORD: ${PIXL_DB_PASSWORD} - POSTGRES_DB: ${PIXL_DB_NAME} + POSTGRES_USER: ${ORTHANC_RAW_DB_USER} + POSTGRES_PASSWORD: ${ORTHANC_RAW_DB_PASSWORD} + POSTGRES_DB: ${ORTHANC_RAW_DB_NAME} PGTZ: ${TZ:-Europe/London} env_file: - ./docker/common.env @@ -371,9 +378,9 @@ services: source: postgres-data target: /var/lib/postgresql/data ports: - - "${POSTGRES_PORT}:5432" + - "${POSTGRES_ORTHANC_RAW_DB_PORT}:5432" healthcheck: - test: ["CMD", "pg_isready", "-U", "${PIXL_DB_USER}", "--dbname", "${PIXL_DB_NAME}"] + test: ["CMD", "pg_isready", "-U", "${ORTHANC_RAW_DB_USER}", "--dbname", "${ORTHANC_RAW_DB_NAME}"] interval: 10s timeout: 30s retries: 5 diff --git a/orthanc/orthanc-raw/config/postgres.json b/orthanc/orthanc-raw/config/postgres.json index 4aa9c9bf3..8395c7239 100644 --- a/orthanc/orthanc-raw/config/postgres.json +++ b/orthanc/orthanc-raw/config/postgres.json @@ -4,7 +4,7 @@ "PostgreSQL" : { "EnableIndex" : true, "EnableStorage" : false, - "ConnectionUri" : "postgresql://${PIXL_DB_USER}:${PIXL_DB_PASSWORD}@${PIXL_DB_HOST}:${PIXL_DB_PORT}/${PIXL_DB_NAME}", + "ConnectionUri" : "postgresql://${ORTHANC_RAW_DB_USER}:${ORTHANC_RAW_DB_PASSWORD}@${ORTHANC_RAW_DB_HOST}:${ORTHANC_RAW_DB_PORT}/${ORTHANC_RAW_DB_NAME}", "Lock" : true } } \ No newline at end of file diff --git a/test/.env b/test/.env index 5b2f8a634..b2e3a2d05 100644 --- a/test/.env +++ b/test/.env @@ -8,16 +8,24 @@ PIXL_MAX_MESSAGES_IN_FLIGHT=5 TZ=Europe/London # PIXL PostgreSQL instance -PIXL_DB_HOST=postgres +PIXL_DB_HOST=postgres-pixl-db PIXL_DB_PORT=5432 PIXL_DB_NAME=pixl PIXL_DB_USER=pixl_db_username PIXL_DB_PASSWORD=pixl_db_password SKIP_ALEMBIC=false +# Orthanc Raw PostgreSQL instance +ORTHANC_RAW_DB_HOST=postgres +ORTHANC_RAW_DB_PORT=5432 +ORTHANC_RAW_DB_NAME=pixl +ORTHANC_RAW_DB_USER=orthanc_raw_db_username +ORTHANC_RAW_DB_PASSWORD=orthanc_raw_db_password + # Exposed ports HASHER_API_PORT=7010 -POSTGRES_PORT=7001 +POSTGRES_PIXL_DB_PORT=7001 +POSTGRES_ORTHANC_RAW_DB_PORT=7011 ORTHANC_ANON_DICOM_PORT=7002 ORTHANC_ANON_WEB_PORT=7003 ORTHANC_RAW_DICOM_PORT=7004 @@ -29,7 +37,7 @@ RABBITMQ_ADMIN_PORT=7009 FTP_PORT=20021 # PIXL Export API -POSTGRES_HOST=localhost +POSTGRES_PIXL_DB_HOST=localhost PIXL_EXPORT_API_HOST=localhost # PIXL Imaging API diff --git a/test/docker-compose.yml b/test/docker-compose.yml index f123709fc..d56a091d3 100644 --- a/test/docker-compose.yml +++ b/test/docker-compose.yml @@ -13,6 +13,7 @@ # limitations under the License. volumes: vna-qr-data: + postgres-pixl-db-data: networks: pixl-net: @@ -73,3 +74,27 @@ services: retries: 2 interval: 3s timeout: 2s + postgres-pixl-db: + build: + context: ../ + dockerfile: ./docker/postgres/Dockerfile + environment: + POSTGRES_USER: ${PIXL_DB_USER} + POSTGRES_PASSWORD: ${PIXL_DB_PASSWORD} + POSTGRES_DB: ${PIXL_DB_NAME} + PGTZ: ${TZ:-Europe/London} + command: postgres -c 'config_file=/etc/postgresql/postgresql.conf' + volumes: + - type: volume + source: postgres-pixl-db-data + target: /var/lib/postgresql/data + ports: + - "${POSTGRES_PIXL_DB_PORT}:5432" + healthcheck: + test: ["CMD", "pg_isready", "-U", "${PIXL_DB_USER}", "--dbname", "${PIXL_DB_NAME}"] + interval: 10s + timeout: 30s + retries: 5 + restart: always + networks: + - pixl-net