Thingworx Docker doesn't connect to internal Postgres
Hi all, I've been trying to get the Twx 9.5.0 dockerfiles up and running on WSL2. I've managed to build all of my images (Security CLI, platform-postgres) and get them to spin, but it looks like Thingworx can't connect to the provided 'starter postgres' database, and the Platform shuts down:

2024-05-02 21:04:35.758+0000 [L: ERROR] [O: c.t.s.ThingWorxBootstrapper] [I: ] [U: SuperUser] [S: ] [P: ] [T: main] *** CRITICAL ERROR ON STARTUP: Connections could not be acquired from the underlying database!
2024-05-02 21:04:35.758+0000 [L: ERROR] [O: c.t.s.ThingWorxBootstrapper] [I: ] [U: SuperUser] [S: ] [P: ] [T: main] *** Web Application STATE is being set to ERROR! ***
2024-05-02 21:04:35.758+0000 [L: INFO] [O: c.t.s.ThingWorxServer] [I: ] [U: SuperUser] [S: ] [P: ] [T: main] >>>>>>> PLATFORM SHUTDOWN START <<<<<<<<<
I've handled this error for non-Docker installs. But this database is ephemeral, I think I've searched myself in circles, and I'm not sure how to further debug. From what I can tell, my Compose file should be fine (below). Have I misconfigured something, forgotten to open some port on Windows, or am I missing something? Any wisdom would be appreciated.
version: '2.2'
volumes:
storage:
services:
postgresql:
image: postgres:15.4
ports:
- "5432"
healthcheck:
test: pg_isready -U postgres
interval: 15s
environment:
- "POSTGRES_USER=postgres"
- "POSTGRES_PASSWORD=postgres"
- "POSTGRES_DB=postgres"
postgresql-init:
image: thingworx/postgresql-init-twx:latest
entrypoint: bash -c -x "/usr/local/bin/db-check.sh && /usr/local/bin/db-setup.sh && sleep infinity"
healthcheck:
test: [ "CMD-SHELL", "grep 'success' tmp/status.txt || exit 1" ]
interval: 15s
retries: 5
depends_on:
postgresql:
condition: service_healthy
environment:
- "DATABASE_ADMIN_USERNAME=postgres"
- "DATABASE_ADMIN_PASSWORD=postgres"
- "DATABASE_ADMIN_SCHEMA=postgres"
- "DATABASE_HOST=postgresql"
- "DATABASE_PORT=5432"
- "TWX_DATABASE_USERNAME=twadmin"
- "TWX_DATABASE_SCHEMA=twadmin"
- "TWX_DATABASE_PASSWORD=Redacted"
- "TABLESPACE_LOCATION=/var/lib/postgresql/data"
security-cli:
image: thingworx/security-tool:latest
entrypoint: sh -c "/opt/docker-entrypoint.sh && sleep infinity"
healthcheck:
test: [ "CMD-SHELL", "grep 'success' status.txt || exit 1" ]
interval: 15s
retries: 5
environment:
KEYSTORE: 'true'
KEYSTORE_PASSWORD: 'Redacted'
KEYSTORE_PASSWORD_FILE_PATH: '/opt'
KEYSTORE_FILE_PATH: '/ThingworxStorage'
CUSTOM_SECRET_LIST: 'encrypt.db.password:TWX_DATABASE_PASSWORD'
TWX_DATABASE_PASSWORD: 'Redacted'
SECRET_PROVISIONING_APP_KEY: 'VerySecret'
volumes:
- storage:/ThingworxStorage
platform:
image: thingworx/platform-postgres:latest
healthcheck:
test: curl -f localhost:8080/Thingworx/health
interval: 15s
depends_on:
security-cli:
condition: service_healthy
postgresql-init:
condition: service_healthy
ports:
- "8080:8080"
- "8443:8443"
environment:
- "CATALINA_OPTS=-Xms2g -Xmx4g"
- "KEYSTORE_PASSWORD=Redacted"
- "SECRET_PROVISIONING_APP_KEY=VerySecret"
- "DATABASE_HOST=postgresql"
- "DATABASE_PORT=5432"
- "TWX_DATABASE_USERNAME=twadmin"
- "TWX_DATABASE_SCHEMA=twadmin"
- "THINGWORX_INITIAL_ADMIN_PASSWORD=MinimumRequirements"
- "THINGWORX_INITIAL_METRICS_USER_PASSWORD="
#Uncomment the below to automatically download license
#- "LS_USERNAME=${PTCUSERNAME}"
#- "LS_PASSWORD=${PTCPASSWORD}"
# Use this to mount your orgs licence file, if not ThingWorx will fallback to temporary licence
volumes:
# - storage:/ThingworxStorage
- "./thingworx-storage/shared/ThingworxPlatform:/ThingworxPlatform"
- "./thingworx-storage/platform1/ThingworxStorage:/ThingworxStorage"
- "./thingworx-storage/platform1/ThingworxBackupStorage:/ThingworxBackupStorage"
- "./thingworx-storage/platform1/tomcat-logs:/app/opt/apache-tomcat/logs"
# - ./license.bin:/ThingworxPlatform/license.bin

