Java Magazine, Jan/Feb 2016
ORACLE COM JAVAMAGAZINE JANUARY FEBRUARY 2016 78 containers the following command docker compose x networking up d An overlay network specific to the application is created You can verify this by running the following command docker network ls Three networks for each swarm node will be shown In addition the wildflycouchbasejavaee7 overlay network and the docker_ gwbridge bridge network are created for containers to gain connectivity outside the cluster You can verify the WildFly and Couchbase containers by using the docker ps command The truncated output of this command shows that the Couchbase server is running on the swarm master machine and WildFly is running on the swarm node 01 machine Configure the Couchbase Server and Install the Sample Data When it is started as a Docker container the Couchbase server needs to be configured so that it can be used for storing data Fortunately it provides a REST API that can do exactly that This API can also be used to upload the sample data Use git to clone the online app as shown next and then use Maven for the installation This application has a Maven profile that allows you to configure the Couchbase server using the REST API git clone https github com arun gupta couchbase javaee git mvn install Pcouchbase Ddocker host docker machine ip swarm master In this snippet docker machine ip swarm master will provide the IP address of the swarm master machine that was created earlier You could use the actual IP address which could be found using docker machine ip swarm master instead of using docker machine ip swarm master Deploy the Application to the Docker Swarm Cluster Deploying the application requires us to specify the IP address of the host where WildFly is running and the username password of a user in WildFlys administration realm In our case the IP address is that of the swarm node 01 machine and the username password values are the ones that are used to build the arungupta wildfly admin image The exact command to be entered as a single line will be mvn install Pwildfly Dwildfly hostname docker machine ip swarm node 01 Dwildfly username admin Dwildfly password Admin 007 You might want to obtain the IP address of the machine running WildFly by using docker machine ip swarmnode 01 and then use the IP address instead Access the Application Now that the WildFly and Couchbase services have started its time to access the application You need to specify the IP address of the machine where WildFly is running An easy way is to do this is to use the widely known command line utility curl curl http docker machine ip swarm node 01 8080 couchbase javaee resources airline This command should be entered as a single line Ed This command prints the list of 10 airlines from the sample data that was configured earlier in Couchbase Alternatively you can obtain the IP address of WildFly
You must have JavaScript enabled to view digital editions.