SXI Forum

A place to collect usefull tips, tricks and implementation strategies.

You are not logged in.

#1 16-10-2019 16:45:23

SeanR
Administrator
Registered: 20-11-2018
Posts: 148

SXIWebServices-2.3 (Writing to a database) in Docker

In order to run the SXIWebservices that write to a database we need to make use of 2 containers.  One for the actual web services and another for the database.  The database we are using in this instance is MariaDB which is actually just MYSQL.

You will need to create a file called docker-compose.yml inside this file add the code below:

version: '3'

services:
    ws:            
        image: xlayer.co.za:5000/sxiws:2.3
        container_name: sxiws
        ports:
            - 8080:8080
        networks:
            - sxiws_net
        volumes:
            # ===== Windows Host =====
            - C:/SXI/XPress/XmlOut:/opt/SXI/XPress/XmlOut
            - C:/SXI/WebServiceLogs:/opt/SXI/WebServiceLogs
            # ====== Linux Host ======
            #- /opt/SXI/XPress/XmlOut:/opt/SXI/XPress/XmlOut
            #- /opt/SXI/WebServiceLogs:/opt/SXI/WebServiceLogs

    db:
        image: xlayer.co.za:5000/sxiwsdb:2.3
        container_name: sxiwsdb
        ports:
            - 3306:3306
        networks:
            - sxiws_net
        volumes:
            # ===== Windows Host =====
            - C:/SXI/SXIDB:/var/lib/mysql
            # ====== Linux Host ======
            #- /opt/SXI/SXIDB:/var/lib/mysql
        command:
            'mysqld --innodb-flush-method=fsync'

networks:
    sxiws_net:
        driver: bridge

NB: Remember to comment the Windows paths and uncomment the unix paths if you are running on Linux.

Now that you have the docker-compose.yml file all you have to do is run the following from a command line in the directory where you saved file you created:

docker-compose up

Note: If this is the first time you are running this command it will download the images you need and then will set them up for you.  (I.e. it will create the relevant database, tables and users you need)  This can take up to 3 mins after the download is complete.

You should now be able to browse to http://localhost:8080/SXIWebServices-2.3

To test you can use SoapUI to send SOAP or REST transactions to the SXI web services.  To see the transactions in the database you will need to connect something like DBeaver or MYSQLWorkbenchto the "sxiwsdb" container.

To get the docker IP of the "sxiwsdb" container run the following command and look for the IPAddress tag:

docker inspect sxiwsdb

Once you have the ip address you can connect using port 3306 with the username of 'sxi'.  The password is a common SXI password however will not be published here.

Note: This image by default will not write XML files to the filesystem.  However, with some simple configuration this can be achieved.   For now though you are welcome to download and install the 2.1 image which can run concurrently with 2.3 as long as the ports are changed.

Offline

#2 17-10-2019 07:55:21

SeanR
Administrator
Registered: 20-11-2018
Posts: 148

Re: SXIWebServices-2.3 (Writing to a database) in Docker

Remember if you get the

http: server gave HTTP response to HTTPS client

error you need to perform the following:

Go to docker settings on your local machine and perform the following:

  • For Windows go to docker settings and on the "Daemon" tab click on the advanced toggle switch and add the following to the json given:

    "insecure-registries": ["xlayer.co.za:5000"]
  • For Linux edit the "daemon.json" file. The default location is "/etc/docker/daemon.json". (If the file cannot be found, create it.) then add the following code:

    {
      "insecure-registries" : ["xlayer.co.za:5000"]
    }

Offline

Board footer

Powered by FluxBB