cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Creating ThingWorx 8.0 with Docker and Postgres on a single server for test purposes

Highlighted
Amethyst

Creating ThingWorx 8.0 with Docker and Postgres on a single server for test purposes

Please note that the below configuration is intended for testing purposes only.  Make sure that your final deployment is within your business security policies.

The installation guide can be found at: http://support.ptc.com/WCMS/files/173161/en/ThingWorxDockerInstaller.pdf

Postgres:

  • Reference the Installation Guide above for a supported version of Postgres
  • Once deployed, configure it to support remote connections:
    1. Navigate to: <PostgresInstallPoint>\data
    2. Open the following with a text editor: pg_hba.conf
    3. Find the line with IPv4 local connections
    4. Change 127.0.0.1/32 to 0.0.0.0/0
    5. Restart PostgreSQL server
  • NOTE: This could open up security vulnerabilities to the database, so make sure you take appropriate security measures if the data will be sensitive

Docker:

  • Find the appropriate Docker platform for your OS
    • Docker Community Edition
      • For Windows Server 2016, there is a download for the Edge (Windows Server 2016) under the above link -> Docker CE for Windows -> And then scroll down a little bit
    • Docker Toolbox
      • If you try to deploy the Docker Community Edition on a system that doesn't support, it will direct you to this installation instead
  • At some point during or after the installation, it will prompt you to enable Hyper-V
    • If this is a physical server, these settings will be in your Bios
    • For VMWare, while the VM is powered down, go to VM-> Virtual Machine Properties -> Hardware -> Processors -> Enable 'Virtualize Intel VT-x/EPT or AMD-V/RVI'
      • HyperV.jpg
  • Restart, and make sure Docker is running (whale icon in your system tray for the Windows Server 2016 edge version)
  • With Docker running, open a command prompt and look at your IP settings
    • For windows Server 2016, right click the start menu -> Command Prompt (admin) and run IPCONFIG
  • Write down the IP assigned to DockerNAT, as this is will be your Postgres HOST later
    • IPConfig.jpg
  • Share your main drive with Docker
    • In Windows Server 2016, right click the docker icon in the system tray -> Settings -> Shared Drives -> C:
      • SharedDrive.jpg

Thingworx Installation:

  • At this point you should have Docker installed and Postgres remotely configured with only the admin user (postgres)
    • The installer will create the image/container inside of Docker, Install Tomcat, and configure your database
  • Below is a capture of the settings used in the above screenshots.  Anything not listed (like specifying the container name, which is twxfoundation by default) was left as the default values:

      Installation Directory: C:\Program Files (x86)\twxEnterpriseFoundationPostgresDocker

      ThingWorx License Directory: C:\Users\Administrator\Desktop\license.bin

      Local ThingWorx Foundation Port: 8080

      Java Initial Heap setting for TWX Foundation: 1024

      Java Max Heap setting for TWX Foundation: 2048

      RDS Instance: 1

    PostgreSQL Host: 10.0.75.1

      PostgreSQL Port: 5432

      PostgreSQL Admin Schema: postgres

      PostgreSQL Admin Username: postgres

      PostgreSQL Admin Password: <see note>

      PostgreSQL ThingWorx Foundation Schema: thingworx

      PostgreSQL ThingWorx Foundation Username: thingworx

      PostgreSQL ThingWorx Foundation Password: <see note>

      PostgreSQL ThingWorx Tablespace Location: /

                    ​NOTE:​ It is highly recommended to use a complex password (Letters of all cases, numbers, and symbols) as we have opened up our database to remote connections

  • RDS was set to Yes (Default is no)
  • PostgreSQL Host is the IP taken from the earlier steps
  • In this example, the Tablespace location is defined inside of Docker, not Windows

Post Install:

Troubleshooting:

  • If the installation fails, refer to the end of the Installation Guide on where to look for logs, and items that need to be cleaned up before attempting to install again
  • If the install was successful, but connecting fails, run the following in the command prompt to look at the Docker Server's startup logs for hints:
    • Docker logs -f twxfoundation
      • *Note that twxfoundation is the default during installation.  If this was changed in your installation, use that instead
6 REPLIES 6

Re: Creating ThingWorx 8.0 with Docker and Postgres on a single server for test purposes

Hi Tony,

I installed Thingworx on centos 7 with Docker installation package in a vm.

My issue is that I could not setup the bridge connection with docker.

When I followed your instruction,

https://community.thingworx.com/servlet/JiveServlet/showImage/38-1476-6261/HyperV.jpg

You have this option, but it's gray and could not be clicked in my virtual machine.

Could you give some suggestions?

Thanks,

Br,

Anna

Re: Creating ThingWorx 8.0 with Docker and Postgres on a single server for test purposes

Hi Anna An​,

Make sure the VM is powered down, and that should allow you to make the changes.

Regards,

Tony

Re: Creating ThingWorx 8.0 with Docker and Postgres on a single server for test purposes

Hi Tony,

Yes it worked after powering off the VM:)

