Testing the Service and Client Applications Locally in a Docker Setup
Prerequisites
- Docker must be installed on your machine.
- Access to a local Consul server.
Procedure
-
Execute the following command on a Docker terminal to run the service application image:
docker run -e CONSUL_SERVER_URL=consul-server-url
-e DOCKER_LOCAL_HOST_IP=Docker-machine-ip
-e DOCKER_LOCAL_HOST_PORT=Docker-machine-port -p 18086:8080
-e SERVICE_NAME=BWCE-HELLOWORLD-SERVICE bwce-servicediscovery.service-app
Note: DOCKER_LOCAL_HOST_IP: While registering service, the variable value becomes the value for IP address configured with consul service.
Note: DOCKER_LOCAL_HOST_PORT: While registering service, the variable value becomes the value for PORT configured with consul service
-
Execute the following command on a Docker terminal to run the service application image:
docker run -e CONSUL_SERVER_URL=consul-server-url
-p 18087:8080
-e SERVICE_NAME=BWCE-HELLOWORLD-SERVICE bwce-servicediscovery.client.app
-
Execute the following command to view the logs to make sure that the application has started successfully.
docker logs <container name>
-
Check the logs for the service and client applications to make sure they have started successfully.
-
Get the IP address for the Docker machine.
-
Access the following URL from a browser:
http://<docker-machine-ip>:18087
Result
The following output should be seen in the browser:
Hello from TIBCO"
Copyright © Cloud Software Group, Inc. All rights reserved.