Instalación y configuración > Uso de ThingWorx Docker > Uso de una base de datos externa de PostgreSQL para Docker de ThingWorx
Uso de una base de datos externa de PostgreSQL para Docker de ThingWorx
En el siguiente ejemplo, se muestra un fichero Compose de Docker para una instancia de PostgreSQL que utiliza una base de datos externa:
version: '2.2'
# Note, this example includes a _blank_ postgreSQL docker image for demonstration
# purposes. The postgresql service should be removed and DATABASE_HOST should point
# to the production database either with a DNS name, or IP.
services:
postgresql:
image: postgres:9.4
ports:
- "5432"
healthcheck:
test: pg_isready -U postgres
interval: 15s
environment:
# NOTE: You must manually set a default postgres password if using this
# example for testing.
- "POSTGRES_PASSWORD="
volumes:
- "./thingworx-postgres-storage/postgres-data:/var/lib/postgresql/data"
platform:
image: thingworx/platform-postgres:latest
healthcheck:
test: curl -s -w '%{http_code}' -U 'bad:creds'
localhost:8080/Thingworx/Subsystems/PlatformSubsystem | grep -w 401
interval: 15s
depends_on:
postgresql:
condition: service_healthy
ports:
- "8080:8080"
- "8443:8443"
environment:
- "ENABLE_CLUSTERED_MODE=false"
- "INITIAL_HEAP=2"
- "MAX_HEAP=4"
- "DATABASE_HOST=postgresql"
- "DATABASE_PORT=5432"
- "TWX_DATABASE_USERNAME=thingworx"
- "TWX_DATABASE_SCHEMA=thingworx"
# NOTE: TWX_DATABASE_PASSWORD must be set for your environment manually.
- "TWX_DATABASE_PASSWORD="
- "ENABLE_HTTP=true"
- "ENABLE_HTTPS=false"
# NOTE: If supplying a keystore for SSL, you must set your keystore password
#- "SSL_KEYSTORE_PASSWORD="
- "DATABASE_ADMIN_USERNAME=postgres"
# NOTE: DATABASE_ADMIN_PASSWORD should match your environment or POSTGRES_PASSWORD
# if using above service for testing.
- "DATABASE_ADMIN_PASSWORD="
- "TABLESPACE_LOCATION=/var/lib/postgresql/data"
volumes:
- "./thingworx-postgres-storage/ThingworxPlatform:/ThingworxPlatform"
- "./thingworx-postgres-storage/ThingworxStorage:/ThingworxStorage"
- "./thingworx-postgres-storage/ThingworxBackupStorage:/ThingworxBackupStorage"
- "./thingworx-postgres-storage/tomcat-logs:/opt/apache-tomcat/logs"
Para obtener información sobre la configuración de la base de datos y el esquema de PostgreSQL en casos externos, consulte Instalación de ThingWorx.