Re: Creating ThingWorx 8.0 with Docker and Postgres on a single server for test purposes

Hi Tony,

Thanks for detailed info.

Actually, i am trying to setup Thingworx 8.0 docker setup in ubuntu 14.

I setup docker and installed postgreSQL as well.

When i trying to execute thingworx installer file then i am getting error

"

Warning: Problem running post-install step. Installation may not complete

correctly

Error running ./check-http-response.linux -username "Administrator" -password

"trUf6yuz2?_Gub" -hostname "127.0.1.1" -hostport "8080": child process exited

abnormally

"

again i tried then i got below error:

Installing

0% ______________ 50% ______________ 100%

#######################################Warning: Problem running post-install step. Installation may not complete

correctly

Error running docker run -it -d -l TWX -p 8080:8080 -v

"/opt/twxEnterpriseFoundationPostgresDocker/license:/app" -v

ThingworxFoundationPostgres:/ThingworxPlatform -v

ThingworxFoundationPostgresStorage:/ThingworxStorage -v

ThingworxFoundationPostgresBackupStorage:/ThingworxBackupStorage --name

twxfoundation -e INITIAL_HEAP=1024 -e MAX_HEAP=2048

installer/twx/thingworx-enterprise-foundation-postgres:8.0.2-b67 -D 172.17.0.1

-q 5432 -U postgres -P postgres1 -S postgres -u twadmin -p password -s thingworx

-t /opt/postgres/tablespaces/thingworx -r 0: docker: Error response from daemon:

Conflict. The container name "/twxfoundation" is already in use by container

"6d2920f2f533d15f358153561f998a11b5815c7aca0a52400e064e6734218456". You have to

remove (or rename) that container to be able to reuse that name.

See 'docker run --help'.

Press [Enter] to continue:

##

Do you have any idea about that? although i know you tried on window machine

Re: Creating ThingWorx 8.0 with Docker and Postgres on a single server for test purposes

Hi Varun,

When you did the first install, did you do 127.0.0.1 for the PostgreSQL Host?  And then the second time around do 172.17.0.1?

There are some cleanup steps that need to be done before attempting to do another install.  Try going through this (http://support.ptc.com/WCMS/files/173161/en/ThingWorxDockerInstaller.pdf#page=35) and that should prevent that second error from appearing.

Regards,

Tony

Re: Creating ThingWorx 8.0 with Docker and Postgres on a single server for test purposes

Hi Tony,

Thanks for reply. Yes, did same on first instance but now I not doing that .Now i am using fresh VM machine and giving postgres host as docker IP (172.17.0.1) . Still i am getting permission denied issue in the docker container logs.

When is saw the container logs i found below logs

root@varun-VirtualBox:/home/varun# docker logs twxfoundation1

New license found in /app, installing: license.bin

172.17.0.1

5432

postgres

postgres

postgres

twiadmin

twiadmin

thingworxx

/opt/ThingworxPostgresqlStorage

no

*:*:postgres:postgres:postgres

*:*:thingworxx:twiadmin:twiadmin

No database found, creating new database

CREATE ROLE

NOT an RDS Instance

/opt/tomcat/webapps/install/thingworx-database-setup.sql: Permission denied

psql: FATAL:  database "thingworxx" does not exist

psql: FATAL:  database "thingworxx" does not exist

psql: FATAL:  database "thingworxx" does not exist

Using CATALINA_BASE:   /opt/tomcat

Using CATALINA_HOME:   /opt/tomcat

Using CATALINA_TMPDIR: /opt/tomcat/temp

Using JRE_HOME:        /opt/jdk1.8.0_92

Using CLASSPATH:       /opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/tomcat-juli.jar

Java HotSpot(TM) 64-Bit Server VM warning: Cannot open file /opt/tomcat/logs/tomcat-twx-gc.log due to Permission denied

java.util.logging.ErrorManager: 4

java.io.FileNotFoundException: /opt/tomcat/logs/catalina.2017-08-09.log (Permission denied)

and then i get into docker container with "docker exec -it name-of-container bash" command , i found:

twadmin@711516e559a9:/opt/tomcat/webapps$ ls -lrt

ls: cannot access 'ROOT': Permission denied

ls: cannot access 'Thingworx': Permission denied

ls: cannot access 'install': Permission denied

ls: cannot access 'update': Permission denied

ls: cannot access 'examples': Permission denied

ls: cannot access 'host-manager': Permission denied

ls: cannot access 'docs': Permission denied

total 4

d????????? ? ?       ?         ?            ? update

d????????? ? ?       ?         ?            ? install

d????????? ? ?       ?         ?            ? host-manager

d????????? ? ?       ?         ?            ? examples

d????????? ? ?       ?         ?            ? docs

d????????? ? ?       ?         ?            ? Thingworx

d????????? ? ?       ?         ?            ? ROOT

-rw-rw-r-- 1 twadmin twadmin 242 Jul 31 15:32 platform-settings.json

twadmin@711516e559a9:/opt/tomcat/webapps$