安裝與組態 > 使用 ThingWorx Docker > 針對 ThingWorx Docker 使用外部 Microsoft SQL Server 資料庫
針對 ThingWorx Docker 使用外部 Microsoft SQL Server 資料庫
下列範例是使用外部資料庫的 Microsoft SQL Server 的 Docker Compose 檔案:
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"
platform:
image: thingworx/platform-mssql:latest
healthcheck:
test: curl -s -w '%{http_code}' -U 'bad:creds'
localhost:8080/Thingworx/Subsystems/PlatformSubsystem | grep -w 401
interval: 15s
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="
- "DATABASE_ADMIN_USERNAME=SA"
# NOTE: DATABASE_ADMIN_PASSWORD should match your environment or SA_PASSWORD
# if using the above image for testing.
- "DATABASE_ADMIN_PASSWORD="
volumes:
- "./thingworx-mssql-storage/ThingworxPlatform:/ThingworxPlatform"
- "./thingworx-mssql-storage/ThingworxStorage:/ThingworxStorage"
- "./thingworx-mssql-storage/ThingworxBackupStorage:/ThingworxBackupStorage"
- "./thingworx-mssql-storage/tomcat-logs:/opt/apache-tomcat/logs"
如需有關在外部案例中設定 MS SQL Server 資料庫與結構描述的資訊,請參閱 安裝 ThingWorx