Monthly Archives: November 2014

Docker Common Commands Cheatsheet (Tech Tip #59)

Docker CLI provides a comprehensive set of commands. Here is a quick cheat sheet of the commonly used commands:

Purpose Command
Build an image docker build –rm=true .
Install an image docker pull ${IMAGE}
List of installed images docker images
List of installed images (detailed listing) docker images –no-trunc
Remove an image docker rmi ${IMAGE_ID}
Remove all untagged images docker rmi $(docker images | grep “^” | awk “{print $3}”)
Remove all images docker rm $(docker ps -aq)
Run a container docker run
List containers docker ps
Stop a container docker stop ${CID}
Find IP address of the container docker inspect –format ‘{{ .NetworkSettings.IPAddress }}’ ${CID}
Attach to a container docker attach ${CID}
Remove a container docker rm ${CID}
Remove all containers docker rm $(docker ps -aq)

What other commands do you use commonly ?

Pushing Docker images to Registry (Tech Tip #58)

Tech Tip #57 explained how to create your own Docker images. That particular blog specifically showed how to build your own WildFly Docker images on CentOS and Ubuntu. Now you are ready to share your images with rest of the world. That’s where Docker Hub comes in handy.

Docker Hub is the “distribution component” of Docker, or a place to store and search images. From the Getting Started with Docker Hub docs …

The Docker Hub is a centralized resource for working with Docker and its components. Docker Hub helps you collaborate with colleagues and get the most out of Docker.

Starting and pushing images to with Docker Hub is pretty straight forward.

  • Pushing images to Docker Hub require an account. It can be created as explained here. Or rather easily by using docker login command.
    wildfly-centos> docker login
    Username: arungupta
    Password: 
    Email: [email protected]
    Login Succeeded

    Searching on WildFly shows there are 72 images:

    wildfly-centos> docker search wildfly
    NAME                                     DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
    jboss/wildfly                            WildFly application server image                42                   [OK]
    sewatech/wildfly                         Debian + WildFly 8.1.0.Final with OpenJDK ...   1                    [OK]
    kamcord/wildfly                                                                          1                    
    openshift/wildfly-8-centos                                                               1                    [OK]
    abstractj/wildfly                        AeroGear Wildfly Docker image                   1                    
    jsightler/wildfly_nightly                Nightly build from wildfly's github master...   1                    
    centos/wildfly                           CentOS based WildFly Docker image               1                    
    aerogear/unifiedpush-wildfly                                                             1                    [OK]
    t0nyhays/wildfly                                                                         1                    [OK]
    tsuckow/wildfly-propeller                Dockerization of my application *Propeller...   0                    [OK]
    n3ziniuka5/wildfly                                                                       0                    [OK]
    snasello/wildfly                                                                         0                    [OK]
    jboss/keycloak-adapter-wildfly                                                           0                    [OK]
    emsouza/wildfly                                                                          0                    [OK]
    sillenttroll/wildfly-java-8              WildFly container with java 8                   0                    [OK]
    jboss/switchyard-wildfly                                                                 0                    [OK]
    n3ziniuka5/wildfly-jrebel                                                                0                    [OK]
    dfranssen/docker-wildfly                                                                 0                    [OK]
    wildflyext/wildfly-camel                 WildFly with Camel Subsystem                    0                    
    ianblenke/wildfly                                                                        0                    [OK]
    arcamael/docker-wildfly                                                                  0                    [OK]
    dmartin/wildfly                                                                          0                    [OK]
    pires/wildfly-cluster-backend                                                            0                    [OK]
    aerogear/push-quickstarts-wildfly-dev                                                    0                    [OK]
    faga/wildfly                             Wildfly application server with ubuntu.         0                    
    abstractj/unifiedpush-wildfly            AeroGear Wildfly Docker image                   0                    
    murad/wildfly                            - oficial centos image - java JDK "1.8.0_0...   0                    
    aerogear/unifiedpush-wildfly-dev                                                         0                    [OK]
    ianblenke/wildfly-cluster                                                                0                    [OK]
    blackhm/wildfly                                                                          0                    
    khipu/wildfly8                                                                           0                    [OK]
    rowanto/docker-wheezy-wildfly-java8                                                      0                    [OK]
    ordercloud/wildfly                                                                       0                    
    lavaliere/je-wildfly                     A Jenkins Enterprise demo master with a Wi...   0                    
    adorsys/wildfly                          Ubuntu - Wildfly - Base Image                   0                    
    akalliya/wildfly                                                                         0                    
    lavaliere/joc-wildfly                    Jenkins Operations Center master with an a...   0                    
    tdiesler/wildfly                                                                         0                    
    apiman/on-wildfly8                                                                       0                    [OK]
    rowanto/docker-wheezy-wildfly-java8-ex                                                   0                    [OK]
    arcamael/blog-wildfly                                                                    0                    
    lavaliere/wildfly                                                                        0                    
    jfaerman/wildfly                                                                         0                    
    yntelectual/wildfly                                                                      0                    
    svenvintges/wildfly                                                                      0                    
    dbrotsky/wildfly                                                                         0                    
    luksa/wildfly                                                                            0                    
    tdiesler/wildfly-camel                                                                   0                    
    blackhm/wildfly-junixsocket                                                              0                    
    abstractj/unifiedpush-wildfly-dev        AeroGear UnifiedPush server developer envi...   0                    
    abstractj/push-quickstarts-wildfly-dev   AeroGear UnifiedPush Quickstarts developer...   0                    
    bn3t/wildfly-wicket-examples             An image to run the wicket-examples on wil...   0                    
    lavaliere/wildfly-1                                                                      0                    
    munchee13/wildfly-node                                                                   0                    
    munchee13/wildfly-manager                                                                0                    
    munchee13/wildfly-dandd                                                                  0                    
    munchee13/wildfly-admin                                                                  0                    
    bparees/wildfly-8-centos                                                                 0                    
    lecoz/wildflysiolapie                    fedora latest, jdk1.8.0_25, wildfly-8.1.0....   0                    
    lecoz/wildflysshsiolapie                 wildfly 8.1.0.Final, jdk1.8.0_25, sshd, fe...   0                    
    wildflyext/example-camel-rest                                                            0                    
    pepedigital/wildfly                                                                      0                    [OK]
    tsuckow/wildfly                          JBoss Wildfly 8.1.0.Final standalone mode ...   0                    [OK]
    mihahribar/wildfly                       Dockerfile for Wildfly running on Ubuntu 1...   0                    [OK]
    hpehl/wildfly-domain                     Dockerfiles based on "jboss/wildfly" to se...   0                    [OK]
    raynera/wildfly                                                                          0                    [OK]
    hpehl/wildfly-standalone                 Dockerfile based on jboss/wildfly to setup...   0                    [OK]
    aerogear/wildfly                                                                         0                    [OK]
    piegsaj/wildfly                                                                          0                    [OK]
    wildflyext/wildfly                       Tagged versions JBoss WildFly                   0

    Official images are tagged jboss/wildfly.

  • In order to push your own image, it needs to be built as a named image otherwise you’ll get an error as shown:
    2014/11/26 09:59:37 You cannot push a "root" repository. Please rename your repository in <user>/<repo> (ex: arungupta/wildfly-centos)

    This can be easily done as shown:

    wildfly-centos> docker build -t="arungupta/wildfly-centos" .
    Sending build context to Docker daemon 4.096 kB
    Sending build context to Docker daemon 
    Step 0 : FROM centos
     ---> ae0c2d0bdc10
    Step 1 : MAINTAINER Arun Gupta <[email protected]>
     ---> Using cache
     ---> e490dfcb3685
    Step 2 : RUN yum -y update && yum clean all
     ---> Using cache
     ---> f212cb9dbcf5
    Step 3 : RUN yum -y install xmlstarlet saxon augeas bsdtar unzip && yum clean all
     ---> Using cache
     ---> 28b11e6151f0
    Step 4 : RUN groupadd -r jboss -g 1000 && useradd -u 1000 -r -g jboss -m -d /opt/jboss -s /sbin/nologin -c "JBoss user" jboss
     ---> Using cache
     ---> 73603eab89b7
    Step 5 : WORKDIR /opt/jboss
     ---> Using cache
     ---> 9a661ae4341b
    Step 6 : USER jboss
     ---> Using cache
     ---> 6265153611c7
    Step 7 : USER root
     ---> Using cache
     ---> 12ed28a7acb7
    Step 8 : RUN yum -y install java-1.7.0-openjdk-devel && yum clean all
     ---> Using cache
     ---> 44c4bb92fa11
    Step 9 : USER jboss
     ---> Using cache
     ---> 930cb2a860f7
    Step 10 : ENV JAVA_HOME /usr/lib/jvm/java
     ---> Using cache
     ---> fff2c21b0a71
    Step 11 : ENV WILDFLY_VERSION 8.2.0.Final
     ---> Using cache
     ---> b7b7ca7a9172
    Step 12 : RUN cd $HOME && curl -O http://download.jboss.org/wildfly/$WILDFLY_VERSION/wildfly-$WILDFLY_VERSION.zip && unzip wildfly-$WILDFLY_VERSION.zip && mv $HOME/wildfly-$WILDFLY_VERSION $HOME/wildfly && rm wildfly-$WILDFLY_VERSION.zip
     ---> Using cache
     ---> a1bc79a43c77
    Step 13 : ENV JBOSS_HOME /opt/jboss/wildfly
     ---> Using cache
     ---> d46fdd618d55
    Step 14 : EXPOSE 8080 9990
     ---> Running in 9c2c2a5ef41c
     ---> 8988c8cbc051
    Removing intermediate container 9c2c2a5ef41c
    Step 15 : CMD /opt/jboss/wildfly/bin/standalone.sh -b 0.0.0.0
     ---> Running in 9e28c3449ec1
     ---> d989008d1f84
    Removing intermediate container 9e28c3449ec1
    Successfully built d989008d1f84

    docker build command builds the image, -t specifies the repository name to be applied to the resulting image.

  • Once the image is built, it can be verified as:
    wildfly-centos> docker images
    REPOSITORY                 TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
    arungupta/wildfly-centos   latest              d989008d1f84        14 hours ago        619.6 MB
    wildfly-ubuntu             latest              a2e96e76eb10        43 hours ago        749.5 MB
    <none>                     <none>              0281986b0ed8        44 hours ago        749.5 MB
    <none>                     <none>              1a5e1aeadc85        44 hours ago        607.7 MB
    wildfly-centos             latest              97c8780a7d6a        45 hours ago        619.6 MB
    registry                   latest              7e2db37c6564        13 days ago         411.6 MB
    centos                     latest              ae0c2d0bdc10        3 weeks ago         224 MB
    jboss/wildfly              latest              365390553f92        4 weeks ago         948.7 MB
    ubuntu                     latest              5506de2b643b        4 weeks ago         199.3 MB

    Notice the first line shows the named image arungupta/wildfly-centos.

  • This image can then be pushed to Docker Hub as:
    wildfly-centos> docker push arungupta/wildfly-centos
    The push refers to a repository [arungupta/wildfly-centos] (len: 1)
    Sending image list
    Pushing repository arungupta/wildfly-centos (1 tags)
    511136ea3c5a: Image already pushed, skipping 
    5b12ef8fd570: Image already pushed, skipping 
    ae0c2d0bdc10: Image already pushed, skipping 
    e490dfcb3685: Image successfully pushed 
    f212cb9dbcf5: Image successfully pushed 
    28b11e6151f0: Image successfully pushed 
    73603eab89b7: Image successfully pushed 
    9a661ae4341b: Image successfully pushed 
    6265153611c7: Image successfully pushed 
    12ed28a7acb7: Image successfully pushed 
    44c4bb92fa11: Image successfully pushed 
    930cb2a860f7: Image successfully pushed 
    fff2c21b0a71: Image successfully pushed 
    b7b7ca7a9172: Image successfully pushed 
    a1bc79a43c77: Image successfully pushed 
    d46fdd618d55: Image successfully pushed 
    8988c8cbc051: Image successfully pushed 
    d989008d1f84: Image successfully pushed 
    Pushing tag for rev [d989008d1f84] on {https://cdn-registry-1.docker.io/v1/repositories/arungupta/wildfly-centos/tags/latest}
  • And you can verify this by pulling the image:
    wildfly-centos> docker pull arungupta/wildfly-centos
    Pulling repository arungupta/wildfly-centos
    d989008d1f84: Download complete 
    511136ea3c5a: Download complete 
    5b12ef8fd570: Download complete 
    ae0c2d0bdc10: Download complete 
    e490dfcb3685: Download complete 
    f212cb9dbcf5: Download complete 
    28b11e6151f0: Download complete 
    73603eab89b7: Download complete 
    9a661ae4341b: Download complete 
    6265153611c7: Download complete 
    12ed28a7acb7: Download complete 
    44c4bb92fa11: Download complete 
    930cb2a860f7: Download complete 
    fff2c21b0a71: Download complete 
    b7b7ca7a9172: Download complete 
    a1bc79a43c77: Download complete 
    d46fdd618d55: Download complete 
    8988c8cbc051: Download complete 
    Status: Image is up to date for arungupta/wildfly-centos:latest

Enjoy!

 

Create your own Docker image (Tech Tip #57)

Docker simplifies software delivery by making it easy to build and share images that contain your application’s entire environment, i.e. operating system, JDK, database, WAR file, specific tuning required for your application, etc.

There are three main components of Docker:

  • Docker images are “build component” – a read-only template of application operating system.
  • Containers are “run component” – a runtime representation created from images.
  • Registry are “distribution component” – a place to store and distribute images.

Several JBoss projects are available as Docker images at www.jboss.org/docker. Tech Tip #39 explained how to get started with Docker on Mac. It also explained how to start the official WildFly Docker image.

Docker image is made up of multiple layers where each layer provides some functionality, and a higher layer can add functionality on top of it. For example, Docker mounts the root filesystem as read-only layer and then adds a read-write layer on top of it. All these layers are combined together using Union Mount to provide application operating environment.

The complete history of how the WildFly image was built can be seen as:

docker history --no-trunc=true jboss/wildfly
IMAGE                                                              CREATED             CREATED BY                                                                                                                                                                   SIZE
365390553f925f96f8c00f79525ad101847de7781bb4fec23b1188f25fe99a6a   3 weeks ago         /bin/sh -c #(nop) CMD [/opt/jboss/wildfly/bin/standalone.sh -b 0.0.0.0]                                                                                                      0 B
d7fccab36b8f5a324ef8dd017c8964f2de7839379503021f15502ba3f0b908bd   3 weeks ago         /bin/sh -c #(nop) EXPOSE map[8080/tcp:{} 9990/tcp:{}]                                                                                                                        0 B
184d6d02f340455d33d226d6467484027d0763964a586ae9ada1782262299a74   3 weeks ago         /bin/sh -c #(nop) ENV JBOSS_HOME=/opt/jboss/wildfly                                                                                                                          0 B
57ada25ecdd03191355ec1c8f5f1a4e05b3e152709c9b603d5ed5fb0c4d53853   3 weeks ago         /bin/sh -c cd $HOME && curl http://download.jboss.org/wildfly/$WILDFLY_VERSION/wildfly-$WILDFLY_VERSION.tar.gz | tar zx && mv $HOME/wildfly-$WILDFLY_VERSION $HOME/wildfly   135 MB
59ec65b61fba2b6ada099abe3a9a30d05ffb71370b43dfbd0208fd4f5a34c005   3 weeks ago         /bin/sh -c #(nop) ENV WILDFLY_VERSION=8.1.0.Final                                                                                                                            0 B
90832e1f0bb9e9f98ecd42f6df6b124c1e6768babaddc23d646cd75c7b2fddec   5 weeks ago         /bin/sh -c #(nop) ENV JAVA_HOME=/usr/lib/jvm/java                                                                                                                            0 B
72d585299bb5c5c1c326422cfffadc93d8bb4020f35bf072b2d91d287967807a   5 weeks ago         /bin/sh -c #(nop) USER jboss                                                                                                                                                 0 B
e02bdb6c4ed5436da02c958d302af5f06c1ebb1821791f60d45e190ebb55130f   5 weeks ago         /bin/sh -c yum -y install java-1.7.0-openjdk-devel && yum clean all                                                                                                          217.2 MB
b17a20d6f5f8e7ed0a1dba277acd3f854c531b0476b03d63a8f0df4caf78c763   5 weeks ago         /bin/sh -c #(nop) USER root                                                                                                                                                  0 B
7759146eab1a3aa5ba5ed12483d03e64a6bf1061a383d5713a5e21fc40554457   5 weeks ago         /bin/sh -c #(nop) MAINTAINER Marek Goldmann <[email protected]>                                                                                                            0 B
2ea8562cac7c25a308b4565b66d4f7e11a1d2137a599ef2b32ed23c78f0a0378   5 weeks ago         /bin/sh -c #(nop) USER jboss                                                                                                                                                 0 B
4d37cbbfc67dd508e682a5431a99d8c1feba1bd8352ffd3ea794463d9cfa81cc   5 weeks ago         /bin/sh -c #(nop) WORKDIR /opt/jboss                                                                                                                                         0 B
379edb00ab0764276787ea777243990da697f2f93acb5d9166ff73ad01511a87   5 weeks ago         /bin/sh -c groupadd -r jboss -g 1000 && useradd -u 1000 -r -g jboss -m -d /opt/jboss -s /sbin/nologin -c "JBoss user" jboss                                                  295 kB
cd5bb934bb6755e910d19ac3ae4cfd09221aa2f98c3fbb51a7486991364dc1ae   5 weeks ago         /bin/sh -c yum -y install xmlstarlet saxon augeas bsdtar unzip && yum clean all                                                                                              21.35 MB
20a1abe1d9bfb9b1e46d5411abd5a38b6104a323b7c4fb5c0f1f161b8f7278c2   5 weeks ago         /bin/sh -c yum -y update && yum clean all                                                                                                                                    200.7 MB
1ef0a50fe8b1394d3626a7624a58b58cff9560ddb503743099a56bbe95ab481a   5 weeks ago         /bin/sh -c #(nop) MAINTAINER Marek Goldmann <[email protected]>                                                                                                            0 B
7d3f07f8de5fb3a20c6cb1e4447773a5741e3641c1aa093366eaa0fc690c6417   7 weeks ago         /bin/sh -c #(nop) ADD file:285fdeab65d637727f6b79392a309135494d2e6046c6cc2fbd2f23e43eaac69c in /                                                                             374.1 MB
782cf93a8f16d3016dae352188cd5cfedb6a15c37d4dbd704399f02d1bb89dab   7 weeks ago         /bin/sh -c #(nop) MAINTAINER Lokesh Mandvekar <[email protected]> - ./buildcontainers.sh                                                                                0 B
511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158   17 months ago                                                                                                                                                                                    0 B

The exact command issued at each layer is listed in this output. If you scroll to the far right then you can see the total space consumed by each layer as well. For example, Fedora is used as the base image and consumes ~574 MB of the total image, Open JDK 7 is taking 217.5 MB and WildFly is 135 MB.

Docker images are built by reading the instructions from Dockerfile. This is a text file that contains all the commands, in order, needed to build a given image. It adheres to a specific format and use a specific set of instructions. The vocabulary of commands is rather limited but serves the purpose well. The image can be built by giving the command docker build. Docker Tutorial provides complete instructions on how to create your own custom image.

The official WildFly Docker image is built using Fedora 20 as the base operating system. The Dockerfile can be seen at github.com/jboss-dockerfiles/wildfly/blob/master/Dockerfile. It uses  jboss/base-jdk:7 as the base image, which uses jboss/base as the base image. Dockerfile of jboss/base shows Fedora 20 is used as the base image.

An alternative is to build this image using CentOS or Ubuntu as a base image. Dockerfiles for these images are available at github.com/arun-gupta/docker-images/.

Starting boot2docker shows the output as:

bash
unset DYLD_LIBRARY_PATH ; unset LD_LIBRARY_PATH
mkdir -p ~/.boot2docker
if [ ! -f ~/.boot2docker/boot2docker.iso ]; then cp /usr/local/share/boot2docker/boot2docker.iso ~/.boot2docker/ ; fi
/usr/local/bin/boot2docker init 
/usr/local/bin/boot2docker up 
$(/usr/local/bin/boot2docker shellinit)
docker version
Last login: Mon Nov 24 11:03:33 on ttys006
hello arungupta
~> bash
~> unset DYLD_LIBRARY_PATH ; unset LD_LIBRARY_PATH
~> mkdir -p ~/.boot2docker
~> if [ ! -f ~/.boot2docker/boot2docker.iso ]; then cp /usr/local/share/boot2docker/boot2docker.iso ~/.boot2docker/ ; fi
~> /usr/local/bin/boot2docker init 
Virtual machine boot2docker-vm already exists
~> /usr/local/bin/boot2docker up 
Waiting for VM and Docker daemon to start...
.....................ooooooooooooooooo
Started.
Writing /Users/arungupta/.boot2docker/certs/boot2docker-vm/ca.pem
Writing /Users/arungupta/.boot2docker/certs/boot2docker-vm/cert.pem
Writing /Users/arungupta/.boot2docker/certs/boot2docker-vm/key.pem

To connect the Docker client to the Docker daemon, please set:
    export DOCKER_HOST=tcp://192.168.59.103:2376
    export DOCKER_CERT_PATH=/Users/arungupta/.boot2docker/certs/boot2docker-vm
    export DOCKER_TLS_VERIFY=1

~> $(/usr/local/bin/boot2docker shellinit)
Writing /Users/arungupta/.boot2docker/certs/boot2docker-vm/ca.pem
Writing /Users/arungupta/.boot2docker/certs/boot2docker-vm/cert.pem
Writing /Users/arungupta/.boot2docker/certs/boot2docker-vm/key.pem
~> docker version
Client version: 1.3.1
Client API version: 1.15
Go version (client): go1.3.3
Git commit (client): 4e9bbfa
OS/Arch (client): darwin/amd64
Server version: 1.3.1
Server API version: 1.15
Go version (server): go1.3.3
Git commit (server): 4e9bbfa

And then you can build the CentOS-based WildFly Docker image as shown below. Note this command is given from the “wildfly-centos” directory of github.com/arun-gupta/docker-images/. And so the Dockerfile is at github.com/arun-gupta/docker-images/blob/master/wildfly-centos/Dockerfile.

wildfly-centos> docker build -t wildfly-centos .
Sending build context to Docker daemon 4.096 kB
Sending build context to Docker daemon 
Step 0 : FROM centos
centos:latest: The image you are pulling has been verified
511136ea3c5a: Pull complete 
5b12ef8fd570: Pull complete 
ae0c2d0bdc10: Pull complete 
Status: Downloaded newer image for centos:latest
 ---> ae0c2d0bdc10
Step 1 : MAINTAINER Arun Gupta <[email protected]>
 ---> Running in 7fc52653d381
 ---> e490dfcb3685
Removing intermediate container 7fc52653d381
Step 2 : RUN yum -y update && yum clean all
 ---> Running in 90de23c9dde7
Loaded plugins: fastestmirror
Determining fastest mirrors
 * base: mirror.cc.columbia.edu
 * extras: centos.mirror.ndchost.com
 * updates: centos-distro.cavecreek.net
Resolving Dependencies
--> Running transaction check
---> Package tzdata.noarch 0:2014h-1.el7 will be updated
---> Package tzdata.noarch 0:2014j-1.el7_0 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package         Arch            Version                 Repository        Size
================================================================================
Updating:
 tzdata          noarch          2014j-1.el7_0           updates          434 k

Transaction Summary
================================================================================
Upgrade  1 Package

Total download size: 434 k
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
warning: /var/cache/yum/x86_64/7/updates/packages/tzdata-2014j-1.el7_0.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Public key for tzdata-2014j-1.el7_0.noarch.rpm is not installed
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Importing GPG key 0xF4A80EB5:
 Userid     : "CentOS-7 Key (CentOS 7 Official Signing Key) <[email protected]>"
 Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
 Package    : centos-release-7-0.1406.el7.centos.2.5.x86_64 (@Updates/$releasever)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : tzdata-2014j-1.el7_0.noarch                                  1/2 
  Cleanup    : tzdata-2014h-1.el7.noarch                                    2/2 
  Verifying  : tzdata-2014j-1.el7_0.noarch                                  1/2 
  Verifying  : tzdata-2014h-1.el7.noarch                                    2/2 

Updated:
  tzdata.noarch 0:2014j-1.el7_0                                                 

Complete!
Loaded plugins: fastestmirror
Cleaning repos: base extras updates
Cleaning up everything
Cleaning up list of fastest mirrors
 ---> f212cb9dbcf5
Removing intermediate container 90de23c9dde7
Step 3 : RUN yum -y install xmlstarlet saxon augeas bsdtar unzip && yum clean all
 ---> Running in d4bd822933c8
Loaded plugins: fastestmirror
Determining fastest mirrors
 * base: mirror-centos.hostingswift.com
 * extras: mirror.keystealth.org
 * updates: mirrors.advancedhosters.com
No package xmlstarlet available.
Resolving Dependencies
--> Running transaction check
---> Package augeas.x86_64 0:1.1.0-12.el7 will be installed
--> Processing Dependency: augeas-libs = 1.1.0-12.el7 for package: augeas-1.1.0-12.el7.x86_64

. . .

--> Processing Dependency: python-lxml for package: python-javapackages-3.4.1-6.el7_0.noarch
--> Running transaction check
---> Package python-lxml.x86_64 0:3.2.1-4.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package                  Arch        Version                Repository    Size
================================================================================
Installing:
 augeas                   x86_64      1.1.0-12.el7           base          35 k
 bsdtar                   x86_64      3.1.2-7.el7            base          55 k

. . .

 python-javapackages      noarch      3.4.1-6.el7_0          updates       31 k
 python-lxml              x86_64      3.2.1-4.el7            base         758 k

Transaction Summary
================================================================================
Install  4 Packages (+9 Dependent packages)

Total download size: 4.2 M
Installed size: 8.0 M
Downloading packages:
--------------------------------------------------------------------------------
Total                                              188 kB/s | 4.2 MB  00:22     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : lzo-2.06-6.el7_0.2.x86_64                                   1/13 
  Installing : libxslt-1.1.28-5.el7.x86_64                                 

. . .

  Installing : unzip-6.0-13.el7.x86_64                                    13/13 
  Verifying  : augeas-1.1.0-12.el7.x86_64                                  1/13 

. . .

  Verifying  : javapackages-tools-3.4.1-6.el7_0.noarch                    13/13 

Installed:
  augeas.x86_64 0:1.1.0-12.el7            bsdtar.x86_64 0:3.1.2-7.el7          
  saxon.noarch 0:9.3.0.4-11.el7           unzip.x86_64 0:6.0-13.el7            

Dependency Installed:
  augeas-libs.x86_64 0:1.1.0-12.el7  bea-stax.noarch 0:1.2.0-9.el7              
  bea-stax-api.noarch 0:1.2.0-9.el7  javapackages-tools.noarch 0:3.4.1-6.el7_0  
  libarchive.x86_64 0:3.1.2-7.el7    libxslt.x86_64 0:1.1.28-5.el7              
  lzo.x86_64 0:2.06-6.el7_0.2        python-javapackages.noarch 0:3.4.1-6.el7_0 
  python-lxml.x86_64 0:3.2.1-4.el7  

Complete!
Loaded plugins: fastestmirror
Cleaning repos: base extras updates
Cleaning up everything
Cleaning up list of fastest mirrors
 ---> 28b11e6151f0
Removing intermediate container d4bd822933c8
Step 4 : RUN groupadd -r jboss -g 1000 && useradd -u 1000 -r -g jboss -m -d /opt/jboss -s /sbin/nologin -c "JBoss user" jboss
 ---> Running in 943c20ba5a51
 ---> 73603eab89b7
Removing intermediate container 943c20ba5a51
Step 5 : WORKDIR /opt/jboss
 ---> Running in 29c865c3109c
 ---> 9a661ae4341b
Removing intermediate container 29c865c3109c
Step 6 : USER jboss
 ---> Running in 7dfd8416ae2c
 ---> 6265153611c7
Removing intermediate container 7dfd8416ae2c
Step 7 : USER root
 ---> Running in a72588fba840
 ---> 12ed28a7acb7
Removing intermediate container a72588fba840
Step 8 : RUN yum -y install java-1.7.0-openjdk-devel && yum clean all
 ---> Running in 4efb3e17eb38
Loaded plugins: fastestmirror
Determining fastest mirrors
 * base: mirror.trouble-free.net
 * extras: centos.mirror.ndchost.com
 * updates: centos-distro.cavecreek.net
Resolving Dependencies
--> Running transaction check
---> Package java-1.7.0-openjdk-devel.x86_64 1:1.7.0.71-2.5.3.1.el7_0 will be installed

. . .

---> Package hwdata.noarch 0:0.252-7.3.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package                      Arch    Version                    Repository
                                                                           Size
================================================================================
Installing:
 java-1.7.0-openjdk-devel     x86_64  1:1.7.0.71-2.5.3.1.el7_0   updates  9.2 M
Installing for dependencies:
 alsa-lib                     x86_64  1.0.27.2-3.el7             base     389 k

. . .

144 k
 xorg-x11-font-utils          x86_64  1:7.5-18.1.el7             base      87 k
 xorg-x11-fonts-Type1         noarch  7.5-9.el7                  base     521 k

Transaction Summary
================================================================================
Install  1 Package (+73 Dependent packages)

Total download size: 49 M
Installed size: 181 M
Downloading packages:
--------------------------------------------------------------------------------
Total                                              1.7 MB/s |  49 MB  00:29     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : freetype-2.4.11-9.el7.x86_64                                1/74 
  Installing : libjpeg-turbo-1.2.90-5.el7.x86_64                           2/74 

. . .

73/74 
  Installing : 1:java-1.7.0-openjdk-devel-1.7.0.71-2.5.3.1.el7_0.x86_64   74/74 
  Verifying  : libsndfile-1.0.25-9.el7.x86_64                              1/74 
  Verifying  : libXfont-1.4.7-2.el7_0.x86_64                               2/74 
  Verifying  : kmod-14-9.el7.x86_64                                        

. . .

73/74 
  Verifying  : gdk-pixbuf2-2.28.2-4.el7.x86_64                            74/74 

Installed:
  java-1.7.0-openjdk-devel.x86_64 1:1.7.0.71-2.5.3.1.el7_0                      

Dependency Installed:
  alsa-lib.x86_64 0:1.0.27.2-3.el7                                              
  atk.x86_64 0:2.8.0-4.el7                                                      

. . .
                                          
  xorg-x11-font-utils.x86_64 1:7.5-18.1.el7                                     
  xorg-x11-fonts-Type1.noarch 0:7.5-9.el7                                       

Complete!
Loaded plugins: fastestmirror
Cleaning repos: base extras updates
Cleaning up everything
Cleaning up list of fastest mirrors
 ---> 44c4bb92fa11
Removing intermediate container 4efb3e17eb38
Step 9 : USER jboss
 ---> Running in 824d62c49182
 ---> 930cb2a860f7
Removing intermediate container 824d62c49182
Step 10 : ENV JAVA_HOME /usr/lib/jvm/java
 ---> Running in f19681365fe5
 ---> fff2c21b0a71
Removing intermediate container f19681365fe5
Step 11 : ENV WILDFLY_VERSION 8.2.0.Final
 ---> Running in cc9d42ece5c1
 ---> b7b7ca7a9172
Removing intermediate container cc9d42ece5c1
Step 12 : RUN cd $HOME && curl -O http://download.jboss.org/wildfly/$WILDFLY_VERSION/wildfly-$WILDFLY_VERSION.zip && unzip wildfly-$WILDFLY_VERSION.zip && mv $HOME/wildfly-$WILDFLY_VERSION $HOME/wildfly && rm wildfly-$WILDFLY_VERSION.zip
 ---> Running in 28e92a1b304f
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  126M  100  126M    0     0   813k      0  0:02:38  0:02:38 --:--:--  644k
Archive:  wildfly-8.2.0.Final.zip
   creating: wildfly-8.2.0.Final/
   creating: wildfly-8.2.0.Final/.installation/
   creating: wildfly-8.2.0.Final/appclient/
   creating: wildfly-8.2.0.Final/appclient/configuration/
   creating: wildfly-8.2.0.Final/bin/

. . .

  inflating: wildfly-8.2.0.Final/domain/configuration/application-users.properties  
  inflating: wildfly-8.2.0.Final/domain/configuration/mgmt-users.properties  
  inflating: wildfly-8.2.0.Final/standalone/configuration/application-users.properties  
  inflating: wildfly-8.2.0.Final/standalone/configuration/mgmt-users.properties  
   creating: wildfly-8.2.0.Final/domain/tmp/auth/
   creating: wildfly-8.2.0.Final/standalone/tmp/auth/
 ---> a1bc79a43c77
Removing intermediate container 28e92a1b304f
Step 13 : ENV JBOSS_HOME /opt/jboss/wildfly
 ---> Running in e3c995170046
 ---> d46fdd618d55
Removing intermediate container e3c995170046
Step 14 : EXPOSE 8080 9990
 ---> Running in d55d6a6f43cf
 ---> 6c17e2cefecf
Removing intermediate container d55d6a6f43cf
Step 15 : CMD /opt/jboss/wildfly/bin/standalone.sh -b 0.0.0.0
 ---> Running in 76e2630d16f5
 ---> 97c8780a7d6a
Removing intermediate container 76e2630d16f5
Successfully built 97c8780a7d6a

The list of Docker images can now be seen as:

wildfly-centos> docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
wildfly-centos      latest              97c8780a7d6a        58 seconds ago      619.6 MB
centos              latest              ae0c2d0bdc10        2 weeks ago         224 MB

The total image size is 619.6 MB. The official WildFly Docker image can be installed as shown:

wildfly-centos> docker pull jboss/wildfly
Pulling repository jboss/wildfly
365390553f92: Download complete 
511136ea3c5a: Download complete 
782cf93a8f16: Download complete 
7d3f07f8de5f: Download complete 
1ef0a50fe8b1: Download complete 
20a1abe1d9bf: Download complete 
cd5bb934bb67: Download complete 
379edb00ab07: Download complete 
4d37cbbfc67d: Download complete 
2ea8562cac7c: Download complete 
7759146eab1a: Download complete 
b17a20d6f5f8: Download complete 
e02bdb6c4ed5: Download complete 
72d585299bb5: Download complete 
90832e1f0bb9: Download complete 
59ec65b61fba: Download complete 
57ada25ecdd0: Download complete 
184d6d02f340: Download complete 
d7fccab36b8f: Download complete 
Status: Downloaded newer image for jboss/wildfly:latest

And the complete list of Docker images can again be seen as:

wildfly-centos> docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
wildfly-centos      latest              97c8780a7d6a        12 minutes ago      619.6 MB
centos              latest              ae0c2d0bdc10        2 weeks ago         224 MB
jboss/wildfly       latest              365390553f92        4 weeks ago         948.7 MB

The image size in this case is 948.7 MB. A detailed understanding of this image is created was explained earlier in this blog.

Ubuntu-based WildFly image can be built and installed as shown below. Note this command is given from the “wildfly-ubuntu” directory of github.com/arun-gupta/docker-images/. And so the Dockerfile is at github.com/arun-gupta/docker-images/blob/master/wildfly-ubuntu/Dockerfile.

wildfly-ubuntu> docker build -t wildfly-ubuntu .
Sending build context to Docker daemon 4.096 kB
Sending build context to Docker daemon 
Step 0 : FROM ubuntu
ubuntu:latest: The image you are pulling has been verified
d497ad3926c8: Pull complete 
ccb62158e970: Pull complete 
e791be0477f2: Pull complete 
3680052c0f5c: Pull complete 
22093c35d77b: Pull complete 
5506de2b643b: Pull complete 
511136ea3c5a: Already exists 
Status: Downloaded newer image for ubuntu:latest
 ---> 5506de2b643b
Step 1 : MAINTAINER Arun Gupta <[email protected]>
 ---> Running in cc444b436b26
 ---> 9df66d33d676
Removing intermediate container cc444b436b26
Step 2 : RUN apt-get update
 ---> Running in 3dc63c0f708a
Ign http://archive.ubuntu.com trusty InRelease
Ign http://archive.ubuntu.com trusty-updates InRelease
Ign http://archive.ubuntu.com trusty-security InRelease
Ign http://archive.ubuntu.com trusty-proposed InRelease
Get:1 http://archive.ubuntu.com trusty Release.gpg [933 B]
Get:2 http://archive.ubuntu.com trusty-updates Release.gpg [933 B]
Get:3 http://archive.ubuntu.com trusty-security Release.gpg [933 B]
Get:4 http://archive.ubuntu.com trusty-proposed Release.gpg [933 B]
Get:5 http://archive.ubuntu.com trusty Release [58.5 kB]
Get:6 http://archive.ubuntu.com trusty-updates Release [62.0 kB]
Get:7 http://archive.ubuntu.com trusty-security Release [62.0 kB]
Get:8 http://archive.ubuntu.com trusty-proposed Release [209 kB]
Get:9 http://archive.ubuntu.com trusty/main Sources [1335 kB]
Get:10 http://archive.ubuntu.com trusty/restricted Sources [5335 B]
Get:11 http://archive.ubuntu.com trusty/universe Sources [7926 kB]
Get:12 http://archive.ubuntu.com trusty/main amd64 Packages [1743 kB]
Get:13 http://archive.ubuntu.com trusty/restricted amd64 Packages [16.0 kB]
Get:14 http://archive.ubuntu.com trusty/universe amd64 Packages [7589 kB]
Get:15 http://archive.ubuntu.com trusty-updates/main Sources [179 kB]
Get:16 http://archive.ubuntu.com trusty-updates/restricted Sources [1250 B]
Get:17 http://archive.ubuntu.com trusty-updates/universe Sources [114 kB]
Get:18 http://archive.ubuntu.com trusty-updates/main amd64 Packages [465 kB]
Get:19 http://archive.ubuntu.com trusty-updates/restricted amd64 Packages [6341 B]
Get:20 http://archive.ubuntu.com trusty-updates/universe amd64 Packages [286 kB]
Get:21 http://archive.ubuntu.com trusty-security/main Sources [62.7 kB]
Get:22 http://archive.ubuntu.com trusty-security/restricted Sources [40 B]
Get:23 http://archive.ubuntu.com trusty-security/universe Sources [19.1 kB]
Get:24 http://archive.ubuntu.com trusty-security/main amd64 Packages [205 kB]
Get:25 http://archive.ubuntu.com trusty-security/restricted amd64 Packages [40 B]
Get:26 http://archive.ubuntu.com trusty-security/universe amd64 Packages [93.4 kB]
Get:27 http://archive.ubuntu.com trusty-proposed/main amd64 Packages [193 kB]
Get:28 http://archive.ubuntu.com trusty-proposed/restricted amd64 Packages [40 B]
Fetched 20.6 MB in 43s (469 kB/s)
Reading package lists...
 ---> 7fcaaf17b124
Removing intermediate container 3dc63c0f708a
Step 3 : RUN apt-get -y install xmlstarlet bsdtar unzip curl
 ---> Running in 81613b0e3b71
Reading package lists...
Building dependency tree...
Reading state information...
The following extra packages will be installed:
  ca-certificates krb5-locales libarchive13 libasn1-8-heimdal libcurl3
  libgssapi-krb5-2 libgssapi3-heimdal libhcrypto4-heimdal libheimbase1-heimdal

. . .

Updating certificates in /etc/ssl/certs... 164 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d....done.
Processing triggers for sgml-base (1.26+nmu4ubuntu1) ...
 ---> 0d897d545547
Removing intermediate container 81613b0e3b71
Step 4 : RUN groupadd -r jboss -g 1000 && useradd -u 1000 -r -g jboss -m -d /opt/jboss -s /sbin/nologin -c "JBoss user" jboss
 ---> Running in bf31e0e1f448
 ---> 7494e71043c0
Removing intermediate container bf31e0e1f448
Step 5 : WORKDIR /opt/jboss
 ---> Running in 1ac355c74395
 ---> abbbb6aa6b71
Removing intermediate container 1ac355c74395
Step 6 : USER jboss
 ---> Running in a656007f6e6b
 ---> 657671b82d0f
Removing intermediate container a656007f6e6b
Step 7 : USER root
 ---> Running in f53138927d04
 ---> d3bd53152a51
Removing intermediate container f53138927d04
Step 8 : RUN apt-get -y install openjdk-7-jdk
 ---> Running in 1076b257c6f6
Reading package lists...
Building dependency tree...
Reading state information...
The following extra packages will be installed:
  acl at-spi2-core ca-certificates ca-certificates-java colord cpp cpp-4.8
  dbus dbus-x11 dconf-gsettings-backend dconf-service desktop-file-utils

. . .

Adding debian:Wells_Fargo_Root_CA.pem
Adding debian:XRamp_Global_CA_Root.pem
Adding debian:certSIGN_ROOT_CA.pem
Adding debian:ePKI_Root_Certification_Authority.pem
Adding debian:thawte_Primary_Root_CA.pem
Adding debian:thawte_Primary_Root_CA_-_G2.pem
Adding debian:thawte_Primary_Root_CA_-_G3.pem
Adding debian:spi-cacert-2008.pem
done.
done.
 ---> 558f23c93a8c
Removing intermediate container 1076b257c6f6
Step 9 : USER jboss
 ---> Running in 9d6955bcd19f
 ---> 7f16c426ccaf
Removing intermediate container 9d6955bcd19f
Step 10 : ENV JAVA_HOME /usr/lib/jvm/java-7-openjdk-amd64
 ---> Running in 66f22bd0de95
 ---> 6304f386c946
Removing intermediate container 66f22bd0de95
Step 11 : ENV WILDFLY_VERSION 8.2.0.Final
 ---> Running in 784e1533fa09
 ---> 1a5e1aeadc85
Removing intermediate container 784e1533fa09
Step 12 : RUN cd $HOME && curl -O http://download.jboss.org/wildfly/$WILDFLY_VERSION/wildfly-$WILDFLY_VERSION.zip && unzip wildfly-$WILDFLY_VERSION.zip && mv $HOME/wildfly-$WILDFLY_VERSION $HOME/wildfly && rm wildfly-$WILDFLY_VERSION.zip
 ---> Running in c7d808526af6
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  126M  100  126M    0     0   993k      0  0:02:09  0:02:09 --:--:--  870k
Archive:  wildfly-8.2.0.Final.zip
   creating: wildfly-8.2.0.Final/

. . .

  inflating: wildfly-8.2.0.Final/standalone/configuration/mgmt-users.properties  
   creating: wildfly-8.2.0.Final/domain/tmp/auth/
   creating: wildfly-8.2.0.Final/standalone/tmp/auth/
 ---> 551e8b1db275
Removing intermediate container c7d808526af6
Step 13 : ENV JBOSS_HOME /opt/jboss/wildfly
 ---> Running in 7709c6f468ef
 ---> 0cec4b9ccd6b
Removing intermediate container 7709c6f468ef
Step 14 : EXPOSE 8080 9990
 ---> Running in dd053271b09e
 ---> 0281986b0ed8
Removing intermediate container dd053271b09e
Step 15 : CMD /opt/jboss/wildfly/bin/standalone.sh -b 0.0.0.0
 ---> Running in fb29091de599
 ---> 6a1c4acf3f78
Removing intermediate container fb29091de599
Successfully built 6a1c4acf3f78

The list of Docker images can once again be seen as:

wildfly-ubuntu> docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
wildfly-ubuntu      latest              6a1c4acf3f78        5 minutes ago       749.5 MB
<none>              <none>              1a5e1aeadc85        13 minutes ago      607.7 MB
wildfly-centos      latest              97c8780a7d6a        About an hour ago   619.6 MB
centos              latest              ae0c2d0bdc10        2 weeks ago         224 MB
jboss/wildfly       latest              365390553f92        4 weeks ago         948.7 MB
ubuntu              latest              5506de2b643b        4 weeks ago         199.3 MB

Docker image can run with docker run command. Some other related commands are:

  • docker ps: Lists containers
  • docker stop <id>: Stops the container with the given <id>

Run CentOS image as shown below. Specifying -i option will make it interactive and -t option allocates a pseudo-TTY. And port 8080 from the container is made accessible on port 80 of the container.

~> docker run -i -t -p 80:8080 wildfly-centos
=========================================================================

  JBoss Bootstrap Environment

  JBOSS_HOME: /opt/jboss/wildfly

  JAVA: /usr/lib/jvm/java/bin/java

  JAVA_OPTS:  -server -Xms64m -Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true

=========================================================================

22:20:52,769 INFO  [org.jboss.modules] (main) JBoss Modules version 1.3.3.Final
22:20:53,038 INFO  [org.jboss.msc] (main) JBoss MSC version 1.2.2.Final
22:20:53,120 INFO  [org.jboss.as] (MSC service thread 1-7) JBAS015899: WildFly 8.2.0.Final "Tweek" starting
22:20:54,176 INFO  [org.jboss.as.server] (Controller Boot Thread) JBAS015888: Creating http management service using socket-binding (management-http)
22:20:54,197 INFO  [org.xnio] (MSC service thread 1-10) XNIO version 3.3.0.Final
22:20:54,206 INFO  [org.xnio.nio] (MSC service thread 1-10) XNIO NIO Implementation Version 3.3.0.Final
22:20:54,239 INFO  [org.wildfly.extension.io] (ServerService Thread Pool -- 31) WFLYIO001: Worker 'default' has auto-configured to 16 core threads with 128 task threads based on your 8 available processors
22:20:54,265 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 32) JBAS010280: Activating Infinispan subsystem.
22:20:54,302 INFO  [org.jboss.as.security] (ServerService Thread Pool -- 45) JBAS013171: Activating Security Subsystem
22:20:54,314 WARN  [org.jboss.as.txn] (ServerService Thread Pool -- 46) JBAS010153: Node identifier property is set to the default value. Please make sure it is unique.
22:20:54,345 INFO  [org.jboss.as.jsf] (ServerService Thread Pool -- 38) JBAS012615: Activated the following JSF Implementations: [main]
22:20:54,363 INFO  [org.jboss.as.naming] (ServerService Thread Pool -- 40) JBAS011800: Activating Naming Subsystem
22:20:54,374 INFO  [org.jboss.as.security] (MSC service thread 1-8) JBAS013170: Current PicketBox version=4.0.21.Final
22:20:54,419 INFO  [org.jboss.as.webservices] (ServerService Thread Pool -- 48) JBAS015537: Activating WebServices Extension
22:20:54,486 INFO  [org.jboss.as.connector.logging] (MSC service thread 1-7) JBAS010408: Starting JCA Subsystem (IronJacamar 1.1.9.Final)
22:20:54,573 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-7) JBAS017502: Undertow 1.1.0.Final starting
22:20:54,579 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 47) JBAS017502: Undertow 1.1.0.Final starting
22:20:54,586 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
22:20:54,644 INFO  [org.jboss.remoting] (MSC service thread 1-10) JBoss Remoting version 4.0.6.Final
22:20:54,658 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-1) JBAS010417: Started Driver service with driver-name = h2
22:20:54,763 INFO  [org.jboss.as.naming] (MSC service thread 1-1) JBAS011802: Starting Naming Service
22:20:54,761 INFO  [org.jboss.as.mail.extension] (MSC service thread 1-16) JBAS015400: Bound mail session [java:jboss/mail/Default]
22:20:56,387 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 47) JBAS017527: Creating file handler for path /opt/jboss/wildfly/welcome-content
22:20:56,422 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-10) JBAS017525: Started server default-server.
22:20:56,544 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-2) JBAS017531: Host default-host starting
22:20:56,712 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-10) JBAS017519: Undertow HTTP listener default listening on /0.0.0.0:8080
22:20:56,975 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-14) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]
22:20:56,976 INFO  [org.jboss.as.server.deployment.scanner] (MSC service thread 1-15) JBAS015012: Started FileSystemDeploymentService for directory /opt/jboss/wildfly/standalone/deployments
22:20:57,172 INFO  [org.jboss.ws.common.management] (MSC service thread 1-10) JBWS022052: Starting JBoss Web Services - Stack CXF Server 4.3.2.Final
22:20:57,239 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015961: Http management interface listening on http://127.0.0.1:9990/management
22:20:57,240 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://127.0.0.1:9990
22:20:57,241 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015874: WildFly 8.2.0.Final "Tweek" started in 4836ms - Started 184 of 234 services (82 services are lazy, passive or on-demand)

