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:
Para obtener información sobre la configuración de la base de datos y el esquema del servidor de PostgreSQL en casos externos, consulte Instalación de ThingWorx.
version: '2.2'
volumes:
storage:
twx-postgresql:
external: true
services:
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:
# NOTE: Set DATABASE_ADMIN_USERNAME, DATABASE_ADMIN_PASSWORD DATABASE_ADMIN_SCHEMA for connecting
# to the postgres as super user
- "DATABASE_ADMIN_USERNAME=postgres"
- "DATABASE_ADMIN_PASSWORD=postgres"
- "DATABASE_ADMIN_SCHEMA=postgres"
- "DATABASE_HOST=my.external.postgres.server.com"
- "DATABASE_PORT=5432"
- "TWX_DATABASE_USERNAME=thingworx"
- "TWX_DATABASE_SCHEMA=thingworx"
- "TWX_DATABASE_PASSWORD=thingworx"
- "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'
# NOTE: Set KEYSTORE_PASSWORD (Must match value from platform container)
KEYSTORE_PASSWORD: 'thingworxthingworx'
KEYSTORE_PASSWORD_FILE_PATH: '/opt'
KEYSTORE_FILE_PATH: '/ThingworxStorage'
CUSTOM_SECRET_LIST: 'encrypt.db.password:TWX_DATABASE_PASSWORD'
# NOTE: Set TWX_DATABASE_PASSWORD
TWX_DATABASE_PASSWORD: 'thingworx'
volumes:
- "./ThingworxStorage:/ThingworxStorage"
platform:
image: thingworx/platform-postgres:latest
container_name: thingworx_test
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"
# NOTE: Set KEYSTORE_PASSWORD (Must match value from security-cli container)
- "KEYSTORE_PASSWORD=thingworxthingworx"
- "DATABASE_HOST=my.external.postgres.server.com"
- "DATABASE_PORT=5432"
- "TWX_DATABASE_USERNAME=thingworx"
- "TWX_DATABASE_SCHEMA=thingworx"
# NOTE: The following must be set for the Platform to start. This will be
# the initial Administrator password.
- "THINGWORX_INITIAL_ADMIN_PASSWORD=thingworxthingworx"
# NOTE: The following must be set for the Platform to start. This will be
# the initial MetricsUser password.
- "THINGWORX_INITIAL_METRICS_USER_PASSWORD=thingworxthingworx"
- "EXTPKG_IMPORT_POLICY_ENABLED=true"
- "EXTPKG_IMPORT_POLICY_ALLOW_JARRES=true"
- "EXTPKG_IMPORT_POLICY_ALLOW_JSRES=true"
- "EXTPKG_IMPORT_POLICY_ALLOW_CSSRES=true"
- "EXTPKG_IMPORT_POLICY_ALLOW_JSONRES=true"
- "EXTPKG_IMPORT_POLICY_ALLOW_WEBAPPRES=true"
- "EXTPKG_IMPORT_POLICY_ALLOW_ENTITIES=true"
- "EXTPKG_IMPORT_POLICY_ALLOW_EXTENTITIES=true"
- "EXTPKG_IMPORT_POLICY_HA_COMPATIBILITY_LEVEL=true"
- "DOCKER_DEBUG:=true"
#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:
- "./ThingworxStorage:/ThingworxStorage"
- "./ThingworxPlatform:/ThingworxPlatform"
# - ./license.bin:/ThingworxPlatform/license.bin
¿Fue esto útil?