Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X
Does anybody here run ThingWorx 7.2 (preferably on Ubuntu) in docker? If so, can you please share your docker file for bulding such a machine?
I beileve it would be huge help for whole Developer Community.
Thanks in advance.
Solved! Go to Solution.
You can ask Marco Bratz from doubleslash. As far as I know they frequently use Docker. You can find him on xing.com
The short answer I believe is yes .. .the long answer .... I'm seeing if someone in Dev wants to contribute to this, since I know we use Docker in Dev.
Thanks for reply let me know, if something comes up. (please see my addition below).
On second thought, for minimal image and overhead would be best to hook it up together from these two images based on alpine linux:
But still lacking experience though. =)
It is far from perfect and minimal, but it works, Posting it here, so anybody can learn from it and possibly improve it.
It should work, if you copy TW installation files into tw directory and run docker-compose up in root folder. After some initial setup, you should be able to see TW instance on your localhost/thingworx port 80.
File here: ThingWorx setup for docker.
Thanks Jan,
This is very interesting, would you be so kind as to share your learning and the process you followed as well as the prerequisites?
Thank you,
Duan
It was very chaotic, but generally you need to master docker commands and shell scripting. I have mostly read official docs and I highly recommend base image with pre installed apache or postgres. It it best to pick operating system you understand at least little bit (generally RedHat or Debian). For me it was debian.
So I have installed docker toolbox with kitematic and started playing around, eventually I was able to set up both systems manually. I used official images of apache and postgres both based on debian. Then I got to reading: Build your own images - Docker and got myself images with some level of automation. After that I started composing looking at Quickstart: Compose and WordPress - Docker. Finally I end up with this result...
There are definitely more articles and blog post I have read and dont remember, hope it helps!
The attachment is missing. Can someone who downloaded it re-post it?
Thanks for the working reference.
As I thought, you were working with a Postgres backed version of Thingworx and as an academic user, I don't have access to this version.
But as I wrote in another discussion, I did learn to build a simple working docker-compose file for the developer edition that is backed by the H2 database.
Feel free to make pull request with H2 version, I can set it up as different branch. =)
Just wanted to share my how to to build up a TW instance using docker.
Build an ubuntu server VM NIC bridged
Login
sudo apt-get update
Install OpenSSH server
sudo tasksel
Back up sshconfig
sudo cp -a /etc/ssh/sshd_config /etc/ssh/sshd_config_backup
Edit the config file to allow port 22
sudo nano /etc/ssh/ssh_config
uncomment Port 22
restart ssh
sudo service ssh restart
Get server IP
ifconfig
Log in from putty
Install docker
wget -qO- http://get.docker.com | sh
Add your user to docker group
sudo usermod -aG docker (username)
exit
Log back in with putty.
Configure your docker directory
mkdir (docker working dir)
cd /(docker working dir)
mkdir build
Add your war file and tomcat-users.xml to the build directory. "filezilla"
nano Dockerfile
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
FROM java:8-jre
ENV CATALINA_HOME /usr/local/tomcat
ENV PATH $CATALINA_HOME/bin:$PATH
RUN mkdir -p "$CATALINA_HOME" \
&& mkdir -p "/ThingworxStorage" \
&& mkdir -p "/ThingworxBackupStorage"
# && chown tomcat8:tomcat8 /ThingworxStorage /ThingworxBackupStorage \
# && chown 755 /ThingworxStorage /ThingworxBackupStorage
WORKDIR $CATALINA_HOME
# see https://www.apache.org/dist/tomcat/tomcat-8/KEYS
RUN gpg --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys \
05AB33110949707C93A279E3D3EFE6B686867BA6 \
07E48665A34DCAFAE522E5E6266191C37C037D42 \
47309207D818FFD8DCD3F83F1931D684307A10A5 \
541FBE7D8F78B25E055DDEE13C370389288584E7 \
61B832AC2F1C5A90F0F9B00A1C506407564C17A3 \
713DA88BE50911535FE716F5208B0AB1D63011C7 \
79F7026C690BAA50B92CD8B66A3AD3F4F22C4FED \
9BA44C2621385CB966EBA586F72C284D731FABEE \
A27677289986DB50844682F8ACB77FC2E86E29AC \
A9C5DF4D22E99998D9875A5110C01C5A2F6059E7 \
DCFD35E0BF8CA7344752DE8B6FB21E8933C60243 \
F3A04C595DB5B6A5F1ECA43E3B7BBB100D811BBE \
F7DA48BB64BCB84ECBA7EE6935CD23C10D498E23
ENV TOMCAT_MAJOR 8
ENV TOMCAT_VERSION 8.0.37
ENV TOMCAT_TGZ_URL https://www.apache.org/dist/tomcat/tomcat-$TOMCAT_MAJOR/v$TOMCAT_VERSION/bin/apache-tomcat-$TOMCAT_VERSION.tar.gz
RUN curl -SL "$TOMCAT_TGZ_URL" -o tomcat.tar.gz \
&& curl -SL "$TOMCAT_TGZ_URL.asc" -o tomcat.tar.gz.asc \
&& gpg --verify tomcat.tar.gz.asc \
&& tar -xvf tomcat.tar.gz --strip-components=1 \
&& rm bin/*.bat \
&& rm tomcat.tar.gz*
ENV JAVA_OPTS -Dserver -Dd64 -Xms1024m -Xmx5g -XX:+UseNUMA -XX:+UseConcMarkSweepGC
ENV CATALINA_OPTS -Djava.net.preferIPv4Stack=true
COPY build/tomcat-users.xml $CATALINA_HOME/conf/
COPY build/Thingworx.war $CATALINA_HOME/webapps/
EXPOSE 8080
CMD ["catalina.sh", "run"]
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Build docker
docker build -t thingworx .
Run, instance.
docker run -d -p 8080:8080 thingworx
Test connect to http://IP:8080/Thingworx
default account is Administrator/admin
You should use Docker shared volumes to get the TW storage directories (/ThingworxStorage and ThingworxBackupStorage) outside of the container. Example : docker run -d -p 8080:8080 -v $HOME/TW/ThingworxStorage:/ThingworxStorage -v $HOME/TW/ThingworxBackupStorage:/ThingworxBackupStorage thingworx