Jump to content
  • Spotfire® Server Docker Scripts


    Provides containerization information for Spotfire version 11.8 and below. If you are using Spotfire 12.0, use the Cloud Deployment Kit for Spotfire®.

    Introduction

    NOTE: If you are using Spotfire 12.0, you should be using the Cloud Deployment Kit for Spotfire® to containerize Spotfire.  The Cloud Deployment Kit provides recipes for containerization and Kubernetes of Spotfire® components.

    THESE SCRIPTS ARE DEPRECATED - Use the Cloud Deployment Kit for Spotfire® instead.

    The purpose of this page is to provide information for how one can use Spotfire Server and Spotfire Node Manager with Docker Containers.  The Docker and Spotfire Server software may change overtime.  The testing in this document was done with Spotfire 10.3 and Docker on Windows.  The Spotfire install scripts likely will not change much between versions so they should work with Spotfire 10.10.  

    In Spotfire 7.13, the silent installation commands for Spotfire Server and Node Manager changed. The original scripts were tested on 7.11 and should work in 7.12 and below. Scripts were added to the Spotfire Docker Script repository to support 7.13 and above. These additional scripts were tested on Spotfire 10.3.  In Spotfire Server 10.3, some of the directories where one finds the custom Spotfire scripts are different, thus the scripts for Spotfire 10.3 and Spotfire 10.2 also differ.  The Spotfire config.sh/config.bat command-line program is now in tomcat/spotfire-bin instead of tomcat/bin. 

    In Spotfire 10, the TIBCO Enterprise Runtime for R (TERR) Service was introduced.  Scripts for a Node Manager running TERR are now provided.

    This document assumes that one has access to the Spotfire Server Installation Manual and documentation (See Resources).  The Spotfire Server installation files are not included in the scripts as those should be obtained from the TIBCO EDelivery site.  This document focuses on information that is relevant to the Docker implementation and not to the installation of Spotfire Server except where Docker may change how one does the installation and configuration process.  

    This document focuses on scripts to support Spotfire Server and the Node Managers which handle the Spotfire Web Player and Spotfire Automation Services services.   This architecture diagram highlights the components for which Docker was tested.

    spotfire_7.5_topology_-_failover_and_load_balancing_1_0.thumb.png.0d9e5afacd1c289039478ed277c7ffdc.png

     

    Spotfire Server is supported on Linux and Windows.  In this investigation, Windows in Docker was used for all components.  The Node Manager services, Spotfire Web Player and Spotfire Automation Services, are only supported on Windows.  The Node Manager TERR and Python Services are supported on Linux and Windows.

    The testing was done on a Windows 10 laptop.  Some of the issues encountered may be eased when one is supporting Docker containers in an enterprise environment, especially with machine names and networking.   The scripts provided have solutions to all issues discovered.  Other issues may occur when one moves these scripts to a larger container ecosystem.

    This document provides Dockerfile examples for Spotfire Server and Node Manager.  The Dockerfile is used to create a Docker image which can then be used to create a Docker container.  The Dockerfile files and scripts are available on GitHub at Spotfire Server and Node Manager.  The next section provides a brief overview of the contents of the repository prior to the discussion of the Dockerfile files and scripts for the Spotfire Server and Node Manager services.

    Contents of Package

    The scripts are available on GitHub at Spotfire Server and Node Manager Docker Scripts.  The following folder structure and contents are provided:

    • Spotfire7.11/Spotfire10.3
      • NodeManagerASDocker
        • defaultAS.conf - default configuration for Automation Services instance
        • Dockerfile - Docker image build file
        • fixnmproperties.bat - batch file for startup of Node Manager Docker container that fixes the node manager machine name
        • fixnmproperties.ps1 - PowerShell script called by fixnmproperties.bat
      • NodeManagerWPDocker
        • defaultWP.conf - default configuration for Web Player instance
        • Dockerfile - Docker image build file
        • fixnmproperties.bat - batch file for startup of Node Manager Docker container that fixes the node manager machine name
        • fixnmproperties.ps1 - PowerShell script called by fixnmproperties.bat
      • SpotfireServerDocker
        • Dockerfile - Docker image build file
        • fixservername.bat - batch file for startup of Spotfire Server Docker container that fixes the Spotfire Server bootstrap.xml file.
      • SpotfireServerLinuxDocker
        • Dockerfile - Docker image build file
        • fixservername.sh - batch file for startup of Spotfire Server Docker container that fixes the Spotfire Server bootstrap.xml file.
    • Spotfire7.11 Only
      • SpotfireStatisticsServices
        • Dockerfile - Docker image build file
        • TSSSInstallFile.txt - Silent installation property file for Spotfire Statistics Services.
      • SpotfireStatisticsServicesLinux
        • Dockerfile - Docker image build file
        • TSSSInstallFile.txt - Silent installation property file for Spotfire Statistics Services.
    • Spotifre10 Only
      • NodeManagerTERRDocker
        • defaultTS.conf - default configuration for TERR Service Services instance
        • Dockerfile - Docker image build file
        • fixnmproperties.bat - batch file for startup of Node Manager Docker container that fixes the node manager machine name
        • fixnmproperties.ps1 - PowerShell script called by fixnmproperties.bat
      • NodeManagerTERRLinuxDocker
        • defaultTS.conf - default configuration for TERR Service Services instance
        • Dockerfile - Docker image build file
        • fixnmproperties.sh - batch file for startup of Node Manager Docker container that fixes the node manager machine name
    • SpotfireServerConfig - extra configuration files to help with Spotfire server configuration
      • tss_createbootstrap.txt - Spotfire config script for creating bootstrap file
      • tss_simpleconfig.txt - Spotfire config script for simple initial server configuration
      • tss_simpleconfigldap.txt - Spotfire config script for simple LDAP initial server configuration

    NOTE: The scripts do not contain the installation programs, e..g. setup.exe and nm-setup.exe, as these are obtained from the Spotfire Server installation files that must downloaded from the TIBCO EDelivery site.

    Resources

    Following are some resources that users will find helpful while working with this document:

    1. Spotfire Server and Node Manager Docker Scripts - the scripts are available on GitHub at this link.
    2. Spotfire Server Documentation - this provides a link to the latest Spotfire Server documentation.  The "Installation and Administration Help" will help one during the installation and configuration of Spotfire Server.
    3. Spotfire Scripted and Silent Installation - this article on Spotfire Community provides information for scripting a silent installation and configuration of Spotfire Server and the Node Manager services.  The scripts in this article were used to help create the silent installations and configurations needed for the Dockerfile files used to create the images.

    Versioning

    1. September 2018 - Initial version with Windows Docker Scripts for Spotfire 7.11
    2. December 2018 - Added scripts to GitHub and Community Article
    3. February 2019 - Added scripts for Spotfire 10 for silent installation change in 7.13 and TSSS 7.11 scripts
    4. March 2019 - Added Spotfire Server Linux 7.11 scripts
    5. May 2019
      • Added build-arg to support turning on/off configuration steps (doconfig)
      • Updated images to pull for Microsoft Windows Server Core
      • Updated 7.11 scripts to 7.11.3
      • Updated Spotfire10 scripts to 10.3 to handle changes in directory structure and additional TERR Node Manager
      • Added additional Linux scripts for TSSS and Node Manager for the TERR service
    6. Feburary 2021
      • Container images are now just the installation of the software.
      • All configuration is now done conditionally in the container startup scripts. Please review to see environment variables that need to be set, especially the Spotfire Server scripts.

    Spotfire Server With Docker

    Spotfire Server is a Tomcat based web application that handles all the client communication within the Spotfire environment.  The Spotfire Server requires a PostgreSQL (10.9 and above) or SQL Server or Oracle database for handling metadata. 

    The entire Spotfire installation can be done silently using the Spotfire Server command-line tools.  Many of the Spotfire configuration steps only need to be done once.  The Spotfire Server configuration information is stored in the Spotfire database, such that, once the environment is configured, the configuration does not need to be done again.  After the initial configuration, changes only need to be done when needed.  Since the configuration is in the Spotfire database, it can be done independently of a Spotfire Server. 

    The following steps can be done prior to creating the Spotfire Server Docker image:

    1. Download the required software
    2. Create Spotfire Database in PostgreSQL or SQL Server or Oracle database using the database scripts
    3. Create and manipulate configuration either during container startup or before container creation (use remote configuration tool as noted below for before Docker creation)
      1. Set initial configuration simple or LDAP
      2. Set auto trust configuration setting
      3. Set any other configuration settings that are needed
    4. Update initial deployment - Spotfire.Dxp.sdn
    5. Create initial user or use LDAP user and promote to admin

    The creation of the Spotfire database should be done first.   The Spotfire Server installation package contains scripts for creating the database, and the relevant section in the Spotfire Server installation manual Preparation section provides the instructions on how to use the scripts.  

    The configuration tool in Step 3 is either a Java command-line tool or the Spotfire Server Configuration User Interface tool to use when configuring the Spotfire environment.   The Spotfire configuration tools mentioned in Step 2 above are available in a jar file called spotfireconfigtool.jar that can be found in the <spotfire_server_install_directory>/tomcat/webapps/spotfire/tools or downloaded from the Spotfire Server Web Administration Server Tools link:

    spotfireservertools_screen.png.8b831ad21738751f50b8b79655ce5415.png

     

    This becomes a "chicken-and-egg" problem.  One needs the spotfireconfigtool.jar file in order to configure the server, but the jar file is only available after installation of the server.  The Dockerfile for Spotfire Server only installs the software and does initial configuration.  The container startup script, fixservername.bat/sh, has the configuration steps controlled by a environment variables.   The initial configuration steps only need to be done one time and are performed conditionally.  The script looks to see if the configuration file can be exported successfully from the database.   

    This package comes with some example configuration files in the SpotfireServerConfig directory:

    • tss_simpleconfig.txt - configure Spotfire database for authentication and user directory
    • tss_simpleconfigldap.txt - configure Spotfire to use LDAP for authentication and user directory

    These simple configurations are based on files that come with the Spotfire Server installation in the tomcat/bin directory (See Scripting a configuration).  If one wants to use the files, they are provided as starting points for configuration of Spotfire Server and will need to be updated for the particular environment.  As mentioned above, one can configure Spotfire Server outside of the Docker process.

    Spotfire Server Dockerfile

    This section discusses the Spotfire Server Server Dockerfile, pointing out the relevant lines.  The Dockerfile assumes that the Spotfire Server database has already been created.  The example Dockerfile for Spotfire Server has the following basic steps (assuming configuration has been done previously):

    1. Commented lines show example build and run commands and show enviroment variables that are needed for run script
    2. Initialization required by all Dockerfile files
    3. Copy setup and container batch script
    4. Run silent installation of Spotfire Server
    5. Install the Spotfire Server service and set to "Manual" mode
    6. Set startup command for the Docker container

    Here is the example Dockerfile for Spotfire Server 10.3.9 on Windows (the Linux scripts are similar with the main differences operating system script syntax):

    # Dockerfile for SpotfireServer - 7.13 and above - currently done for Spotfire 10
    ##
    ## use with:
    ##
    ## docker build -m 3GB -t tsswin103_env . 
    ##
    ### to create a container from the tss image use as an example
    ## docker run -it -d -p 82:80 --env DB_DRIVER="com.microsoft.sqlserver.jdbc.SQLServerDriver" --env DB_URL="jdbc:sqlserver://machine:1433;DatabaseName=spotfire1039_docker" --env DB_USER="spotfire1039" --env DB_PASSWORD="spotfire1039" --env CONFIG_TOOL_PASSWORD="spotfire" --env ADMIN_USER="spotfire" --env ADMIN_PASSWORD="spotfire" --env SET_AUTO_TRUST=false -m 6GB --cpus=2 --name tss103_env tsswin103_env
    ##
    ##
    ## DOCKER RUN with Environment Variables
    ##
    ## **** ENVIRONMENT VARIABLES
    ## *REQUIRED 
    ##    	DB_DRIVER="com.microsoft.sqlserver.jdbc.SQLServerDriver" 
    ##    	DB_URL="jdbc:sqlserver://machine:1433;DatabaseName=databasename" 
    ##    	DB_USER="db_user" 
    ##    	DB_PASSWORD="db_password"
    ##    	CONFIG_TOOL_PASSWORD="config-password"
    ##    	ADMIN_USER="spotfire-admin-user"
    ##    	ADMIN_PASSWORD="spotfire-admin-password"
    ## 
    ## *OPTIONAL
    ##    	TSSNAME - will use COMPUTERNAME if does not exist
    ##      DEPLOY_TERR - true or false
    ##      SET_AUTO_TRUST - false or default of true
    ##
    
    #### TODO: BEFORE RUNNING THIS SCRIPT MAKE SURE TO UPDATE Any of the installation paths and ports
    
    # Indicates that the windowsservercore image will be used as the base image.
    # Change this line if you want a different Windows base image
    FROM mcr.microsoft.com/windows/servercore:ltsc2019
    
    # Metadata indicating an image maintainer.
    MAINTAINER pmckinni@tibco.com
    
    # Copy over files that are needed all at once in case some files are missing
    # Spotfire.Dxp.sdn and tss_simpleconfig.txt are ONLY needed for initial configuration and setup items
    ##COPY setup-win64.exe fixservername.bat Spotfire.Dxp.sd[n] tss_simpleconfig.tx[t] Spotfire.Dxp.TerrServiceWindows.sd[n]   c:/
    COPY setup-win64.exe fixservername.bat Spotfire.Dxp.sd[n] Spotfire.Dxp.TerrServiceWindows.sd[n]   c:/
    
    # install Spotfire Server - NOTE: as of January 31, 2019 the installer ignores all parameters
    RUN setup-win64.exe DOWNLOAD_THIRD_PARTY=No INSTALLDIR=C:\tibco\tss\10.3.9 SPOTFIRE_WINDOWS_SERVICE=DoNotCreate SERVER_FRONTEND_PORT=80 SERVER_BACKEND_REGISTRATION_PORT=9080 SERVER_BACKEND_COMMUNICATION_PORT=9443 NODEMANAGER_HOST_NAMES= -silent -log C:\TSS_Install.log
    
    ## manually install service
    WORKDIR /tibco/tss/10.3.9/tomcat/bin
    RUN service.bat install
    
    #### TODO: UPDATE SERVICE NAME IN THIS COMMAND BASED ON VERSION INSTALLING, e.g. 7.11.3 would be Tss7113.
    # Set Service to manual
    RUN sc config "Tss1039" start=demand
    
    EXPOSE 80
    EXPOSE 9443
    EXPOSE 9080
    EXPOSE 5701
    ## may need to expose 5702 and 5703 for clustering
    
    WORKDIR /
    
    # Sets a command or process that will run each time a container is run from the new image.
    #CMD cmd
    ## Need to create bootstrap when docker container is created
    CMD ["cmd", "/k", "/fixservername.bat"]
    
     

    One may need to expose additional ports, e.g. 5702 and 5703, for clustering.  

    The previous Docker scripts would do all the Spotfire Server database configuration as well.  The new Docker script simplifies the process and only installs and performs basic configuration to get the software started.  The complete configuration of Spotfire Server is moved into the fixservername.bat/sh file.

    Spotfire Server Container Script

    On startup, the below script is run so that the Spotfire Server container can conditionally perform its configuration which sets up the Spotfire database and then registers its name with the Spotfire database properly configuring the Spotfire Server bootstrap.xml file.   The Spotfire Server configuration is performed only if there is no existing configuration in the database.  The Spotfire Server bootstrap.xml file is only created if it doesn't exist already.

    One needs to pass in environment variables as defined in the script to the container creation scripts.  For Docker, these variables can be set in the Docker run command.

    REM TODO: Change the database settings and connection URL as needed
    REM Make sure to Update the path and the service name if installing a new version
    
    REM Requires the following environment variables to do setup configuration if needed
    REM Script will determine if configuration is needed or not
    REM **** ENVIRONMENT VARIABLES
    REM *REQUIRED 
    REM    	DB_DRIVER="com.microsoft.sqlserver.jdbc.SQLServerDriver" 
    REM    	DB_URL="jdbc:sqlserver://machine:1433;DatabaseName=databasename" 
    REM    	DB_USER="db_user" 
    REM    	DB_PASSWORD="db_password"
    REM    	CONFIG_TOOL_PASSWORD="config-password"
    REM    	ADMIN_USER="admin-user"
    REM    	ADMIN_PASSWORD="admin-password"
    REM 
    REM *OPTIONAL
    REM    	TSSNAME - will use COMPUTERNAME if does not exist
    REM     DEPLOY_TERR - true or false
    REM     SET_AUTO_TRUST - false or default of true
    
    setlocal EnableDelayedExpansion
    
    set TSSDIR=C:\tibco\tss\10.3.9\tomcat
    set TSSCONFIGFILE=C:\TestConfig.xml
    
    if not exist %TSSDIR%\webapps\spotfire\WEB-INF\bootstrap.xml (
    
    	REM cd %TSSDIR%\spotfire-bin
    
    	if not defined TSSNAME ( set TSSNAME=!COMPUTERNAME!	)
    	
    	echo TSSNAME=!TSSNAME!
    
    	echo Creating the bootstrap file
    	
    	%TSSDIR%\spotfire-bin\config bootstrap --no-prompt --driver-class=!DB_DRIVER! --database-url=!DB_URL! --username=!DB_USER! --password=!DB_PASSWORD! --tool-password=!CONFIG_TOOL_PASSWORD! --server-alias=!TSSNAME! -A!TSSNAME!
    
    	echo Checking configuration
    
    	REM Check to see if a configuration already exists or not
    	%TSSDIR%\spotfire-bin\config export-config --tool-password="%CONFIG_TOOL_PASSWORD%" %TSSCONFIGFILE%
    	
    	if not exist %TSSCONFIGFILE% (
    	    REM Need to create configuration
    
    		REM ############# START CONFIGURATION SECTION
    
    		REM ## TODO: MAKE SURE TO UPDATE ANY PATHS TO MATCH THE INSTALLDIR INSTALLATION PATH
    
    		REM ######## NOTE These steps only need to be done one time	when doing initial configuration
    		REM # update configuration - this step ONLY needs to be done once and not repeatedly, except for bootstrap creation
    		REM # DO SIMPLE Configuration 
    		echo Creating the default configuration
    		%TSSDIR%\spotfire-bin\config create-default-config --force %TSSCONFIGFILE%
    		
    		echo Importing the configuration
    		%TSSDIR%\spotfire-bin\config import-config --tool-password="%CONFIG_TOOL_PASSWORD%" --comment="Initial Configuration" %TSSCONFIGFILE%
    
    		REM # update deployment
    		%TSSDIR%\spotfire-bin\config update-deployment --bootstrap-config %TSSDIR%\webapps\spotfire\WEB-INF\bootstrap.xml --tool-password="%CONFIG_TOOL_PASSWORD%" --area Production c:\Spotfire.Dxp.sdn
    
    		REM # deploy TERR as a service deployment
    		if "%DEPLOY_TERR%"=="true" ( 
    			%TSSDIR%\spotfire-bin\config update-deployment --bootstrap-config %TSSDIR%\webapps\spotfire\WEB-INF\bootstrap.xml --tool-password="%CONFIG_TOOL_PASSWORD%" --area Production c:\Spotfire.Dxp.TerrServiceWindows.sdn 
    		)
    
    		REM # set auto trust - SET_AUTO_TRUST default is true 
    		if not "%SET_AUTO_TRUST%"=="false" (
    			%TSSDIR%\spotfire-bin\config set-config-prop --configuration=%TSSCONFIGFILE% --name=security.trust.auto-trust.enabled --value=true
    			echo Importing the configuration with auto trust enabled
    			%TSSDIR%\spotfire-bin\config import-config --tool-password="%CONFIG_TOOL_PASSWORD%" --comment="Enabling Auto Trust" %TSSCONFIGFILE%
    		)
    		
    		echo Creating the '${ADMIN_USER}' user to become administrator
    		%TSSDIR%\spotfire-bin\config create-user --tool-password="%CONFIG_TOOL_PASSWORD%" --username="%ADMIN_USER%" --password="%ADMIN_PASSWORD%"
    		echo
    
    		echo Promoting the user '${ADMIN_USER}' to administrator
    		%TSSDIR%\spotfire-bin\config promote-admin --tool-password="%CONFIG_TOOL_PASSWORD%" --username="%ADMIN_USER%"
    		echo	
    
    		REM ############# END CONFIGURATION SECTION	
    	) 
    
    	REM Remove configuration file - either created now or created when testing configuration
    	del %TSSCONFIGFILE%
    	
    	sc config "Tss1039" start=auto
    	net start "Tss1039"
    )
     

    Paths and service names in this file will need to be updated based on the version of Spotfire Server installed.

    In the Docker run command, one will pass in the various environment variables to define the configuration to the Spotfire database and the various usernames and passwords.  This configuration is a simple configuration.  If one needs to configure LDAP or other complex scenarios, then those can be scripted in here or done remotely as discussed previously.  The following environment variables are used:

    • REQUIRED:
      • DB_DRIVER - JDBC database driver class name
      • DB_URL - JDBC database connection URL
      • DB_USER/DB_PASSWORD - Spotfire Server database user and password which was created using the database creation scripts
      • CONFIG_TOOL_PASSWORD - password that is used to unlock and access the configuration commands and tools
      • ADMIN_USER/ADMIN_PASSWORD - initial user within Spotfire that will be promoted to an admin user that can be an admin within Spotfire
    • OPTIONAL:
      • TSSNAME - name used to register the container with the Spotfire database; default is COMPUTERNAME on WIndows and `hostname -I` on Linux
      • DEPLOY_TERR - true or false; default is false and if true, TERR deployment file (Spotfire.Dxp.TerrService<OS>.sdn) needs to have been copied to the container during the image build
      • SET_AUTO_TRUST - true or false; default is true.  Details next.

    In this Dockerfile, new nodes are set for auto-trust based on the SET_AUTO_TRUST environment variable which means that Node Managers will automatically be trusted when they come on-line and communicate with the Spotfire Server.  This will allow one to bring up nodes without having to trust them.   Auto-trust does not have to be set, but setting it to true will make it easier for nodes to come on-line without manual intervention.

    Spotfire Server registers itself with the Spotfire database during the creation of the bootstrap file which is done once for all containers as they initialize.

    Note that in Spotfire 10.3 the config scripts are now in the tomcat\spotfire-bin directory.  The Linux script is similar execpt for shell script differences.  One main difference in Linux is that since there is no Windows service, the Spotfire Server needs to be started with this script.  A common Docker pattern is for the initialization script to start the service that is running in that Docker container.

    Node Manager with Docker (Web Player and Automation Services and TERR Service starting in Spotfire 10)

    The Spotfire Node Manager is a service which manages various services that one can instantiate.  The Web Player and Automation Services require Windows.  In Spotfire 10, the TIBCO Enterprise Runtime for R (TERR) Service was introduced, and in Spotfire 10.10 the Python Service was introduced.  The TERR and Python Services can run on Windows or Linux. The Node Manager service can be installed silently and configured with a predefined service - Web Player or Automation Services or TERR or Python.

    The Node Manager registers and communicates with one Spotfire Server initially to register such that the Spotfire Server backend registration and communication ports need to be accessible by the Node Manager machine.  The Node Manager machine needs to know the Spotfire Server machine name in order to communicate with it.  Secure communication is done using a certificate created by Spotfire Server.  When starting up the Docker Node Manager, a Spotfire Server name is given.  In the example, I used the Docker container names.  In a production environment, these names may be controlled by DNS.  For Linux, I had to use IP addresses as the Docker container names were not accessible on the network.  I could have modify the /etc/hosts file to help with this.

    The Spotfire Server configuration above sets auto-trust for Node Managers to true which means that one does not need to trust the node managers as they communicate with the Spotfire Servers.  The Node Managers are automatically trusted. 

    In order to automatically create the instance of a service within the Node Manager, one needs to use a default configuration file as discussed in the Spotfire Server Installation Manual section Automatically installing services and instances.  This example provides defaultWP.conf, defaultAS.conf and defaultTS.conf files.

    Node Manager Dockerfile

    This section discusses the Node Manager Dockerfile, pointing out the relevant sections.    The example Dockerfile for Node Manager has the following basic steps (assuming configuration has been done previously):

    1. Commented lines show example build and run commands and show enviroment variables that are needed for run script
    2. Initialization required by all Dockerfiles
    3. Copy setup, default configuration and container batch scripts
    4. Run silent installation of Node Manager
    5. Copy default configuration to appropriate location
    6. Set the Node Manager service to "Manual"mode
    7. Set startup command for the Docker container

    Before running the Node Manager image and creating the container, the machine name of a Spotfire Server in the cluster needs to be known so it can be passed to the Node Manager Docker build process. While the above example is for a Node Manager with a Web Player service, the example for Automation Services just uses a different default configuration file.  Here is the Dockerfile for the Node Manager 10.3.9 (Web Player instance in this example):

    # Dockerfile for NodeManager - Web Player
    ## 
    ###  USING ENVIRONMENT VARIABLES
    ## To Run Container need to pass TSSNAME and optionally NODENAME for Node Manager
    ##  These names are used for communication between Spotfire Server and the Node Manager
    ##
    #### Docker Build example:
    ##
    ## docker build -m 3GB -t tsnm_wp103 .
    ##
    ####### Docker run examples:
    ##
    ## pass server name as environment variable examples of docker run
    ##
    ## docker run -it -d --env TSSNAME=963f926d1ce0 --env NODENAME=<NODENAME> -m 4GB --cpus=2 --name tsnmwp4gb103 tsnm_wp103
    ## 
    ## docker run -it -d --env TSSNAME=4884594badbb -m 4GB --cpus=2 --name tsnmwp4gb103 tsnm_wp103
    ##
    ## **** ENVIRONMENT VARIABLES
    ## *REQUIRED 
    ##    	TSSNAME - must pass in TSSNAME for node to communicate with Spotfire Server.  Can be an server in the cluster.
    ## 
    ## *OPTIONAL
    ##    	NODENAME - will use COMPUTERNAME if does not exist
    ##
    
    #### NOTE REGARDING WINDOWS IMAGES
    ## Currently as of July 2020 the Windows Server Core image (https://hub.docker.com/_/microsoft-windows-servercore)
    ##  is missing a rendering device for Spotfire, specifically DLLs related to the Windows Advanced Rasterization Platform (WARP) device.
    ## One can use the Windows image (https://hub.docker.com/_/microsoft-windows) which is larger.  
    ##
    
    # Indicates that the windowsservercore image will be used as the base image.
    # Change this line if you want a different Windows base image
    ## Specific image version must match version of host operating system
    ##
    FROM mcr.microsoft.com/windows:1903
    
    # Metadata indicating an image maintainer.
    MAINTAINER pmckinni@tibco.com
    
    # Copy over files that are needed
    COPY nm-setup.exe c:/nm-setup.exe
    COPY defaultWP.conf C:/default.conf
    COPY fixnmproperties.ps1 C:/fixnmproperties.ps1
    COPY fixnmproperties.bat C:/fixnmproperties.bat
    
    # install Node Manager
    RUN nm-setup.exe INSTALLDIR="C:\tibco\tsnm\10.3.9" NODEMANAGER_REGISTRATION_PORT=9080 NODEMANAGER_COMMUNICATION_PORT=9443 SERVER_NAME=PLACEHOLDER SERVER_BACKEND_REGISTRATION_PORT=9080 SERVER_BACKEND_COMMUNICATION_PORT=9443 -silent -log C:\TSS_NM_install.log
    
    RUN copy \default.conf c:\tibco\tsnm\10.3.9\nm\config
    
    EXPOSE 9501
    EXPOSE 9443
    EXPOSE 9080
    
    ## Need to set service to manual start so that the final configuration can be done before starting
    RUN sc config "WpNmRemote1039" start=demand
    
    # Sets a command or process that will run each time a container is run from the new image.
    ##CMD cmd
    ## Need to modify nodemanager.properties file when docker container is created to have correct nodemanager host name
    CMD ["cmd", "/k", "/fixnmproperties.bat"]
     

    During image creation, one needs to know the Spotfire Server listening ports.  The ports are currently hardcoded in the Dockerfile and the Spotfire Server name is set to a default name of "PLACEHOLDER" and will be replaced by the startup script.  The Spotfire Server machine name is passed in as an environment variable to the container run command.  During the Node Manager installation, the Node Manager machine name is set in the nm/config/nodemanager.properties file.  Because the machine name at image creation time will be different for the Docker container, the fixnmproperties.bat and fixnmproperties.ps1 scripts are run when the container starts up the first time to fix the Node Manager host name and Spotfire Server names.

    Node Manager Container Scripts

    On startup, the below script is run so that the Node Manager machine name can be properly set in the nodemanager.properties file. 

    fixnmproperties.bat:

    REM Make sure to modify the installation directory when installing another version
    REM Update Path to config if needed
    
    PUSHD .
    
    cd \tibco\tsnm\10.3.9\nm\config
    
    REM ONLY perform the action if the nodemanager has not already started
    
    PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& '\fixnmproperties.ps1'"
    
    POPD
     

    fixnmproperties.ps1:

    ## TODO: Change service name if needed
    ## Expects environment variables when building container, for example: --env TSSNAME=<SpotfireServerName>
    #
    #  TSSNAME is required
    #  NODENAME is optional and if does not exist the built-in computername environment variable will be used
    #
    
    ## Check to see if supervisor already changed file or not
    $modBySupervisor = Get-Content ".\nodemanager.properties" | %{$_ -match "Supervisor changed"}
    
    if (!($modBySupervisor -contains $true))
    {
    	if (-not (Test-Path env:NODENAME))
    	{
    		(Get-Content .\nodemanager.properties)  -replace "nodemanager.host.names=.*$", "nodemanager.host.names=$env:computername" | Set-Content .\nodemanager.properties -force -encoding ascii
    	}
    	else ## use NodeManager environment variable name
    	{
    		(Get-Content .\nodemanager.properties)  -replace "nodemanager.host.names=.*$", "nodemanager.host.names=$env:NODENAME" | Set-Content .\nodemanager.properties -force -encoding ascii
    	}
    	(Get-Content .\nodemanager.properties)  -replace "server.name=.*$", "server.name=$env:TSSNAME" | Set-Content .\nodemanager.properties -force -encoding ascii
    	
    	sc.exe config "WpNmRemote1039" start=auto
    	net.exe start "WpNmRemote1039"
    }
     

    The fixnmproperties.bat file basically just calls the fixnmproperties.ps1 Windows PowerShell script.  If a different version of Spotfire is installed, the Node Manager service name and path to the configuration will need to be modified in these files.  One needs to pass in the Spotfire Server name as an environment variable.

    Node Manager: TERR Service

    Starting in Spotfire 10, an additional Node Manager service was added: the TERR Service.  The TERR Service is supported on Windows and Linux.  Dockerfiles and scipts are provided for Windows and Linux installations. The TERR Service on Linux wants to use containers for the TERR engines.  This does not work within the Docker container - there is no support for "docker in docker." 

    The configuration, use.engine.containers, should be set to false to turn off the TERR container option so that the TERR Service can run in a Linux Docker container: Containerized configuration.  The TERR Service on Windows does not use containers such that one does not have to change this configuration when running the TERR Service within a Windows container.

    Using the Dockerfile Files

    This section touches on the how to use the Dockerfile files including items that one might have to modify in the various files that are part of this Spotfire Docker implementation.  Before using the Docker scripts, one needs to download the installation files for Spotfire Server.  These scripts also assume that the Spotfire database is created and configured already.  The scripts do not come with any of the executable files nor the Spotfire deployment files.  One must download those from the TIBCO EDelivery site. 

    As noted below, one will need to edit the files especially if one is installing a different version from 10.3.9.  On Windows, the Spotfire Server and Node Manager service name will change between versions, e.g. the Spotfire Server service for 10.3.9 is Tss1039 and for 10.10.3 is Tss10103, the Node Manager service for 10.10.3 is WpNmRemote10103.  Just make sure if you run into any errors with services that the service names match the version you are installing.

    Creating the Spotfire Server Dockerfile Image

    The Spotfire Server Dockerfile needs to be modified manually for paths and version name changes.  In order to create the Spotfire Server Docker image the following items need to be done (assuming Dockerfile package has been unzipped into a directory called SpotfireServerDocker):

    1. Create the Spotfire database (See Preparation)
    2. Do initial configuration of Spotfire Server (See Initial configuration)
    3. Edit the Spotfire Server Dockerfile.  The following edits may need to be made to the Spotfire Server Docker file:
      1. Modify any paths that are incorrect, e.g. the example tested with Spotfire 10.3.9 so all the Spotfire Server paths are 10.3.9
      2. Modify service name from Tss1039 if another version of Spotfire Server is installed.
      3. Modify Port numbers for Spotfire Server installation, if needed:
        1. Default client port is 80
        2. Default backend registration port is 9080
        3. Default backend communication port is 9443
    4. Edit the fixservername.bat/sh file:
      1. Edit 10.3.9 paths if a different version installed
      2. Edit service name - "Tss10.3.9" - if different version installed.
    5. Copy setup-win64.exe or tss-<version>.x86_64.rpm from the Spotfire Server installation package into the SpotfireServerDocker directory.
    6. Create the Docker image passing in appropriate arguments:
      1. docker build -m 3GB -t tss .

    The Spotfire Server configuration and setup requires at least 3 GB in order to run properly.  A production instance of Spotfire Server needs at least 8GB and more like 16-24GB, depending on usage.

    After the Docker image has been created, one can create a Docker container using the following command with the appropriate environment variables set:

     docker run -it -d -p 82:80 --env DB_DRIVER="com.microsoft.sqlserver.jdbc.SQLServerDriver" --env DB_URL="jdbc:sqlserver://machine:1433;DatabaseName=spotfire1039_docker" --env DB_USER="spotfire1039" --env DB_PASSWORD="spotfire1039" --env CONFIG_TOOL_PASSWORD="spotfire" --env ADMIN_USER="spotfire" --env ADMIN_PASSWORD="spotfire" --env SET_AUTO_TRUST=false -m 6GB --cpus=2 --name tss103_env tsswin103_env
     

    Note: More example docker build and run commands are provided with the Spotfire Docker scripts on GitHub.

    Creating the Node Manager Dockerfile Image

    The Node Manager Dockerfile needs to be modified manually for paths and version names changes.  In order to create the Node Manager Docker image, the following items need to be done (assuming Dockerfile package has been unzipped into a directory called NodeManagerWPDocker or NodeManagerASDocker):

    1. Edit the Node Manager Dockerfile.  The following edits may need to be made to the Node Manager Docker file:
      1. Modify any paths that are incorrect, e.g. the example tested with Spotfire 10.3.9 so all the Node Manager paths are 10.3.9
      2. Modify service name from "WpNmRemote1039" if another version of Node Manager is installed.
      3. Modify Port numbers for Node Manager installation
        1. Default Node Manager registration port is 9080
        2. Default Node Manager communication port is 9443
        3. Default Spotfire Server backend registration port is 9080
        4. Default Spotfire Server backend communication port is 9443
    2. Edit the fixnmproperties.bat/sh file:
      1. Edit 10.3.9 paths if a different version installed
    3. Edit the fixnmproperties.ps1 file (Windows only):
      1. Edit service name - "WpNmRemote1039" - if different version installed.
    4. Copy nm-setup.exe or tss-nm-<version>.x86_64.rpm from the Spotfire Server installation package into the Node Manager Docker directory.
    5. Edit the defaultWP.conf/defaultAS.conf/defaultTS.conf as needed:
      1. Most common edit would be "customPrefix" and "configuration"
    6. Create the Docker image passing in appropriate arguments (pass in Spotfire Server name):
      1. WP: docker build -m 3GB -t tsnm_wp .
      2. AS: docker build -m 3GB -t tsnm_as .
      3. TERR: docker build -m 3GB -t tsnm_ts .

    The Node Manager setup requires at least 3 GB in order to run properly.  A production instance of Node Manager needs at least 16GB and more like 32GB or more, depending on usage.

    After the Docker image has been created, one can create a Docker container using the following command which includes the name for the Spotfire Server the node can connect to:

    • Web Player: docker run -it -d --env TSSNAME=<SpotfireServerName> --env NODENAME=<NODENAME> -m 4GB --cpus=2 --name tsnmwp4gb tsnm_wp
    • Automation Services: docker run -it -d --env TSSNAME=<SpotfireServerName> --env NODENAME=<NODENAME> -m 4GB --cpus=2 --name tsnmas4gb tsnm_as
    • TERR Service: docker run -it -d --env TSSNAME=<SpotfireServerName> --env NODENAME=<NODENAME> -m 3GB --cpus=2 --name tsnmas3gb tsnm_ts

    Note: More example docker build and run commands are provided with the Spotfire Docker scripts on GitHub.

    Future Items to Investigate

    This section mentions a few things that have yet to be investigated:

    1. Monitoring of the environment - Spotfire Server and Node Manager write out many log files which, of course, are on the Docker container drive.  There might be better ways to monitor these logs in a Docker enterprise environment.  One can review the logs via the Spotfire Server Web Administration Console and download them from there, but other ways of reviewing the logs might be considered.
    2. How to apply hotfixes? For Spotfire Server, any current hotfixes could be applied at Docker creation, but new hotfixes would have to be applied to each Spotfire Server.  Hotfixes for Node Managers and Services can be deployed to Spotfire Server and then have to be pushed out to any new Nodes that come on-line.
    3. As mentioned briefly above, networking in a greater Docker ecosystem may help with the naming of the machines.
    4. This is just an initial implementation, and one could explore how to scale up a Spotfire environment within a Docker ecosystem.

    User Feedback

    Recommended Comments

    There are no comments to display.


×
×
  • Create New...