B.9 Access MicroTx in Docker Swarm

Use the internal URL or external URL to access MicroTx. You will use different URLs depending on whether you want to access MicroTx from within the Docker registry where you have deployed the service or from outside the Docker registry.

When you enable TLS, use the HTTPS protocol to access the service. When you disable TLS, use the HTTP protocol to access the service.

Internal URL to access MicroTx

Use the internal URL to access MicroTx from within the Docker registry where you have deployed the service.

To access MicroTx internally, create the URL in the following format:

http://internalHostname:listenAddr/api/v1

Where,

  • internalHostname: Name that you have entered for the tmmAppName property in the tcs-docker-swarm.yaml file. For example, tmm-app.
  • listenAddr: Port number that you have entered for the listenAddr property in the tcs-docker-swarm.yaml file. For example, 9000. Ensure that you have set up the required networking rules to permit HTTPS or HTTP traffic over this port.

Based on the example values provided above, the example MicroTx URL is http://tmm-app:9000/api/v1 or http://localhost:9000/api/v1.

All communication within a Docker registry uses the HTTP protocol.

External URL to access MicroTx

Use the external URL to access MicroTx from outside the Docker registry where you have deployed the service. For example, when you deploy the transaction initiator application and MicroTx in different Docker registries. In such a scenario, the transaction initiator application uses the external URL to access MicroTx.

To access MicroTx externally, create the URL in the following format:

https://externalHostname:listenAddr/api/v1

Where,

  • externalHostname: The IP address of the Docker registry that you have created. For example, 198.51.100.1.
  • listenAddr: Port number that you have entered for the listenAddr property in the tcs-docker-swarm.yaml of the MicroTx. For example, 5000. Ensure that you have set up the required networking rules to permit inbound and outbound HTTPS or HTTP traffic over this port.

Based on the example values provided above, the example MicroTx URL is https://198.51.100.1:5000/api/v1.

Store the IP address of the Docker registry in an environment variable named REGISTRY_IPADDR as shown in the following command.

export REGISTRY_IPADDR=192.0.2.1

Note that, if you don't do this, then you must explicitly specify the IP address in the commands when required.