B.1 Run MicroTx Distributed Transactions in a Docker Container on Linux

Use the following commands to run MicroTx Distributed Transactions in an independent Docker container on Linux operating system.

Before you begin, ensure that you have loaded the MicroTx Distributed Transactions Docker image and updated the tcs.yaml file. The tcs.yaml file is located in the installation_directory/MicroTx-RELEASE/deployment-descriptors/docker-compose/config folder on your local machine. This file contains the deployment configuration details for MicroTx Distributed Transactions. The coordinator image is located in the installation_directory/MicroTx-RELEASE/coordinator/container-images folder on your local machine.

Run MicroTx Distributed Transactions using the configuration details provided in the tcs.yaml file. Ensure that the tcs.yaml file is present in the current working directory.

  1. Use the following command to run MicroTx Distributed Transactions in a Docker container if you have not set up a data store and want to use internal memory.

    Sample Command

    docker container run --name otmm -v "$(pwd)":/app/config \
    -w /app -p 9000:9000/tcp --env CONFIG_FILE=/app/config/tcs.yaml \
    --network=host -d tmm:<version>

    Where,

    • --name otmm is the name of the container that you want to create.
    • -v "$(pwd)":/app/config mounts the current directory into container at the /app/config path.
    • -w /app specifies the working directory as /app. In this sample command, /app remains the default working directory as the volume is also mounted on this directory based on the value provided for the -v flag.
    • --env CONFIG_FILE=config/tcs.yaml specifies the location of the tcs.yaml file, which contains coordinator configuration.
    • --network=host is a network configuration. The callback URL is an IPv4 address. To retrieve the IPv4 address, run the ipconfig command and then note down the value of IPv4 Address.
    • tmm:<version> is the MicroTx Distributed Transactions Docker image that you have loaded to the local Docker repository.
  2. Use the following commands to run MicroTx Distributed Transactions in a Docker container when you want to use Oracle Database as a data store to persist the transaction state and to store the transaction logs.
    1. Create a copy of the tcs.yaml file and name it as tcs-db.yaml.
    2. Open the tcs-db.yaml file in any code editor. Under tmmConfiguration.storage, specify the type as db, and then provide details to connect to an Oracle Database under tmmConfiguration.storage.db. See Data Store Properties.
    3. Use the following command to run MicroTx Distributed Transactions in a Docker container while providing credentials to access Oracle Database. Replace <DBpassword> and <DBuser> with the password and user name to access Oracle Database in your environment.

      Sample Command

      docker container run --name otmm -v "$(pwd)":/app/config \
      -w /app -p 9000:9000/tcp --env CONFIG_FILE=/app/config/tcs-db.yaml \
      --network=host \
      -e STORAGE_DB_CREDENTIAL='{"password":"<DBpassword>", "username":"<DBuser>"}' \
      -d tmm:23.4.2

      Where,

      • --name otmm is the name of the container that you want to create.
      • -v "$(pwd)":/app/config mounts the current directory into container at the /app/config path.
      • -w /app specifies the working directory as /app. In this sample command, /app remains the default working directory as the volume is also mounted on this directory based on the value provided for the -v flag.
      • --env CONFIG_FILE=config/tcs-db.yaml specifies the location of the tcs.yaml file, which contains configuration details for the coordinator and Oracle Database credentials.
      • --network=host is a network configuration. The callback URL is an IPv4 address.
      • tmm:<version> is the MicroTx Distributed Transactions Docker image that you have loaded to the local Docker repository.
  3. After MicroTx Distributed Transactions is installed, run the MicroTx Distributed Transactions health check API to verify that the MicroTx Distributed Transactions coordinator is up and running.
    curl --location \ 
              'http://localhost:9000/health' \
              --header 'Accept: application/json'