I was wondering if anyone has a way to run more than one instance of the ThingWorx platform/composer on a single operating system.
The way I understand it, a ThingWorx install always creates the ThingWorxStorage and ThingWorxBackupStorage folders in the same place, making it impossible to deploy more than one ThingWorx webapp on the same machine.
We need to create a multi-tenant environment where students frequently create, and destroy ThingWorx instances.
Currently, we use virtualization, but that means each ThingWorx instance has to include an operating system, Java, Tomcat, etc.... Most of our resources are just supporting extra operating systems, which could be shared among all of the instances.
Does anyone have a workaround that can accomplish this?
Adam, you can modify the location of the ThingWorx Storage folder. Here is a link to the Help Center document on how to do so. I personally have two instances running on my local system; ThingWorx 5.4 running on Tomcat 7 (port 80) and ThingWorx 6.5 running on Tomcat 8 (port 8080), although I run only one instance at a time.
I didn't know that, but it doesn't seem to solve my problem. I can move ThingWorxStorage, but I still can't have a different location for ThingWorxStorage for different instances. It is based on a system variable - doesn't that make it fixed for both instances?
Do you have to change that environment variable before you flip from one instance to the other? If so, I still can't run more than one instance at a time on the same box.
Yes, I believe that would be your limitation. You would need to change storage location each time you connect a different instance (so that they have their own unique storage).
Adam, there is an OS Env variable THINGWORX_PLATFORM_SETTINGS that drives where Tomcat will pick up the platform-settings.json and modelproviderconfig.json. These files then drive the location of the Storage and BackupStorage folders and the database connection (if you use Postgres).
For multiple independent TWX instances on the same host you'll need multiple tomcat instances running on different ports. You can drive this setting from TOMCAT_HOME/conf/server.xml . Furthermore tomcat has a nice mechanism to start up with custom OS Env params: you can simply add a sentenv.bat (or setenv.sh) to TOMCAT_HOME/bin with a content like:
and this Thingworx Tomcat instance will start up with its own platform settings.
I use this mechanism myself to run multiple versions of ThingWorx with different databases on my laptop.
This might work! Will experment.
Will need a separate Tomcat for each instance (not optimal, but acceptable), and a setenv.bat so each points to different platform settings, and thus different Thingworxstorage.
Setting up multiple Thingworx platform instances is risky (due to java and other shared resources on the OS) it is also not a supported installation structure. As Aanjan had mentioned the way he was able to make this work was only having one instance running at a time, even then it required modification each time one was started.
I would recommend instead to use something like VirtualBox or VMWare to isolate the operating systems, tomcat and jvm resources if multiple instances are needed on a single hardware server.