Feed abonnieren

What really is DevOps?

For many organizations, the ability to innovate at a rapid pace responding to market conditions and customer feedback is a key element for success. Companies like Red Hat, Google, Facebook, SalesForce and Twitter, update their applications many of times a day and try to reduce the time of delivery of new features, updates and enhancements through task automation, integrated testing, etc. This has brought great gains to these corporations and at the same time decreased the risk of bugs, because the updates are performed in "smaller packages" making it easier to identify any problems. This culture automation, continuous integration in large-scale test has been called DevOps.

DevOps not have a formal definition, but his philosophy is not new, since many of its principles were born of the agile movement. DevOps can be described as a movement of professionals who preach working with collaborative relationship between the development team (Dev) and the team of operations (Ops), resulting in a quick planned workflow, while maintaining the reliability, stability, resilience and safety in a production environment. The principles and DevOps practices confirm that the high-performance IT is strongly related to business performance, helping to increase productivity and profitability in the market. Promoting integration and collaboration between the areas of development, operation and business.

New technologies emerge every day, and one of those has been highlighted by facilitating the adoption of some DevOps practices through continuous integration using Docker containers.

Docker

Docker is a container-based software framework for automating deployment of applications. Docker enables developers and sysadmins to build, ship and run distributed applications anywhere. You can think of Docker containers as sort-of lightweight virtual machines and can run on almost any platform.

Docker have been released as part of the extras channel in Red Hat Enterprise Linux 7. The steps for installing  are generally as simple. Install it using the following command:

# yum -y install docker

Now you have Docker installed onto your machine, start and enable the Docker service incase if it not started automatically after the installation:

# systemctl start docker.service
# systemctl enable docker.service

Once the service is started, verify your installation by running the following command:

# docker run -it rhel echo Hello-World

This command will look for an image named "rhel" on your local machine, and in its absence, try to download it from the registry.access.redhat.com. The "registry.access.redhat.com" is a central repository of Docker images. Please note that you must have a valid Red Hat subscription to access the download.

Containers illustration Erreichen Sie mehr mit dem Universal Base Image (UBI) von Red Hat

Creating a Docker container for JBoss EAP 6.4

Now that we have a basic understanding of what Docker we will learn how to deploy applications by using Docker Files. Dockerfile has a special mission: automation of Docker image creation. A Dockerfile consists of a set of commands which can be written in a text file named "Dockerfile". The purpose of our Docker file will be adding an application named "myapp.war" in the deployments folder of the standalone installation. Now lets look at the Dockerfile:


# dockerfile to build image for JBoss EAP 6.4

# start from rhel 7.2
FROM rhel

# file author / maintainer
MAINTAINER "FirstName LastName" "emailaddress@gmail.com"

# update OS
RUN yum -y update && \
yum -y install sudo openssh-clients telnet unzip java-1.8.0-openjdk-devel && \
yum clean all

# enabling sudo group
# enabling sudo over ssh
RUN echo '%wheel ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers && \
sed -i 's/.*requiretty$/Defaults !requiretty/' /etc/sudoers

# add a user for the application, with sudo permissions
RUN useradd -m jboss ; echo jboss: | chpasswd ; usermod -a -G wheel jboss

# create workdir
RUN mkdir -p /opt/rh

WORKDIR /opt/rh

# install JBoss EAP 6.4.0
ADD jboss-eap-6.4.0.zip /tmp/jboss-eap-6.4.0.zip
RUN unzip /tmp/jboss-eap-6.4.0.zip

# set environment
ENV JBOSS_HOME /opt/rh/jboss-eap-6.4

# create JBoss console user
RUN $JBOSS_HOME/bin/add-user.sh admin admin@2016 --silent
# configure JBoss
RUN echo "JAVA_OPTS=\"\$JAVA_OPTS -Djboss.bind.address=0.0.0.0 -Djboss.bind.address.management=0.0.0.0\"" >> $JBOSS_HOME/bin/standalone.conf

# set permission folder
RUN chown -R jboss:jboss /opt/rh

# JBoss ports
EXPOSE 8080 9990 9999