In a different shell, get the container’s IP address as:

~> boot2docker ip

The VM's Host only interface IP address is: 192.168.59.103

And then access WildFly at http://192.168.59.103.

Similarly, running the WildFly Ubuntu image shows:

wildfly-ubuntu> docker run -i -t -p 80:8080 wildfly-ubuntu
=========================================================================

  JBoss Bootstrap Environment

  JBOSS_HOME: /opt/jboss/wildfly

  JAVA: /usr/lib/jvm/java-7-openjdk-amd64/bin/java

  JAVA_OPTS:  -server -Xms64m -Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true

=========================================================================

22:34:07,612 INFO  [org.jboss.modules] (main) JBoss Modules version 1.3.3.Final
22:34:07,911 INFO  [org.jboss.msc] (main) JBoss MSC version 1.2.2.Final
22:34:07,996 INFO  [org.jboss.as] (MSC service thread 1-7) JBAS015899: WildFly 8.2.0.Final "Tweek" starting
22:34:09,076 INFO  [org.jboss.as.server] (Controller Boot Thread) JBAS015888: Creating http management service using socket-binding (management-http)
22:34:09,097 INFO  [org.xnio] (MSC service thread 1-9) XNIO version 3.3.0.Final
22:34:09,106 INFO  [org.xnio.nio] (MSC service thread 1-9) XNIO NIO Implementation Version 3.3.0.Final
22:34:09,136 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 32) JBAS010280: Activating Infinispan subsystem.
22:34:09,170 INFO  [org.jboss.as.security] (ServerService Thread Pool -- 45) JBAS013171: Activating Security Subsystem
22:34:09,180 WARN  [org.jboss.as.txn] (ServerService Thread Pool -- 46) JBAS010153: Node identifier property is set to the default value. Please make sure it is unique.
22:34:09,191 INFO  [org.jboss.as.jsf] (ServerService Thread Pool -- 38) JBAS012615: Activated the following JSF Implementations: [main]
22:34:09,207 INFO  [org.jboss.as.naming] (ServerService Thread Pool -- 40) JBAS011800: Activating Naming Subsystem
22:34:09,212 INFO  [org.jboss.as.security] (MSC service thread 1-2) JBAS013170: Current PicketBox version=4.0.21.Final
22:34:09,230 INFO  [org.jboss.as.webservices] (ServerService Thread Pool -- 48) JBAS015537: Activating WebServices Extension
22:34:09,317 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-6) JBAS017502: Undertow 1.1.0.Final starting
22:34:09,317 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 47) JBAS017502: Undertow 1.1.0.Final starting
22:34:09,323 INFO  [org.wildfly.extension.io] (ServerService Thread Pool -- 31) WFLYIO001: Worker 'default' has auto-configured to 16 core threads with 128 task threads based on your 8 available processors
22:34:09,413 INFO  [org.jboss.as.connector.logging] (MSC service thread 1-15) JBAS010408: Starting JCA Subsystem (IronJacamar 1.1.9.Final)
22:34:09,617 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
22:34:09,658 INFO  [org.jboss.as.naming] (MSC service thread 1-10) JBAS011802: Starting Naming Service
22:34:09,674 INFO  [org.jboss.as.mail.extension] (MSC service thread 1-1) JBAS015400: Bound mail session [java:jboss/mail/Default]
22:34:09,692 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-12) JBAS010417: Started Driver service with driver-name = h2
22:34:09,693 INFO  [org.jboss.remoting] (MSC service thread 1-9) JBoss Remoting version 4.0.6.Final
22:34:11,117 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 47) JBAS017527: Creating file handler for path /opt/jboss/wildfly/welcome-content
22:34:11,134 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-5) JBAS017525: Started server default-server.
22:34:11,206 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-14) JBAS017531: Host default-host starting
22:34:11,377 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-5) JBAS017519: Undertow HTTP listener default listening on /0.0.0.0:8080
22:34:11,576 INFO  [org.jboss.as.server.deployment.scanner] (MSC service thread 1-2) JBAS015012: Started FileSystemDeploymentService for directory /opt/jboss/wildfly/standalone/deployments
22:34:11,627 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-8) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]
22:34:11,847 INFO  [org.jboss.ws.common.management] (MSC service thread 1-6) JBWS022052: Starting JBoss Web Services - Stack CXF Server 4.3.2.Final
22:34:11,911 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015961: Http management interface listening on http://127.0.0.1:9990/management
22:34:11,912 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://127.0.0.1:9990
22:34:11,912 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015874: WildFly 8.2.0.Final "Tweek" started in 4762ms - Started 184 of 234 services (82 services are lazy, passive or on-demand)

