mercredi 28 décembre 2016

Send hipchat notification from Jenkins pipeline

Introduction :

For a few months I have been working on automating the deployment of web executables on docker containers hosted on AMAZON AWS, and I have added a hipchat notification to each deployment.

mardi 27 décembre 2016

Docker : how to create Wildfly and MySQL in the same server

Introduction :

I continue with the exploration of the docker world. After wildfly container creation, i will add a MySQL RDMBS, for this you have the choice between the creation of two Dockerfile document and execute the build and the run of servers, or, write in once only one document and specify the environnement document in the whole.

Let's code now the first choice :

the Dockerfile for Wildfly  

The wildfly dockerfile file mentions several other files such as standalone-mjhazbri.xml and module-mysql.xm. The file start-wildfly.sh will be used to start the server wildfly :

The Dockerfile of MySQL : 

The MySQL dockerfile file mentions several other files such as my.cnf and run.sh :

the second choice will be explained in other article.

mercredi 21 décembre 2016

Install Wildfly with Docker

Introduction :

Recently, for a mission to a client, my team and I had developed a backoffice application to expose web services REST. We used the Java EE 7 standard. Among several application servers we chose Wildlfy 9. And so I was able to install this server for continuous integration.

Introduction :

As stated in my old article, the docker's heart is the Dockerfile file, so the first thing to do is to write this file.

FROM jboss/wildfly:9.0.2.Final
MAINTAINER Jalel HAZBRI "jalel.hazbri@gmail.com"

ENV WILDFLY_HOME /opt/jboss/wildfly

# Add console admin user
RUN ${WILDFLY_HOME}/bin/add-user.sh mjhazbri mjhazbri --silent

# Ports
EXPOSE 8080 9990

# Volumes
VOLUME ${WILDFLY_HOME}/standalone/deployments/
VOLUME ${WILDFLY_HOME}/standalone/log/

# RUN script
COPY start-wildfly.sh ${WILDFLY_HOME}/bin/start-wildfly.sh
USER root
RUN chmod +x ${WILDFLY_HOME}/bin/start-wildfly.sh
#USER jboss

ENTRYPOINT ["sh", "-c", "${WILDFLY_HOME}/bin/start-wildfly.sh"]

And the last line is to start wildfly with the script start-wildfly.sh :


${WILDFLY_HOME}/bin/standalone.sh -b -bmanagement

mardi 20 décembre 2016

Docker : Dockerfile

Introduction :

First, to Dockerfile, we should read this definition extracted from docker web site : 
"Docker can build images automatically by reading the instructions from a Dockerfile. A Dockerfile is a text document that contains all the commands a user could call on the command line to assemble an image. Using docker build users can create an automated build that executes several command-line instructions in succession."

Second, the Dockerfile has this format :  

# Comment

From :

The instruction is not case-sensitive. However, convention is for them to be UPPERCASE to distinguish them from arguments more easily. Docker runs instructions in a Dockerfile in order. The first instruction must be `FROM` in order to specify the Base Image from which you are building.

FROM ImageName
# directive=value

The FROM structure is :

FROM image


FROM image:tag


FROM image@digest

From :

The Maintainer instruction allows you to set the Author field of the generated images.

Expose :

The EXPOSE instruction informs Docker that the container listens on the specified network ports at runtime. EXPOSE does not make the ports of the container accessible to the host. To do that, you must use either the -pflag to publish a range of ports or the -P flag to publish all of the exposed ports. You can expose one port number and publish it externally under another number.


The The ENV instruction sets the environment variable to the value . This value will be in the environment of all “descendant” Dockerfile commands and can be replaced inline in many as well.

The ENV instruction has two forms. The first form, ENV , will set a single variable to a value. The entire string after the first space will be treated as the - including characters such as spaces and quotes.

The second form, ENV = ..., allows for multiple variables to be set at one time. Notice that the second form uses the equals sign (=) in the syntax, while the first form does not. Like command line parsing, quotes and backslashes can be used to include spaces within values.

ENV JAVA_HOME /dir_to_java


The ADD has two forms:

ADD "src"... "dest"
ADD ["src",... "dest"] (this form is required for paths containing whitespace)

The ADD instruction copies new files, directories or remote file URLs from and adds them to the filesystem of the image at the path .

Multiple resource may be specified but if they are files or directories then they must be relative to the source directory that is being built (the context of the build).

ADD test relativeDir/          # adds "test" to `WORKDIR`/relativeDir/
ADD test /absoluteDir/         # adds "test" to /absoluteDir/


The COPY has two forms:

COPY "src"... "dest
COPY ["src",... "dest"] (this form is required for paths containing whitespace)

The COPY instruction copies new files or directories from and adds them to the filesystem of the container at the path .

Multiple resource may be specified but they must be relative to the source directory that is being built (the context of the build).

COPY test relativeDir/   # adds "test" to `WORKDIR`/relativeDir/
COPY test /absoluteDir/  # adds "test" to /absoluteDir/

mercredi 26 octobre 2016

Docker ... let's start

Introduction :

First, to know docker, I invite you to read what is written on their website. but what they mean by it all. In fact, simply, is to create a server that will contain everything you want: application server, RDBMS, web server, application software ....

But how to do all this : 

well it's simple: just install docker on your machine (it's exist for any OS).

And whats : 
I told you, it's simple, if you want a server ready to use without any customization: then you can go on the docker hub website.
Well, if you chose to install your server, then run the docker run command is well documented on the site.

Example : 

I take the case of jenkins, jenkins if you are looking on the search bar: jenkins, you have this:

I recommend you always use the official repo.You will find how to perform this official image.

  docker run jenkins 

Congrats, now you have a jenkins server installed on your machine.