# start JBoss
ENTRYPOINT $JBOSS_HOME/bin/standalone.sh -c standalone-full-ha.xml

# deploy app
ADD myapp.war "$JBOSS_HOME/standalone/deployments/"

USER jboss
CMD /bin/bash

Make sure that the myapp.war application and jboss-eap-6.4.0.zip  are in the same folder as the Dockerfile:

[root@jboss ~]# ls
Dockerfile  jboss-eap-6.4.0.zip  myapp.war

If you do not already have the ZIP archive for JBoss EAP 6.4 then you should go download it here.

Building the container

To build a new Docker image is simple, you have to choose a tag and issue a docker build command:

# docker build -q --rm --tag=jboss-myapp

Now check images by issuing a docker command:

[root@jboss ~]# docker images

REPOSITORY                                                  TAG                 IMAGE ID            CREATED             VIRTUAL SIZE

jboss-myapp                                                 latest              bd14a8aad563        2 days ago          912.7 MB

 

Once the image has completed building, you will want to run it.

# sudo docker run -it jboss-myapp
22:23:51,316 INFO  [org.xnio] (MSC service thread 1-8) XNIO Version 3.0.13.GA-redhat-1

22:23:51,342 INFO  [org.xnio.nio] (MSC service thread 1-8) XNIO NIO Implementation Version 3.0.13.GA-redhat-1

22:23:51,353 INFO  [org.jboss.as.server] (Controller Boot Thread) JBAS015888: Creating http management service using socket-binding (management-http)

22:23:51,416 INFO  [org.jboss.remoting] (MSC service thread 1-8) JBoss Remoting version 3.3.4.Final-redhat

The application server will start.

Now we need to find the IP address which has been chosen by Docker to bind the application server:

 

[root@jboss ~]# docker ps
CONTAINER ID        IMAGE                    COMMAND                     

65009707e8b4           jboss-myapp         "/bin/sh -c '$JBOSS_H"   

 

CREATED                   STATUS                 PORTS                                               NAMES

17 seconds ago            Up 13 seconds       8080/tcp, 9990/tcp, 9999/tcp    clever_jones

 
[root@jboss ~]# docker inspect -f '{{ .NetworkSettings.IPAddress }}' 65009707e8b4
172.17.0.2

Your application is ready on address http://172.17.0.2:8080/myapp.

-----
 
References

  1. https://goldmann.pl/blog/2014/07/23/customizing-the-configuration-of-th…

 -----

Connect with Red Hat Consulting, Training, Certification

Learn more about Red Hat Consulting
Learn more about Red Hat Training
Learn more about Red Hat Certification
Subscribe to the Training Newsletter
Follow Red Hat Training on Twitter
Like Red Hat Training on Facebook
Watch Red Hat Training videos on YouTube
Follow Red Hat Certified Professionals on LinkedIn

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License


Über den Autor

UI_Icon-Red_Hat-Close-A-Black-RGB

Nach Thema durchsuchen

automation icon

Automatisierung

Das Neueste zum Thema IT-Automatisierung für Technologien, Teams und Umgebungen

AI icon

Künstliche Intelligenz

Erfahren Sie das Neueste von den Plattformen, die es Kunden ermöglichen, KI-Workloads beliebig auszuführen

open hybrid cloud icon

Open Hybrid Cloud

Erfahren Sie, wie wir eine flexiblere Zukunft mit Hybrid Clouds schaffen.

security icon

Sicherheit

Erfahren Sie, wie wir Risiken in verschiedenen Umgebungen und Technologien reduzieren

edge icon

Edge Computing

Erfahren Sie das Neueste von den Plattformen, die die Operations am Edge vereinfachen

Infrastructure icon

Infrastruktur

Erfahren Sie das Neueste von der weltweit führenden Linux-Plattform für Unternehmen

application development icon

Anwendungen

Entdecken Sie unsere Lösungen für komplexe Herausforderungen bei Anwendungen

Original series icon

Original Shows

Interessantes von den Experten, die die Technologien in Unternehmen mitgestalten