Building and Configuring the ThingWorx CXServer Docker Image
Building the CXServer Docker Image
After completing the setup, you can use the build script to create the ThingWorx Connection Server Docker image. The included build.sh script takes the variables set in the build.env file and works with the files in the staging folder to make sure the Docker build command has the appropriate variables and build context available.
To build the image, run the following command:
./build.sh all
After the build process completes, the following Docker image is available:
thingwork/cxserver-twx:latest
Configuring the CXServer Docker Image
You can use the following environment variables for the container configuration. These can be used in the example/docker-compose.yml file included in the DockerFile download or the respective TWXdockerfile>/docker-compose-DB-clustered/.env file in the Thingworx DockerFile download.
Variable Names
Docker Compose Defaults
Comments
CXSERVER_APP_KEY
No default value set
The application key in ThingWorx that Connection Server will use to connect. Generate a random GUID as a value for the required CXSERVER_APP_KEY.
TWX_PLATFORM_SERVICE_NAME
No default value set
Enables service discovery for resolving ThingWorx Platform endpoints.
TWX_PLATFORM_TLS_ENABLED
false
Indicates whether to connect to ThingWorx Platform using secure WebSockets (wss) or unsecure WebSockets (ws).
TWX_PLATFORM_TRANSPORT
WEBSOCKETS_ACTIVE_ACTIVE
Transport for sending/receiving messages to/from ThingWorx Platform. Either websockets or websockets_active_active.
LOG_LEVEL
Info
Log level for the root logger.
CXSERVER_THING_NAME
No default value set
Thing name the Connection Server will be bound with. If not specified, the Connection Server will bind with a random UUID using the format "AlwaysOn-cxserver-{UUID}".
CXSERVER_SSL_ENABLED
false
Flag to enable SSL for the Connection Server.
SERVICE_DISCOVERY_ENDPOINT
No default value set
Address to Zookeeper for service discovery. For example: zookeeper:2821
Configuring the CXServer Docker Image for SSL
You can add the following optional variables to the environment section of the file to configure the Connection Server for SSL.
Variable Names
Image Defaults
Comments
CXSERVER_SSL_CLIENT_AUTH_MODE
None
Client authorization mode.
CXSERVER_SSL_KEYSTORE_LOCATION
/certs/connectionserver.p12
Path to the Connection Server KeyStore.
CXSERVER_SSL_KEYSTORE_PASSWORD
ptcptc
Password for Connection Server KeyStore.
CXSERVER_SSL_TRUSTSTORE_LOCATION
No default value set
Path for the Connection Server TrustStore. For example: /certs/connectionserver-truststore.p12
If no value is set, the default trust store is the cacerts file from the Java distribution.
CXSERVER_SSL_TRUSTSTORE_PASSWORD
No default value set
Password for Connection Server KeyStore.
APP_XOPTS
No default value set
Extra flags that can be passed for Zookeeper SASL authentication.
CXSERVER_HTTPS_ACTIVE
true
Enable HTTPS for connection server
CXSERVER_SASL_ENABLED
false
Flag to enable SASL for Connection Server.
CXSERVER_SASL_KRB5_CONF_FILE
/tmp/krb5.conf
Path to the krb5 config file.
CXSERVER_SASL_JAAS_FILE
/tmp/jaas.conf
Path to jaas config file.
CXSERVER_VERIFY_HOST
true
Flag to enable host name verification for TLS connections to ThingWorx.
Was this helpful?