Instalación y actualización > Instalación de ThingWorx > Uso de ThingWorx Docker > Uso de Docker de ThingWorx en un entorno de servidor único > Uso de una base de datos externa de Microsoft SQL Server para Docker de ThingWorx
Uso de una base de datos externa de Microsoft SQL Server para Docker de ThingWorx
En el siguiente ejemplo, se muestra un fichero Compose de Docker para una instancia de Microsoft SQL Server que utiliza una base de datos externa:
Para obtener información sobre la configuración de la base de datos y el esquema de MS SQL Server en casos externos, consulte Instalación de ThingWorx.
version: '2.2'
# Note, this example includes a _blank_ mssql docker image for demonstration
# purposes. The mssql service should be removed and DATABASE_HOST should point
# to the production database either with a DNS name, or IP.
services:
mssql:
image: microsoft/mssql-server-linux:2017-latest
ports:
- "1433"
healthcheck:
test: /opt/mssql-tools/bin/sqlcmd -U SA -P "$${SA_PASSWORD}" -h -1
-Q "set nocount on; select serverproperty('ServerName')" | grep -w "$${HOSTNAME}"
interval: 15s
environment:
# NOTE: You must set SA_PASSWORD manually if using this image for testing.
- "SA_PASSWORD="
- "ACCEPT_EULA=y"

mssql-init:
image: thingworx/mssql-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:
mssql:
condition: service_healthy
environment:
- "DATABASE_HOST=mssql"
- "DATABASE_PORT=1433"
- "DATABASE_ADMIN_USERNAME="
- "DATABASE_ADMIN_PASSWORD="
- "TWX_DATABASE_USERNAME="
- "TWX_DATABASE_SCHEMA="
- "TWX_DATABASE_PASSWORD="
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:
platform:
image: thingworx/platform-mssql:latest
healthcheck:
test: curl -f localhost:8080/Thingworx/health
interval: 15s
depends_on:
mssql-init:
condition: service_healthy
ports:
- "8080:8080"
- "8443:8443"
environment:
- "INITIAL_HEAP=2"
- "MAX_HEAP=4"
- "DATABASE_HOST=mssql"
- "DATABASE_PORT=1433"
- "TWX_DATABASE_USERNAME=thingworx"
- "TWX_DATABASE_SCHEMA=thingworx"
# NOTE: TWX_DATABASE_PASSWORD for MSSQL platform must be set to match your
# environment.
- "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="
volumes:
- "./thingworx-mssql-storage/ThingworxPlatform:/ThingworxPlatform"
- "./thingworx-mssql-storage/ThingworxStorage:/ThingworxStorage"
- "./thingworx-mssql-storage/ThingworxBackupStorage:/ThingworxBackupStorage"
- "./thingworx-mssql-storage/tomcat-logs:/app/opt/apache-tomcat/logs"
¿Fue esto útil?