Disclaimer: The scripts and content published here are provided solely as a courtesy to PTC customers. Each script is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the PTC be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the scripts, including any software vulnerabilities.
Ready to deploy ThingWorx containers on Kubernetes using Helm?
Let's get started using the steps below from Luis, one of our awesome software developers.
Before you dive too far in, please note that the following instructions assume you have downloaded the Docker scripts from our downloads portal and followed the instructions to build and publish the ThingWorx Docker images to your own Docker registry; they also assume that you have a working Kubernetes cluster with sufficient resources available.
These steps are intended to be used as a deployment manual and will not provide in-depth information about Kubernetes or the Helm package manager.
To start, you'll need the following prerequisites:
In this example, we'll use the ThingWorx platform with PostgreSQL as a persistence provider.
To prepare for the deployment, start by downloading the sample Helm chart
thingworx-0.1.0.tgz (this is zipped in the .7z file attached ). You can take a look at what is configurable in this Helm chart:
$ helm inspect thingworx-0.1.0.tgz
This will show you the default configuration (
values.yaml) and instructions (
README.md) provided within the package. In the next steps, you'll see how to override some of these values to make the deployment fit your environment.
Let's create your custom
values file. Use your favorite text editor and create a new file that looks like the following example. Please note the comments and make the necessary adjustments.
# Uncomment the following lines if you're using a private Docker registry that requires a username and password #imageCredentials: # password: mySecretAndSecurePassword # Your Docker Registry Password here # registry: docker.example.com # Your Docker Registry FQDN here # username: myUsername # Your Docker Registry Username here registry: domain: docker.example.com # Your Docker Registry FQDN here thingworx: image: repository: thingworx-platform-postgres # Your Thingworx Docker image name tag: 8.4.0 # Your Thingworx Docker image tag # Uncomment the following lines if you have the nginx-ingres addon installed on your cluster # ingress: # enabled: true # annotations: # kubernetes: # io/ingress: # class: nginx # hosts: # - twx.k8s.example.com # A FQDN that resolves to your cluster's ingress point
Note: The default
values.yaml file included in the chart contains default usernames and passwords that must be changed before using this chart for production purposes.
To change them also include a block like the following in your
postgresql: postgresPassword: YOUR_PG_ADMIN_PASSWORD commonConf: DATABASE_ADMIN_USERNAME: YOUR_PG_ADMIN_USER TWX_DATABASE_USERNAME: YOUR_TWX_DB_USER TWX_DATABASE_PASSWORD: YOUR_TWX_DB_PASSWORD RABBITMQ_USERNAME: YOUR_RABBITMQ_USER RABBITMQ_PASSWORD: YOUR_RABBITMQ_PASSWORD
Save this file as
If you have never used Helm with your cluster before, you should run the following command. This will install/upgrade the Helm server-side component (Tiller) on your Kubernetes cluster.
$ helm init --upgrade
Now, to deploy ThingWorx, run the following command. This will deploy ThingWorx into your current kube config namespace. If you want to deploy into a specific namespace use the
$ helm upgrade --install -f myValues.yaml thingworx-test thingworx-0.1.0.tgz
Wait a few seconds and you should have ThingWorx deployed onto your Kubernetes cluster.
You can use
kubectl to check if the ThingWorx and PostgreSQL pods are ready:
$ kubectl get pods
If you have an Ingress set up on your cluster, you can just open a browser and point it to the URL you created for it; if not, you can use
kubectl to reach it:
$ kubectl port-forward service/thingworx-test-twx 8080
Leave the terminal open and point your browser to http://localhost:8080/Thingworx.
Below, you can find an example using Minikube; you can get Minikube from https://github.com/kubernetes/minikube:
# Start minikube minikube start --memory 8192 --cpus 4 # Set docker env so you can use local images with minikube eval $(minikube docker-env) # Ensure that kubectl is configured for minikube minikube update-context # Pull the image from your Docker registry docker pull artifactory.rd2.thingworx.io/twxdevops/tw-platform-postgres:8.4.0-build-latest # check the Thingworx helm default values and README helm inspect thingworx-0.1.0.tgz # Create your custom values file cat << EOF > myValues.yaml # Add the content registry: domain: artifactory.rd2.thingworx.io thingworx: image: repository: twxdevops/tw-platform-postgres tag: 8.4.0-build-latest pullPolicy: IfNotPresent # this is to use the existing local image in minikube resources: requests: cpu: 1 memory: 1Gi # Make sure it can fit our Minikube VM EOF # Initialize helm and tiller helm init --upgrade # Deploy Thingworx helm upgrade --install -f myValues.yaml thingworx-test thingworx-0.1.0.tgz # Verify the deployment status helm ls # Verify that the Thingworx and PostgreSQL pods where created (check the status column) kubectl get pods # Wait until both pods are ready and use kubectl port-forward to reach the Thingworx Composer UI kubectl port-forward service/thingworx-test-twx 8080 # Open the Thingworx Composer UI in your default browser xdg-open http://localhost:8080/Thingworx # Use open instead of xdg-open if you're on macOS
great article, using this i have successfully deployed thingworx with postgres db in our Kubernetes based Openshift container platform.
Could you please help me on getting helm package for thingworx with MS-SQL DB? could you please share?