You can login to the host VM as shown:

boot2docker ssh

Different layers of the image are stored in /var/lib/docker directory as shown:

docker-images> boot2docker ssh
                        ##        .
                  ## ## ##       ==
               ## ## ## ##      ===
           /""""""""""""""""\___/ ===
      ~~~ {~~ ~~~~ ~~~ ~~~~ ~~ ~ /  ===- ~~~
           \______ o          __/
             \    \        __/
              \____\______/
 _                 _   ____     _            _
| |__   ___   ___ | |_|___ \ __| | ___   ___| | _____ _ __
| '_ \ / _ \ / _ \| __| __) / _` |/ _ \ / __| |/ / _ \ '__|
| |_) | (_) | (_) | |_ / __/ (_| | (_) | (__|   <  __/ |
|_.__/ \___/ \___/ \__|_____\__,_|\___/ \___|_|\_\___|_|
Boot2Docker version 1.3.2, build master : 495c19a - Mon Nov 24 20:40:58 UTC 2014
Docker version 1.3.2, build 39fa2fa
docker@boot2docker:~$ cd /var/lib/docker/
docker@boot2docker:/mnt/sda1/var/lib/docker$ ls -la
total 64
drwxr-xr-x   10 root     root          4096 Nov 24 23:33 ./
drwxr-xr-x    4 root     root          4096 Nov 24 19:15 ../
drwxr-xr-x    5 root     root          4096 Nov 24 19:16 aufs/
drwx------   17 root     root          4096 Nov 24 23:33 containers/
drwx------    3 root     root          4096 Nov 24 19:16 execdriver/
drwx------   84 root     root         12288 Nov 24 23:28 graph/
drwx------    2 root     root          4096 Nov 25 14:50 init/
-rw-r--r--    1 root     root         11264 Nov 24 23:33 linkgraph.db
-rw-------    1 root     root           565 Nov 24 23:28 repositories-aufs
drwx------    2 root     root          4096 Nov 24 23:28 tmp/
drwx------    2 root     root          4096 Nov 24 19:21 trust/
drwx------    2 root     root          4096 Nov 24 19:16 volumes/

VM image on Mac OSX is stored in ~/VirtualBox VMs/boot2docker-vm directory. This directory can grow up rather quickly if the intermediate containers are not removed. boot2docker-vm.vmdk on my machine is ~5GB for these different images.

You can reset it by running the following commands (WARNING: This will destroy all images you’ve downloaded and built so far):

boot2docker down
boot2docker destroy
boot2docker init
boot2docker up

Containers, as you can imagine, have a memory foot print.

More Docker goodness is coming in subsequent blogs!

Deployment Pipeline for Java EE 7 with WildFly, Arquillian, Jenkins, and OpenShift (Tech Tip #56)

Tech Tip #54 showed how to Arquillianate (Arquillianize ?) an existing Java EE project and run those tests in remote mode where WildFly is running on a known host and port. Tech Tip #55 showed how to run those tests when WildFly is running in OpenShift. Both of these tips used Maven profiles to separate the appropriate Arquillian dependencies in “pom.xml” and <container> configuration in “arquillian.xml” to define where WildFy is running and how to connect to it.

This tip will show how to configure Jenkins in OpenShift and invoke these tests from Jenkins. This will create deployment pipeline for Java EE.

Lets see it in action first!

Configuration required to connect from Jenkins on OpenShift to a WildFly instance on OpenShift is similar to that required for  connecting from local machine to WildFly on OpenShift. This configuration is specified in “arquillian.xml” and we can specify some parameters which can then be defined in Jenkins.

On a high level, here is what we’ll do:

  • Use the code created in Tech Tip #54 and #55 and add configuration for Arquillian/Jenkins/OpenShift
  • Enable Jenkins
  • Create a new WildFly Test instance
  • Configure Jenkins to run tests on the Test instance
  • Push the application to Production only if tests pass on Test instance

Lets get started!

  1. Remove the existing boilerplate source code, only the src directory, from the WildFly git repo created in Tech Tip #55.
    mywildfly> git rm -rf src/ pom.xml
    rm 'pom.xml'
    rm 'src/main/java/.gitkeep'
    rm 'src/main/resources/.gitkeep'
    rm 'src/main/webapp/WEB-INF/web.xml'
    rm 'src/main/webapp/images/jbosscorp_logo.png'
    rm 'src/main/webapp/index.html'
    rm 'src/main/webapp/snoop.jsp'
    mywildfly> git commit . -m"removing source and pom"
    [master 564b275] removing source and pom
     7 files changed, 647 deletions(-)
     delete mode 100644 pom.xml
     delete mode 100644 src/main/java/.gitkeep
     delete mode 100644 src/main/resources/.gitkeep
     delete mode 100644 src/main/webapp/WEB-INF/web.xml
     delete mode 100644 src/main/webapp/images/jbosscorp_logo.png
     delete mode 100644 src/main/webapp/index.html
     delete mode 100644 src/main/webapp/snoop.jsp
  2. Set a new remote to javaee7-continuous-delivery repository:
    mywildfly> git remote add javaee7 https://github.com/arun-gupta/javaee7-continuous-delivery.git
    mywildfly> git remote -v
    javaee7 https://github.com/arun-gupta/javaee7-continuous-delivery.git (fetch)
    javaee7 https://github.com/arun-gupta/javaee7-continuous-delivery.git (push)
    origin  ssh://[email protected]/~/git/mywildfly.git/ (fetch)
    origin  ssh://[email protected]/~/git/mywildfly.git/ (push)
  3. Pull the code from new remote:
    mywildfly> git pull javaee7 master
    warning: no common commits
    remote: Counting objects: 62, done.
    remote: Compressing objects: 100% (45/45), done.
    remote: Total 62 (delta 14), reused 53 (delta 5)
    Unpacking objects: 100% (62/62), done.
    From https://github.com/arun-gupta/javaee7-continuous-delivery
     * branch            master     -> FETCH_HEAD
     * [new branch]      master     -> javaee7/master
    Merge made by the 'recursive' strategy.
     .gitignore                                           |   6 +++
     README.asciidoc                                      |  15 ++++++
     pom.xml                                              | 197 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
     src/main/java/org/javaee7/sample/MyApplication.java  |   9 ++++
     src/main/java/org/javaee7/sample/Person.java         |  31 ++++++++++++
     src/main/java/org/javaee7/sample/PersonDatabase.java |  39 ++++++++++++++
     src/main/java/org/javaee7/sample/PersonResource.java |  29 +++++++++++
     src/main/webapp/index.jsp                            |  13 +++++
     src/test/java/org/javaee7/sample/PersonTest.java     |  77 ++++++++++++++++++++++++++++
     src/test/resources/arquillian.xml                    |  26 ++++++++++
     10 files changed, 442 insertions(+)
     create mode 100644 .gitignore
     create mode 100644 README.asciidoc
     create mode 100644 pom.xml
     create mode 100644 src/main/java/org/javaee7/sample/MyApplication.java
     create mode 100644 src/main/java/org/javaee7/sample/Person.java
     create mode 100644 src/main/java/org/javaee7/sample/PersonDatabase.java
     create mode 100644 src/main/java/org/javaee7/sample/PersonResource.java
     create mode 100644 src/main/webapp/index.jsp
     create mode 100644 src/test/java/org/javaee7/sample/PersonTest.java
     create mode 100644 src/test/resources/arquillian.xml

    This will bring all the source code, include our REST endpoints, web pages, tests, updated “pom.xml” and “arquillian.xml”. The updated “pom.xml” has two new profiles.

    <profile>
     <id>openshift</id>
     <build>
        <plugins>
          <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.3</version>
                <configuration>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                    <outputDirectory>deployments</outputDirectory>
                          <warName>ROOT</warName>
                </configuration>
            </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
        <id>jenkins-openshift</id>
        <build>
            <plugins>
                <plugin>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.14.1</version>
                    <configuration>
                        <systemPropertyVariables>
                            <arquillian.launch>jenkins-openshift</arquillian.launch>
                        </systemPropertyVariables>
                    </configuration>
                </plugin>
            </plugins>
        </build>
        <dependencies>
            <dependency>
                <groupId>org.jboss.arquillian.container</groupId>
                <artifactId>arquillian-openshift</artifactId>
                <version>1.0.0.Final-SNAPSHOT</version>
                <scope>test</scope>
            </dependency>
        </dependencies>
    </profile>

    Few points to observe here:

    1. “openshift” profile is used when building an application on OpenShift. This is where the application’s WAR file is created and deployed to WildFly.
    2. A new profile “jenkins-openshift” is added that will be used by the Jenkins instance (to be enabled shortly) in OpenShift to run tests.
    3. “arquillian-openshift” dependency is the same as used in Tech Tip #55 and allows to run Arquillian tests on a WildFly instance on OpenShift.
    4. This profile refers to “jenkins-openshift” container configuration that will be defined in “arquillian.xml”.

    Updated “src/test/resources/arquillian.xml” has the following container:

    <container qualifier="jenkins-openshift">
        <configuration>
            <property name="namespace">${env.ARQ_DOMAIN}</property>
            <property name="application">${env.ARQ_APPLICATION}</property>
            <property name="libraDomain">rhcloud.com</property>
            <property name="sshUserName">${env.ARQ_SSH_USER_NAME}</property>
            <property name="login">[email protected]</property>
            <property name="deploymentTimeoutInSeconds">300</property>
            <property name="disableStrictHostChecking">true</property> 
        </configuration>
    </container>
    

    This container configuration is similar to the one that was added in Tech Tip #55. The only difference here is that the domain name, application name, and the SSH user name are parametrized. The value of these properties is defined in the configuration of Jenkins instance and allows to run the test against a separate test node.

  4. Two more things need to be done before changes can be pushed to the remote repository. First is to create a WildFly Test instance which can be used to run the tests. This can be easily done as shown:
    workspaces> rhc app-create mywildflytest jboss-wildfly-8
    Application Options
    -------------------
    Domain:     milestogo
    Cartridges: jboss-wildfly-8
    Gear Size:  default
    Scaling:    no
    
    Creating application 'mywildflytest' ... Artifacts deployed: ./ROOT.war
    done
    
      WildFly 8 administrator added.  Please make note of these credentials:
    
       Username: adminITJt7Yh
       Password: yXP2mUd1w4_8
       
       run 'rhc port-forward mywildflytest' to access the web admin area on port 9990.
    
    Waiting for your DNS name to be available ... done
    
    Cloning into 'mywildflytest'...
    Warning: Permanently added the RSA host key for IP address '54.205.69.88' to the list of known hosts.
    
    Your application 'mywildflytest' is now available.
    
      URL:        http://mywildflytest-milestogo.rhcloud.com/
      SSH to:     [email protected]
      Git remote: ssh://[email protected]/~/git/mywildflytest.git/
      Cloned to:  /Users/arungupta/workspaces/javaee7/mywildflytest
    
    Run 'rhc show-app mywildflytest' for more details about your app.

    Note the domain here is milestogo, application name is mywildflytest, and SSH user name is 546e3743ecb8d49ca9000014. These will be passed to Arquillian for running the tests.

  5. Second is to enable and configure Jenkins.In your OpenShift Console, pick the “mywildfly” application and click on “Enable Jenkins” link as shown below:techtip56-enable-jenkinsRemember this is not your Test instance because all the source code lives on the instance created earlier.Provide the appropriate name, e.g. jenkins-milestogo.rhcloud.com in my case, and click on “Add Jenkins” button. This will provision a Jenkins instance, if not already there and also configure the project with a script to build and deploy the application. Note down the name and password credentials.
  6. Use the credentials to login to your Jenkins instance.Select the appropriate build, “mywildfly-build” in this case. Scroll down to the “Build” section and add the following script right after “# Run tests here” in the Execute Shell:
    export ARQ_DOMAIN=milestogo
    export ARQ_SSH_USER_NAME=546e3743ecb8d49ca9000014
    export ARQ_APPLICATION=mywildflytest
    mvn test -Pjenkins-openshift

    Click on “Save” to save the configuration. This will allow to run the Arquillian tests on the Test instance. If the tests pass then the app is deployed. If the tests fail, then none of the steps after that step are executed and so the app is not deployed.

  7. Lets push the changes to remote repo now:
    mywildfly> git push
    Counting objects: 68, done.
    Delta compression using up to 8 threads.
    Compressing objects: 100% (49/49), done.
    Writing objects: 100% (61/61), 8.85 KiB | 0 bytes/s, done.
    Total 61 (delta 14), reused 0 (delta 0)
    remote: Executing Jenkins build.
    remote: 
    remote: You can track your build at https://jenkins-milestogo.rhcloud.com/job/mywildfly-build
    remote: 
    remote: Waiting for build to schedule............................................................................................Done
    remote: Waiting for job to complete................................................................................................................................................................................................................................................................................................................................................................................................Done
    remote: SUCCESS
    remote: New build has been deployed.
    remote: -------------------------
    remote: Git Post-Receive Result: success
    remote: Deployment completed with status: success
    To ssh://[email protected]/~/git/mywildfly.git/
       e8f6c61..e9ad206  master -> master

    The number of dots indicate the wait for a particular task and will most likely vary for different runs.  And Jenkins console (jenkins-milestogo.rhcloud.com/job/mywildfly-build/1/console) shows the output as:

    -------------------------------------------------------
     T E S T S
    -------------------------------------------------------
    Running org.javaee7.sample.PersonTest
    Nov 20, 2014 2:54:56 PM org.jboss.arquillian.container.openshift.OpenShiftContainer start
    INFO: Preparing Arquillian OpenShift container at http://mywildflytest-milestogo.rhcloud.com
    Nov 20, 2014 2:55:48 PM org.jboss.arquillian.container.openshift.OpenShiftRepository push
    INFO: Pushed to the remote repository ssh://[email protected]/~/git/mywildflytest.git/
    Nov 20, 2014 2:56:37 PM org.jboss.arquillian.container.openshift.OpenShiftRepository push
    INFO: Pushed to the remote repository ssh://[email protected]/~/git/mywildflytest.git/
    Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 103.056 sec
    Nov 20, 2014 2:56:37 PM org.jboss.arquillian.container.openshift.OpenShiftContainer stop
    INFO: Shutting down Arquillian OpenShift container at http://mywildflytest-milestogo.rhcloud.com
    Results :
    
    Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
    
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 3:13.069s
    [INFO] Finished at: Thu Nov 20 14:57:34 EST 2014
    [INFO] Final Memory: 10M/101M
    [INFO] ------------------------------------------------------------------------
    + /usr/libexec/openshift/cartridges/jenkins/bin/git_ssh_wrapper.sh [email protected] 'gear stop --conditional'
    Warning: Permanently added 'mywildfly-milestogo.rhcloud.com,10.5.171.43' (RSA) to the list of known hosts.
    Stopping gear...
    Stopping wildfly cart
    Sending SIGTERM to wildfly:418673 ...
    + rsync --delete-after -azO -e /usr/libexec/openshift/cartridges/jenkins/bin/git_ssh_wrapper.sh /var/lib/openshift/546e46304382ec3f29000012//.m2/ '[email protected]:~/.m2/'
    Warning: Permanently added 'mywildfly-milestogo.rhcloud.com,10.5.171.43' (RSA) to the list of known hosts.
    + rsync --delete-after -azO -e /usr/libexec/openshift/cartridges/jenkins/bin/git_ssh_wrapper.sh /var/lib/openshift/546e46304382ec3f29000012/app-root/runtime/repo/deployments/ '[email protected]:${OPENSHIFT_REPO_DIR}deployments/'
    Warning: Permanently added 'mywildfly-milestogo.rhcloud.com,10.5.171.43' (RSA) to the list of known hosts.
    + rsync --delete-after -azO -e /usr/libexec/openshift/cartridges/jenkins/bin/git_ssh_wrapper.sh /var/lib/openshift/546e46304382ec3f29000012/app-root/runtime/repo/.openshift/ '[email protected]:${OPENSHIFT_REPO_DIR}.openshift/'
    Warning: Permanently added 'mywildfly-milestogo.rhcloud.com,10.5.171.43' (RSA) to the list of known hosts.
    + /usr/libexec/openshift/cartridges/jenkins/bin/git_ssh_wrapper.sh [email protected] 'gear remotedeploy'
    Warning: Permanently added 'mywildfly-milestogo.rhcloud.com,10.5.171.43' (RSA) to the list of known hosts.
    Preparing build for deployment
    Deployment id is dff28e58
    Activating deployment
    Deploying WildFly
    Starting wildfly cart
    Found 127.12.255.129:8080 listening port
    Found 127.12.255.129:9990 listening port
    /var/lib/openshift/546e36e5e0b8cd4e2a000007/wildfly/standalone/deployments /var/lib/openshift/546e36e5e0b8cd4e2a000007/wildfly
    /var/lib/openshift/546e36e5e0b8cd4e2a000007/wildfly
    CLIENT_MESSAGE: Artifacts deployed: ./ROOT.war
    Archiving artifacts
    Finished: SUCCESS

    Log files for Jenkins can be viewed as shown:

    Nov 20, 2014 2:51:11 PM hudson.plugins.openshift.OpenShiftCloud provision
    INFO: Provisioning new node for workload = 2 and label = mywildfly-build in domain milestogo
    Nov 20, 2014 2:51:11 PM hudson.plugins.openshift.OpenShiftCloud getOpenShiftConnection
    INFO: Initiating Java Client Service - Configured for OpenShift Server https://openshift.redhat.com
    Nov 20, 2014 2:51:11 PM com.openshift.internal.client.RestService request
    INFO: Requesting GET with protocol 1.2 on https://openshift.redhat.com/broker/rest/api
    Nov 20, 2014 2:51:11 PM com.openshift.internal.client.RestService request
    INFO: Requesting GET with protocol 1.2 on https://openshift.redhat.com/broker/rest/user
    Nov 20, 2014 2:51:11 PM com.openshift.internal.client.RestService request
    
    . . .
    
    INFO: Checking availability of computer hudson.plugins.openshift.OpenShiftSlave@8ce21115
    Nov 20, 2014 2:53:35 PM com.openshift.internal.client.RestService request
    INFO: Requesting GET with protocol 1.2 on https://openshift.redhat.com/broker/rest/domain/milestogo/application/mywildflybldr/gear_groups
    Nov 20, 2014 2:53:35 PM hudson.plugins.openshift.OpenShiftComputerLauncher launch
    INFO: Checking SSH access to application mywildflybldr-milestogo.rhcloud.com
    Nov 20, 2014 2:53:35 PM hudson.plugins.openshift.OpenShiftComputerLauncher launch
    INFO: Connecting via SSH '546e46304382ec3f29000012' 'mywildflybldr-milestogo.rhcloud.com' '/var/lib/openshift/546e393e5973ca0492000070/app-root/data/.ssh/jenkins_id_rsa'
    Nov 20, 2014 2:53:35 PM hudson.slaves.NodeProvisioner update
    INFO: mywildfly-build provisioningE successfully completed. We have now 2 computer(s)
    Nov 20, 2014 2:53:35 PM hudson.plugins.openshift.OpenShiftComputerLauncher launch
    INFO: Connected via SSH.
    Nov 20, 2014 2:53:35 PM hudson.plugins.openshift.OpenShiftComputerLauncher launch
    INFO: Exec mkdir -p $OPENSHIFT_DATA_DIR/jenkins && cd $OPENSHIFT_DATA_DIR/jenkins && rm -f slave.jar && wget -q --no-check-certificate https://jenkins-milestogo.rhcloud.com/jnlpJars/slave.jar
    Nov 20, 2014 2:53:42 PM hudson.plugins.openshift.OpenShiftComputerLauncher launch
    INFO: Slave connected.
    Nov 20, 2014 2:58:24 PM hudson.model.Run execute
    INFO: mywildfly-build #1 main build action completed: SUCCESS

    This shows the application was successfully deployed at mywildfly-milestogo.rhcloud.com/index.jsp and looks like as shown:

    techtip56-mywildfly-output-tests-passing

Now change “src/main/webapp/index.jsp” to show a different heading. And change  “src/test/java/org/javaee7/sample/PersonTest.java” to make one of the tests fail. Doing “git commit” and “git push” shows the following results on command line:

mywildfly> git commit . -m"breaking the test"
[master ff2de09] breaking the test
 2 files changed, 2 insertions(+), 2 deletions(-)
mywildfly> git push
Counting objects: 23, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (8/8), done.
Writing objects: 100% (12/12), 771 bytes | 0 bytes/s, done.
Total 12 (delta 5), reused 0 (delta 0)
remote: Executing Jenkins build.
remote: 
remote: You can track your build at https://jenkins-milestogo.rhcloud.com/job/mywildfly-build
remote: 
remote: Waiting for build to schedule.......Done
remote: Waiting for job to complete.....................................................................................................................................................................Done
remote: FAILED
remote: !!!!!!!!
remote: Deployment Halted!
remote: If the build failed before the deploy step, your previous
remote: build is still running.  Otherwise, your application may be
remote: partially deployed or inaccessible.
remote: Fix the build and try again.
remote: !!!!!!!!
remote: An error occurred executing 'gear postreceive' (exit code: 1)
remote: Error message: CLIENT_ERROR: Failed to execute: 'control post-receive' for /var/lib/openshift/546e36e5e0b8cd4e2a000007/jenkins-client
remote: 
remote: For more details about the problem, try running the command again with the '--trace' option.
To ssh://[email protected]/~/git/mywildfly.git/
   d618fad..ff2de09  master -> master

The key statement to note is that deployment is halted after the tests are failing. And you can verify this by revisiting mywildfly-milestogo.rhcloud.com/index.jsp and check that the updated “index.jsp” is not visible.

In short, tests pass, website is updated. And tests fail, the website is not updated. So you’ve built a simple deployment pipeline for Java EE 7 using WildFly, OpenShift, Arquillian, and Jenkins!

Continuous Deployment with Java EE 7, WildFly, and Docker – (Hanginar #1)

This blog is starting a new hanginar (G+ hangout + webinar) series that will highlight solutions, frameworks, application servers, tooling, deployment, and more content focused on Java EE. These are not the usual conference-style monologue presentations, but are interactive hackathons where real working stuff is shown, and is mostly code-driven. Think of this as a mix of, and inspired by, Nighthacking (@_nighthacking), Virtual JUG (@virtualjug), and virtual JBUG (@vjbug) but focussing purely on Java EE technology.

There are so many cool things happening in the Java EE platform and ecosystem around it, and they need to be shared with the broader community, more importantly at a location where people can go back again and again. Voxxed.com has graciously offered to host all the videos and be the central place for this content.

The first such webinar, with none other than Adam Bien (@adambien), in that series just went live. It discusses how to do Continuous Deployment with Java EE 7 and Docker. It will also show how to go from “git push” to production in less than a minute, including rebooting your Docker containers and restarting all your microservices.

A tentative list of speakers is identified at github.com/javaee-samples/webinars. Each speaker is assigned an issue which allows you to ask questions. Feel free to file an issue for any other speaker that should be on the list.

What would you like to see ? Spec leads ? App servers ? Why this over that ? Design patterns and anti-patterns ? Anonymous customer use cases ? What frequency would you like to see ? Use G+ hangout on air ?

As with any new effort, we’ll learn and evolve and see what makes best sense for the Java EE community.

So what’s the mantra ? Code is king, give some love to Java EE!

 

Arquillian tests on a WildFly instance hosted on OpenShift (Tech Tip #55)

Tech Tip #54 explained how to enable Arquillian for an existing Java EE project. In that tip, the tests were run against a locally installed WildFly server. Would the same adapter work if this WildFly instance was running on OpenShift ? No!

Because the security constraints and requirement of a PaaS, as opposed to a localhost, are different. Lets take a look at what’s required to run our tests in javaee7-continuous-delivery on a WildFly instance hosted on OpenShift.

Lets get started!

  1. As explained in Tech Tip #52, create a WildFly application on OpenShift as shown:
    workspaces> rhc app-create mywildfly jboss-wildfly-8
    Application Options
    -------------------
    Domain:     milestogo
    Cartridges: jboss-wildfly-8
    Gear Size:  default
    Scaling:    no
    
    Creating application 'mywildfly' ... Artifacts deployed: ./ROOT.war
    done
    
      WildFly 8 administrator added.  Please make note of these credentials:
    
       Username: adminMYtMTDb
       Password: tq1K-QYLFgBD
       
       run 'rhc port-forward mywildfly' to access the web admin area on port 9990.
    
    Waiting for your DNS name to be available ... done
    
    Cloning into 'mywildfly'...
    Warning: Permanently added the RSA host key for IP address '54.163.64.193' to the list of known hosts.
    
    Your application 'mywildfly' is now available.
    
      URL:        http://mywildfly-milestogo.rhcloud.com/
      SSH to:     [email protected]
      Git remote: ssh://[email protected]/~/git/mywildfly.git/
      Cloned to:  /Users/arungupta/workspaces/mywildfly
    
    Run 'rhc show-app mywildfly' for more details about your app.

    Note down the ssh user name from the log. This is the part before @ in the value corresponding to SSH to.

  2. Until FORGEPLUGINS-177 is resolved, we need to manually add maven profile and provide container configuration information in “arquillian.xml”. Add the following <profile> to “pom.xml”:
    <profile>
        <id>arquillian-wildfly-openshift</id>
        <build>
            <plugins>
                <plugin>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.14.1</version>
                    <configuration>
                        <systemPropertyVariables>
                            <arquillian.launch>arquillian-wildfly-openshift</arquillian.launch>
                        </systemPropertyVariables>
                    </configuration>
                </plugin>
            </plugins>
        </build>
        <dependencies>
            <dependency>
                <groupId>org.jboss.arquillian.container</groupId>
                <artifactId>arquillian-openshift</artifactId>
                <version>1.0.0.Final-SNAPSHOT</version>
                <scope>test</scope>
            </dependency>
        </dependencies>
    </profile>

    This is using arquillian-openshift container and referring to arquillian-wildfly-openshift configuration that will be matched with the appropriate container in “arquillian.xml”.

    So this is how the updated “arquillian.xml” look:

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <arquillian xmlns="http://jboss.org/schema/arquillian" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
        <container qualifier="arquillian-wildfly-remote"/>
        <container qualifier="arquillian-wildfly-openshift">
            <configuration>
                <property name="namespace">milestogo</property>
                <property name="application">mywildfly</property>
                <property name="libraDomain">rhcloud.com</property>
                <property name="sshUserName">54699516ecb8d41cb8000016</property>
                <property name="login">[email protected]</property>
                <property name="deploymentTimeoutInSeconds">300</property>
                <property name="disableStrictHostChecking">true</property> 
            </configuration>
        </container>
    </arquillian>
    

    Note the new <container> with the qualifier arquillian-wildfly-openshift. It provides information about where the server is located and some other configuration properties. The sshUserName property value should be the same from the WildFly instance created earlier.

  3. That’s it, now you can run the test against the WildFly instance on OpenShift:
    javaee7-simple-sample> mvn test -Parquillian-wildfly-openshift
    [INFO] Scanning for projects...
    [INFO]                                                                         
    [INFO] ------------------------------------------------------------------------
    [INFO] Building helloworld 1.0-SNAPSHOT
    [INFO] ------------------------------------------------------------------------
    [INFO] 
    [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ helloworld ---
    [INFO] Using 'UTF-8' encoding to copy filtered resources.
    [INFO] Copying 0 resource
    [INFO] 
    [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ helloworld ---
    [INFO] Nothing to compile - all classes are up to date
    [INFO] 
    [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ helloworld ---
    [INFO] Using 'UTF-8' encoding to copy filtered resources.
    [INFO] Copying 1 resource
    [INFO] 
    [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ helloworld ---
    [INFO] Nothing to compile - all classes are up to date
    [INFO] 
    [INFO] --- maven-surefire-plugin:2.14.1:test (default-test) @ helloworld ---
    [INFO] Surefire report directory: /Users/arungupta/workspaces/javaee7-simple-sample/target/surefire-reports
    
    -------------------------------------------------------
     T E S T S
    -------------------------------------------------------
    Running org.javaee7.sample.PersonTest
    Nov 17, 2014 11:18:24 AM org.jboss.arquillian.container.openshift.OpenShiftContainer start
    INFO: Preparing Arquillian OpenShift container at http://mywildfly-milestogo.rhcloud.com
    Nov 17, 2014 11:19:19 AM org.jboss.arquillian.container.openshift.OpenShiftRepository push
    INFO: Pushed to the remote repository ssh://[email protected]/~/git/mywildfly.git/
    Nov 17, 2014 11:20:56 AM org.jboss.arquillian.container.openshift.OpenShiftRepository push
    INFO: Pushed to the remote repository ssh://[email protected]/~/git/mywildfly.git/
    Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 152.653 sec
    Nov 17, 2014 11:20:56 AM org.jboss.arquillian.container.openshift.OpenShiftContainer stop
    INFO: Shutting down Arquillian OpenShift container at http://mywildfly-milestogo.rhcloud.com
    
    Results :
    
    Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
    
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 05:46 min
    [INFO] Finished at: 2014-11-17T11:24:09+02:00
    [INFO] Final Memory: 12M/309M
    [INFO] ------------------------------------------------------------------------

The complete source code is available at github.com/arun-gupta/javaee7-continuous-delivery.

Enjoy!

Enable Arquillian on an existing Java EE project, using Forge Addon (Tech Tip #54)

Tech Tip #34 explained how to create a testable Java EE 7 application. This is useful if you are starting a new application. But what if you already have an application and Arquillian-enable it ?

That’s where Forge and Forge-Arquillian add-on comes in handy. That’s how I added support for Arquillian in javaee7-simple-sample. The updated source code is at github.com/arun-gupta/javaee7-continuous-delivery.

Lets see what was done!

  1. Download and install Forge. You can download ZIP and unzip in your favorite location, or just use the following command that does it for you:
    Downloads> curl http://forge.jboss.org/sh | sh
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  2725    0  2725    0     0   4641      0 --:--:-- --:--:-- --:--:--  4642
    /usr/bin/java
    Downloading Forge
    ######################################################################## 100.0%
    Archive:  /Users/arungupta/.forge/forge_installer.zip
       creating: /Users/arungupta/forge/forge-distribution-2.12.2.Final/
       creating: /Users/arungupta/forge/forge-distribution-2.12.2.Final/img/
    
    . . .
    
    If you have not yet seen the Forge built-in commands, you may either press TAB to see a list of the currently available commands, or get a more descriptive list by typing:
    
    $ command-list
    
    Then to get started - see the docs at
    http://forge.jboss.org/documentation 
    Consider installing Git and Maven 3.1+ (both optional)
    
    Restart Terminal to use forge.
    
  2. Clone the simple-javaee7-sample repo
    git clone https://github.com/javaee-samples/javaee7-simple-sample.git
  3. Change the directory to javaee7-simple-sample and start Forge:
    javaee7-simple-sample> ~/tools/forge-distribution-2.12.2.Final/bin/forge
    Using Forge at /Users/arungupta/tools/forge-distribution-2.12.2.Final
    
        _____                    
       |  ___|__  _ __ __ _  ___ 
       | |_ / _ \| `__/ _` |/ _ \  \\
       |  _| (_) | | | (_| |  __/  //
       |_|  \___/|_|  \__, |\___| 
                       |__/      
    
    JBoss Forge, version [ 2.12.2.Final ] - JBoss, by Red Hat, Inc. [ http://forge.jboss.org ]
    
    
  4. Install the Forge-Arquillian add-on:
    [javaee7-simple-sample]$ addon-install-from-git --url https://github.com/forge/addon-arquillian.git
    ***INFO*** Installing Addon from Git    [0/4] ...
    ***INFO*** Installing Addon from Git:Cloning repository in /var/folders/3v/syxsk5zx3yqd_8g9m206py_h0000gn/T/1416131293813-0     [0/4] ...
    ***INFO*** Installing Addon from Git:Installing project into local repository   [1/4] ...
    [INFO] Scanning for projects...
    [INFO]                                                                         
    [INFO] ------------------------------------------------------------------------
    [INFO] Building Arquillian Forge Addon 1.0.0-SNAPSHOT
    [INFO] ------------------------------------------------------------------------
    [INFO] 
    
    . . .
    
    Downloading: http://repo1.maven.org/maven2/org/jboss/forge/addon/maven-impl-projects/2.12.2.Final/maven-impl-projects-2.12.2.Final.pom
    Downloaded: http://repo1.maven.org/maven2/org/jboss/forge/addon/maven-impl-projects/2.12.2.Final/maven-impl-projects-2.12.2.Final.pom (4 KB at 16.9 KB/sec)
    ***SUCCESS*** Addon org.arquillian.forge:arquillian-addon,1.0.0-SNAPSHOT was installed successfully.
  5. Configure Arquillian add-on and install WildFly adapter:
    [javaee7-simple-sample]$ arquillian-setup --testFramework junit --containerAdapter wildfly-remote 
    Downloading: http://repo1.maven.org/maven2/org/wildfly/wildfly-arquillian-container-remote/maven-metadata.xml
    Downloaded: http://repo1.maven.org/maven2/org/wildfly/wildfly-arquillian-container-remote/maven-metadata.xml (702 B at 4.2 KB/sec)
    ***SUCCESS*** Arquillian setup complete
    ***SUCCESS*** Installed Arquillian 1.1.5.Final
    ***SUCCESS*** Installed junit
    ***SUCCESS*** Installed Arquillian Container WildFly Remote 8.x
    ***SUCCESS*** Installed Arquillian Container WildFly Remote 8.x dependencies

    The list of adapters is diverse as shown:

    glassfish-embedded-3.1       jetty-embedded-6.1           tomee-remote                 
    glassfish-managed-3.1        jetty-embedded-7             was-embedded-8               
    glassfish-remote-3.1         openejb-embedded-3.1         was-remote-7                 
    jbossas-embedded-6           openejb-embedded-4           was-remote-8                 
    jbossas-managed-4.2          openshift-express            weld-ee-embedded-1.1         
    jbossas-managed-5.1          openwebbeans-embedded-1      weld-se-embedded-1           
    jbossas-managed-6            tomcat-embedded-6            weld-se-embedded-1.1         
    jbossas-managed-7            tomcat-embedded-7            wildfly-managed              
    jbossas-remote-4.2           tomcat-managed-5.5           wildfly-remote               
    jbossas-remote-5             tomcat-managed-6             wls-remote-10.3              
    jbossas-remote-5.1           tomcat-managed-7             
    jbossas-remote-6             tomcat-remote-6              
    

    This allows you to configure the container of your choice. This will add the following profile to your “pom.xml”:

    <profile>
        <id>arquillian-wildfly-remote</id>
        <build>
            <plugins>
                <plugin>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.14.1</version>
                    <configuration>
                        <systemPropertyVariables>
                            <arquillian.launch>arquillian-wildfly-remote</arquillian.launch>
                        </systemPropertyVariables>
                    </configuration>
                </plugin>
            </plugins>
        </build>
        <dependencies>
            <dependency>
                <groupId>org.wildfly</groupId>
                <artifactId>wildfly-arquillian-container-remote</artifactId>
                <version>8.1.0.Final</version>
                <scope>test</scope>
            </dependency>
        </dependencies>
    </profile>

    The profile includes the “wildfly-arquillian-container-remote” dependency which allows Arquillian to connect with a WildFly running in remote “mode”. The default host is “localhost” and port is “8080”. The “maven-surefire-plugin” is passed a “arquillian.launch” configuration property with the value “arquillian-wildfly-remote”. This is matched with a “container” qualifier in the generated “arquillian.xml”.

    “arquillian.xml” is used to define configuration settings to locate or communicate with the container. In our case, WildFly is running on default host and port and so there is no need to update this file. The important part to note is that the “container” qualifier matches with the “arquillian.launch” qualifier value.

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <arquillian xmlns="http://jboss.org/schema/arquillian" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
        <container qualifier="arquillian-wildfly-remote"/>
    </arquillian>
    

    This file. More details about this configuration file are available here.

  6. Until FORGE-2148 is fixed, you also need to add a JAX-RS implementation as well, and the corresponding JAXB provider. This test is using RESTEasy and so the following needs to be added:
    <dependency>
        <groupId>org.jboss.resteasy</groupId>
        <artifactId>resteasy-client</artifactId>
        <version>3.0.5.Final</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.jboss.resteasy</groupId>
        <artifactId>resteasy-jaxb-provider</artifactId>
        <version>3.0.5.Final</version>
        <scope>test</scope>
    </dependency>
    

    This can be added either in the profile or project-wide dependencies.

And now you are ready to test!

Download WildFly 8.1 and unzip. Start the server as:

./bin/standalone.sh

Run the tests:

javaee7-simple-sample> mvn test
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building helloworld 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ helloworld ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ helloworld ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ helloworld ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ helloworld ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-surefire-plugin:2.14.1:test (default-test) @ helloworld ---
[INFO] Surefire report directory: /Users/arungupta/workspaces/javaee7-simple-sample/target/surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running org.javaee7.sample.PersonTest
Nov 16, 2014 1:53:57 PM org.xnio.Xnio 
INFO: XNIO version 3.2.0.Beta4
Nov 16, 2014 1:53:57 PM org.xnio.nio.NioXnio 
INFO: XNIO NIO Implementation Version 3.2.0.Beta4
Nov 16, 2014 1:53:57 PM org.jboss.remoting3.EndpointImpl 
INFO: JBoss Remoting version (unknown)
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.963 sec

Results :

Tests run: 2, Failures: 0, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.403 s
[INFO] Finished at: 2014-11-16T13:53:59+02:00
[INFO] Final Memory: 17M/309M
[INFO] ------------------------------------------------------------------------

And now you’ve Arquillian-enabled your existing project!

Once again, the complete source code is available at github.com/arun-gupta/javaee7-continuous-delivery.

File any issues here.

Enjoy!

Java EE 7 Video Course on voxxed.com

java-ee-logo voxxed

Voxxed.com is a new initiative by the successful team behind Devoxx. This was announced at Devoxx 2014 Belgium keynote. Some of the key aspects of Voxxed are:
  • It’s a space to share ideas – whether that means submitting articles, tutorials, or blog posts, or telling the Voxxed editorial team about some news or ideas you’ve got that you’d like them to broadcast on your behalf to the whole community.
  • “Devoxx everyday,” bringing together the best of the conversation from the Java ecosystem into one portal.
  • A place to facilitate discussion and wider learning with curated links to wider Parleys presentations and interviews.
  • A new kind of media portal which will be hugely influenced by the community that uses it.

Stephan Janssen (@stephan007), the serial entrepreneur and the man behind Devoxx had to say the following about this initiative:

The Voxxed story starts with Devoxx, which I started in part so that I could get my personal fix of the best tech content around. I’m proud of how important Devoxx has become for developers in this community, but it only happens a few times a year. Where can I go then for a daily community hit, especially with online media so fragmented? So I thought, let’s bring everything together by pulling in blog feeds, reporting news, and housing tutorials, presentations and training courses – everything that people share that makes Devoxx what it is, into one place

There are so many people out there with amazing tech know-how that fly under the radar. I hope Voxxed can be the place where they share their stories. It’s also somewhere for new talent to shine. The Rockstars of our sector probably had their first speaking gig at a local community event. But not everyone enjoys the sometimes terrifying arena of a few hundred people staring back at them. By letting the community publish online, Voxxed gives new voices a platform. Today is just the first stage – a site that looks good, is easy to use and has great content. The next stage is for the community to drive it with excellent content and ideas”

Lucy Carey (@Lucyrushi), editor of Voxxed, says:

I love the creativity and energy of the tech sector, and one of the best parts of my job is being able to share stories from the people behind all the exciting stuff that this huge community is generating. When I heard that there was an opportunity to get involved with a new site developed by the people behind Parleys and Devoxx, I was hugely keen to come on board.

I’m proud and excited to be part of the inaugural launch of voxxed.com with a video course on Learning Java EE 7 Essentials, check out a preview:

The first version of this course provide introduction to the following Java EE 7 technologies:

  • Java API for WebSocket (JSR 356)
  • Java API for JSON Processing (JSR 353)
  • Batch Processing for the Java Platform (JSR 352)
  • Concurrency Utilities for Java EE (JSR 353)
  • Java API for RESTful Services (JSR 339)
  • Java Message Service (JSR 343)
  • Contexts & Dependency Injection (JSR 346)

The four new technologies in the course, WebSocket, JSON-P, Batch, and Concurrency, are explained in detail. Key features of JAX-RS 2.0, JMS 2.0, and CDI 1.1 are explained in detail, with a clearly marked emphasis on new features added in Java EE 7.

This is purely a technology-focused course. So whether you are using WildFly, GlassFish, or TmaxSoft JEUS today or will be using JBoss EAP 7+, WebLogic 12.1.4+, WebSphere Liberty Profile or any other Java EE 7 compliant application server, this course would be a great way to understand the key concepts of technology.It discusses the patterns and anti-patterns of different technologies using code-extensive slides.

Buy the course here!

If your team is embarking on a new project that uses Java EE 7 technology, this course will server as a great introduction as well. The usual benefits of parleys.com such as offline viewing, synchronized slides + video, ability to skip slides etc are all available as well.

Future additions planned for this course are:

  • JavaServer Faces (JSR 344)
  • Java Servlets (JSR 340)
  • Java API for Persistence (JSR 338)
  • Enteprise JavaBeans (JSR 345)
  • Develop/Deploy/Debug a Java EE 7 Application Eclipse
  • Develop/Deploy/Debug a Java EE 7 Application using NetBeans
  • Develop/Deploy/Debug a Java EE 7 Application using IntelliJ
  • Java EE 7 Development/Deployment on OpenShift

The course is available at an introductory low price of €69.99. Bulk pricing discounts are also available, drop a comment on the blog for that. However this price will increase as more course items are added in the next few weeks. If you purchase the course today, then future updates/additions are free!

So, act now and purchase this course today :-)

Many thanks to Carlo and rest of the Parleys team for their wonderful support through out the process!

Slides from Nuts and Bolts of WebSocket at #Devoxx 2014

Peter Moskovits from Kaazing (@peterm_kaazing) and I gave a university talk at Devoxx 2014 on Nuts and Bolts of WebSocket. The slides are now available at:

The entire session is recorded and will be made available on parleys.com in the coming weeks/months.

The complete script for the demo is available at github.com/arun-gupta/nuts-and-bolts-of-websocket (including pointers to the demos). Most of the demos are anyway available at the following links:

Positive feedback from twitter overall:

And it was rated the top talk for the day until 6pm:

devoxx14-websocket-talk-rank

With Red Hat spirit, “the more you share, the more you grow”, share the slides and demos all over and spread the love!

Happy Devoxx!

STOMP over WebSocket (Tech Tip #53)

STOMP is Simple Text Oriented Messaging Protocol. It defines an interoperable wire format that allows a STOMP client to communicate with any STOMP message broker. This provides easy and widespread messaging interoperability among different languages, platforms and brokers.

The specification defines what makes it different from other messaging protocols:

It is an alternative to other open messaging protocols such as AMQP and implementation specific wire protocols used in JMS brokers such as OpenWire. It distinguishes itself by covering a small subset of commonly used messaging operations rather than providing a comprehensive messaging API.

STOMP is a frame-based protocol. A frame consists of a command, a set of optional headers and an optional body. Commonly used commands are:

  • CONNECT
  • SEND
  • SUBSCRIBE
  • UNSCUBSCRIBE
  • ACK
  • NACK
  • DISCONNECT

WebSocket messages are also transmitted as frames. STOMP over WebSocket maps STOMP frames to WebSocket frames.

Different messaging servers like HornetQ, ActiveMQ, RabbitMQ, and others provide native support for STOMP over WebSocket. Lets take a look at a simple sample on how to use STOMP over WebSocket using ActiveMQ.

The source code for the sample is available at github.com/arun-gupta/wildfly-samples/tree/master/websocket-stomp.

Lets get started!

  1. Download ActiveMQ 5.10 or provision an ActiveMQ instance in OpenShift as explained at github.com/arun-gupta/activemq-openshift-cartridge.
    workspaces> rhc app-create activemq diy --from-code=git://github.com/arun-gupta/activemq-openshift-cartridge.git
    Using diy-0.1 (Do-It-Yourself 0.1) for 'diy'
    
    Application Options
    -------------------
    Domain:      milestogo
    Cartridges:  diy-0.1
    Source Code: git://github.com/arun-gupta/activemq-openshift-cartridge.git
    Gear Size:   default
    Scaling:     no
    
    Creating application 'activemq' ... done
    
      Disclaimer: This is an experimental cartridge that provides a way to try unsupported languages, frameworks, and middleware on OpenShift.
    
    Waiting for your DNS name to be available ... done
    
    Cloning into 'activemq'...
    Warning: Permanently added the RSA host key for IP address '54.90.10.115' to the list of known hosts.
    
    Your application 'activemq' is now available.
    
      URL:        http://activemq-milestogo.rhcloud.com/
      SSH to:     [email protected]
      Git remote: ssh://[email protected]/~/git/activemq.git/
      Cloned to:  /Users/arungupta/workspaces/activemq
    
    Run 'rhc show-app activemq' for more details about your app.
    workspaces> rhc port-forward activemq
    Checking available ports ... done
    Forwarding ports ...
    
    To connect to a service running on OpenShift, use the Local address
    
    Service Local                OpenShift
    ------- --------------- ---- -----------------
    java    127.0.0.1:1883   =>  127.7.204.1:1883
    java    127.0.0.1:5672   =>  127.7.204.1:5672
    java    127.0.0.1:61613  =>  127.7.204.1:61613
    java    127.0.0.1:61614  =>  127.7.204.1:61614
    java    127.0.0.1:61616  =>  127.7.204.1:61616
    java    127.0.0.1:8161   =>  127.7.204.1:8161
    
    Press CTRL-C to terminate port forwarding
  2. Download WildFly 8.1 zip, unzip, and start as bin/standalone.sh
  3. Clone the repo and deploy the sample on WildFly:
    git clone https://github.com/arun-gupta/wildfly-samples.git
    cd wildfly-samples
    mvn wildfly:deploy
  4. Access the application at localhost:8080/websocket-stomp-1.0-SNAPSHOT/ to see the page as:techtip53-default-page
  5. Specify text payload “foobar and usse ActiveMQ conventions for topics and queues to specify a queue name as “/queue/myQ1″. Click on Connect, Send Message, Subscribe, and Disconnect buttons one after the other. This will display messages on your browser window where WebSocket connection is established, STOMP message is sent to the queue, subscribed to the queue to receive the message, and then finally disconnected.STOMP frames can be seen using Chrome Developer Tools as shown:

    techtip53-websocket-frames

    As you can see, each STOMP frame is mapped to a WebSocket frame.

In short, ActiveMQ on OpenShift is running a STOMP broker on port 61614 and is accessible on localhost:61614 by port-forwarding. Clicking on Connect button uses the Stomp library bundled with the application to establish a WebSocket connection with ws://localhost:61614/. Subsequent buttons send STOMP frames over WebSocket as shown in the Frames tab of Developer Tools.

Read more details about how all the pieces work together at jmesnil.net/stomp-websocket/doc/. Jeff has also written an excellent book explaining STOMP over WebSocket and lot more other interesting things that can be done over WebSocket in his Mobile and Web Messaging book.

 

Create WildFly OpenShift application using Command Line Tools (Tech Tip #52)

A new instance of WildFly can be easily provisioned on OpenShift by using the quick start. Just a single click, and you are ready to go!

Generally power users of OpenShift use Command Line Tools. However you could not create WildFly cartridge using the CLI tools. But bug# 1134134 is now resolved.

And so now rhc cartridge-list shows:

workspaces> rhc cartridge-list
jbossas-7           JBoss Application Server 7              web
jboss-dv-6.0.0 (!)  JBoss Data Virtualization 6             web
jbosseap-6 (*)      JBoss Enterprise Application Platform 6 web
jenkins-1           Jenkins Server                          web
nodejs-0.10         Node.js 0.10                            web
perl-5.10           Perl 5.10                               web
php-5.3             PHP 5.3                                 web
php-5.4             PHP 5.4                                 web
zend-6.1            PHP 5.4 with Zend Server 6.1            web
python-2.6          Python 2.6                              web
python-2.7          Python 2.7                              web
python-3.3          Python 3.3                              web
ruby-1.8            Ruby 1.8                                web
ruby-1.9            Ruby 1.9                                web
ruby-2.0            Ruby 2.0                                web
jbossews-1.0        Tomcat 6 (JBoss EWS 1.0)                web
jbossews-2.0        Tomcat 7 (JBoss EWS 2.0)                web
jboss-vertx-2.1 (!) Vert.x 2.1                              web
jboss-wildfly-8 (!) WildFly Application Server 8.1.0.Final  web
diy-0.1             Do-It-Yourself 0.1                      web
10gen-mms-agent-0.1 10gen Mongo Monitoring Service Agent    addon
cron-1.4            Cron 1.4                                addon
jenkins-client-1    Jenkins Client                          addon
mongodb-2.4         MongoDB 2.4                             addon
mysql-5.1           MySQL 5.1                               addon
mysql-5.5           MySQL 5.5                               addon
phpmyadmin-4        phpMyAdmin 4.0                          addon
postgresql-8.4      PostgreSQL 8.4                          addon
postgresql-9.2      PostgreSQL 9.2                          addon
rockmongo-1.1       RockMongo 1.1                           addon
switchyard-0        SwitchYard 0.8.0                        addon
haproxy-1.4         Web Load Balancer                       addon

Note: Web cartridges can only be added to new applications.

(*) denotes a cartridge with additional usage costs.

(!) denotes a cartridge that will not receive automatic security updates.

The newly added cartridge of WildFly 8 is shown in bold.

And so now a new WildFly instance can be easily provisioned using the CLI as:

workspaces> rhc app-create mywildfly jboss-wildfly-8
Application Options
-------------------
Domain:     milestogo
Cartridges: jboss-wildfly-8
Gear Size:  default
Scaling:    no

Creating application 'mywildfly' ... Artifacts deployed: ./ROOT.war
done

  WildFly 8 administrator added.  Please make note of these credentials:

   Username: adminLWEMEdW
   Password: 9u6jpWuQU6hg
   
   run 'rhc port-forward mywildfly' to access the web admin area on port 9990.

Waiting for your DNS name to be available ... done

Cloning into 'mywildfly'...
Warning: Permanently added the RSA host key for IP address '54.163.104.22' to the list of known hosts.

Your application 'mywildfly' is now available.

  URL:        http://mywildfly-milestogo.rhcloud.com/
  SSH to:     [email protected]
  Git remote: ssh://[email protected]/~/git/mywildfly.git/
  Cloned to:  /Users/arungupta/workspaces/mywildfly

Run 'rhc show-app mywildfly' for more details about your app.

And then the application’s main page is accessible as shown:

techtip52-main-page

And the application can be deleted as:

workspaces> rhc app-delete mywildfly 
This is a non-reversible action! Your application code and data will be permanently deleted if you continue!

Are you sure you want to delete the application 'mywildfly'? (yes|no): yes

Deleting application 'mywildfly' ... deleted

Simple, isn’t it ?

See several other OpenShift getting-started related blog entries here.

Ceylon JUG Tour 2014 Summary

Gavin King and Stéphane Épardaud talked about Ceylon in some of the Java User Groups in the East Coast of USA the past month. Knowing both the speakers, the feedback from different JUGs is not surprising:

The presentation was great – best introduction to a new language. Gavin made a great case for Ceylon.

The attendees stuck around until 9:30 asking questions (except for 1 or 2 people). The meeting was a success – especially for a new language.

The language looks very exciting – the cross-VM support is especially interesting. Gavin did an excellent job of showing the benefit of Ceylon versus Java and during the Q&A of discussing it in relation to Scala.

I think the talk went well.  Gavin did a great job at presenting some of problems Ceylon tries to solve. I really appreciated his walk through of the type system.  There were between 30 and 40 people there and there was also some good QnA about the platform. There was interest about Ceylon on Android and also the state of the tooling, debugging, etc.

Thank you for your great presentations and for visiting our JUG.  It was definitely one of the best technical presentations I’ve seen.

And some feedback received on twitter:

Ryan Cuprak (@rcuprak) highlighted their visit to Connecticut JUG and couple of points seem to come out strong:

Ceylon looks to be a significant leap forward

I would prefer it over JavaScript any day of the week. Ceylon also looks more approachable than Scala

We are planning JUG tours in other parts of the world, stay tuned. In the meanwhile, would you be interested in a G+ hangout for your JUG by these two wonderful speakers ?

Have you tried Ceylon recently ? Try Ceylon compiler, IDE, and SDK.

ceylon-logo

Big Data and Beyond Webinar Series by Red Hat

bigdata-webinar-nov2014

Watch this 5-part webinar series and learn how to overcome challenges of big data, data bottlenecks, and data integration:

  • The 3 big problems with data and how to avoid them (Nov 5)
  • Slow data is a fast way to lose your best customers (Nov 12)
  • Integration intervention: get your apps and data up to speed (Nov 19)
  • Making good decisions? Want to? Data analytics is the key (Dec 2)
  • Don’t let Hadoop become a new data silo (Dec 9)

You’ll learn:

  • How to implement a data strategy and architecture
  • Successfully provide stellar data-rich user experiences while maintaining high enterprise performance and scalability
  • Quickly and easily create a virtual data services layer to plug data into your SOA infrastructure, allowing your entire solution to operate with agility and efficiency
  • Apply advanced business rules to virtualized data services
  • Identify and act upon important information that may otherwise be lost in a sea of big data
  • Make calling data from Hadoop as easy as any SQL data source
  • Seamlessly combine data from Hadoop-based systems with existing data silos
  • Deliver truly unified and actionable information to maximize return on data assets

Learn from the best in the industry on a topic critical to your business.

Register for all the events here!