Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
ThingWorx DevOps
By Victoria Firewind, IoT EDC
This presentation accompanies a recent Expert Session, with video content including demos of the following topics: found here!
DevOps is a process for taking planned changes through development, through testing, and into production, where they can be accessed by end users. One test instance typically has automated tests (integration testing) which ensure application logic is preserved in spite of whatever changes the developers are making, and often there is another test instance to ensure the application is usable (UAT testing) and able to handle a production load (load testing).
So, a DevOps Pipeline starts with a task manager tasking out planned changes, where each task will become a branch in the repository. Each time a new branch is created, a new pipe is needed, which in this case, is produced by Docker Hub. Developers then make changes within that pipe, which then flow along the pipe into testing. In this diagram, testing is shown as the valve which when open (i.e. when tests all pass) then allows the changes to flow along the pipe into production. A good DevOps process has good flow along the various pipelines, with as much automated or scripted as possible to reduce the chances for errors in deployments. In order to create a seamless pipeline, whether or not it winds up automated, several third party tools are useful:
b
Container software is a very good way to improve the maintainability and updatability of a ThingWorx instance, while minimizing the amount of resources needed to host each component.
n
1. Create Docker Image
Consult the Help Center if need be. Update your YML file with everything you need before starting the image: see the example in the PTC community. License the instance using the license management website. Follow the instructions from Docker for installing those tools: Docker itself (docker) and Docker Compose (docker-compose).
n
2. Save Docker Image in Docker Repo
Docker Hub has some free options, and if a license is purchased, can host more than a single Docker image and tag. It is also possible to set up your own Docker registry.
n
3. Access the image in Docker Desktop
Download Docker Desktop and sign-in to the Docker account which hosts the repository. Create some folders for storing the h2.env file and the ThingworxStorage and ThingWorxPlatform mounted folders. Remember to license these containers as well. Developers login to the license management site themselves and put those into the ThingWorxPlatform mounted folder (“license_capability_response.bin”).
Git is a very versatile tool that can be used through many different mediums, like Azure DevOps or Github Desktop. To get started as a totally new Git user, try downloading Github Desktop on your local machine and create a local repository with the provided sample code.
This can then be cloned on a Linux machine, presumably whichever instance hosts the integration ThingWorx instance, using the provided scripts (once they are configured). Remember to install Git on the Linux machine, if necessary (sudo apt-get install git).
A sample ThingWorx application (which is not officially supported, and provided just as an example on how to do DevOps related tasks in ThingWorx) is attached to this post in a zip file, containing two directories, one for scripts and one for ThingWorx entities. Copy the Git scripts and config file into the top level, above the repository folder, and update the GitConfig.sh file with the URL for your Git repository and your login credentials. Then these scripts can be used to sync your Linux server with your Git repository, which any developer could easily update from their local machine. This also ensures changes are secure, and enables the potential use of other DevOps procedures like tasks, epics, and corresponding branches of code.
Steps to DevOps using the provided code as an example:
Now create some local changes, add things, etc. and try out the UpdateApplication script or export to source control and then push to the Git repo. Data and localization table exports are also possible.
In Conclusion:
DevOps is a complex topic and every PTC customer will have their own process based around their unique requirements and applications. In the future, more mature pipeline solutions will be covered, ones that involve also publishing to Solution Central for easier deployment between various testing instances and production.
Where can I find the recording of this expert class, please ?
greetings,
Didier
Looking for the recoding of this session can you please share.
The replay of the Expert Session is now available here: https://www.ptc.com/en/resources/iiot/webcast/devops-pipeline-thingworx. Thanks for your patience!
The replay of the Expert Session is now available here: https://www.ptc.com/en/resources/iiot/webcast/devops-pipeline-thingworx. Thanks for your patience!
Link - "Setting up a DevOps pipeline in ThingWorx": https://www.ptc.com/en/resources/iiot/webcast/devops-pipeline-thingworx/thank-you
Hi, I understand the links to view the replay of the Expert Session is no longer valid, is there other link that we can use?