The Ultimate guide to DevOps Tools Part #4 : Docker

In this series that related to DevOps Tools that helps you as DBA to automate your work and make it easier for you , this will be the last part for Docker.

In this post i will mentioned how to pull and connect the Oracle repository with simplest way.

The first step and before do anything else you suppose to register in Oracle Repository website here

After the registration is complete you can back to docker machine and run the following command that will allow you to login like the following:-
Now after the login with your account information all you have to do choose which product you will pull and enter the command :-
The above step will take some time till it will be finished downloading.
Check the Image now :-
Start the image :-
The Docker start showing the oracle database log :-
Now access to the container using the follow step:-
Cheers 🍻
Osama 

The Ultimate guide to DevOps Tools Part #3 : Docker

Before we start please review the two post before we start

  • The Ultimate guide to DevOps Tools Part #1 : Docker here
    • Talking about docker concept , how install it.
  • The Ultimate guide to DevOps Tools Part #2 : Docker here
    • how to build your first application using docker
  • In this post i will talk about Docker Services.
as already mentioned above this post i will describe the level up about docker which is services which mean scale the application and enable load-balancing.
When i will need to create a services ?

Regarding to Docker Documentation here

To deploy an application image when Docker Engine is in swarm mode, you create a service. Frequently a service is the image for a microservice within the context of some larger application. Examples of services might include an HTTP server, a database, or any other type of executable program that you wish to run in a distributed environment.
But First Let’s Understand what is the docker services ?
Simply It’s group of containers of the same image, services will make your life easier when you are planning to scale your application also it will be working on docker cloud,  to do that you should configure the service in three steps:-
  • Choose a Container Image.
  • Configure the Service.
  • Set Environment variables.
Before configure any docker services there is file called “docker-compose.yml” it’s define how the docker container will behave in the environment.
the below example show you how the file looks like ( taken from docker documentation), at the first look you will understand anything but luckily it’s very simple and easy to understand it.

version: "3"
services:
web:
# replace username/repo:tag with your name and image details
image: username/repo:tag
deploy:
replicas: 5
resources:
limits:
cpus: "0.1"
memory: 50M
restart_policy:
condition: on-failure
ports:
- "4000:80"
networks:
- webnet
networks:
webnet:

Let’s discuss the above file :-
  • username/repo:tag –> should be replaced by your image information.
  • run the same image as 5 instance and the main name will be “web”.
  • Limitation will be 10% of CPU and 50 MB for each instance.
  • the instance will be restarted on failure.
  • mapped to port 4000 outside of docker, 80 inside the image.
  • the load balancer will be mapped also on port 80 as you see from network section called webnet.
The Real Work :-
Before anything you should run the following command to be able to work and deploy your services

docker swarm init 

But in case you are facing the below issue 
you have to upgrade your docker as method number#1 or uninstall it then install the newer version, after doing that and make sure you run the above command to ensure you will not get any error like “this node is not a swarm manager.” you can run the next command that allow you to create services.
docker stack deploy -c docker-compose.yml myfirstapp

where myfirstapp is my application name.
Get the ID for the one service in our application:
docker service ls

Search for our services name that are deployed called web with the application name which is myfristapp it will be like this myfirstapp_web.

Now are you scaled your application, 

curl -4 http://localhost:4000

Several times in a row, or go to that URL in your browser and hit refresh a few times.
Cheers   🍻🍻
Osama

The Ultimate guide to DevOps Tools Part #2 : Docker

This article will continue the basic for docker which is consider one of the DevOps Tools after finishing these series i will choose another tools that could help DBA to automate their works.

In this post i will show you how to build your first application using docker, without docker if you need to programming using language first you should install that language on your PC and test it on your development environment and for sure the production should be ready to sync and test your code again on it seems a lot of work.😥

But now with docker you just pull/grab that image, no installation needed, and run your code on that image.🎉

But how we can control what happening inside the environment, like Accessing to resources like networking interfaces and disk drives is virtualized inside this environment which is isolated from the rest of your system all of this happening by something called Dockerfile.

The Following example taken from Docker Documentation:

# Use an official Python runtime as a parent image
FROM python:2.7-slim

# Set the working directory to /app
WORKDIR /app

# Copy the current directory contents into the container at /app
COPY . /app

# Install any needed packages specified in requirements.txt
RUN pip install --trusted-host pypi.python.org -r requirements.txt

# Make port 80 available to the world outside this container
EXPOSE 80

# Define environment variable
ENV NAME World

# Run app.py when the container launches
CMD ["python", "app.py"]

As you see from the above example the  code explained in the comment part, which is done by Python programming language, the above docker file create directory, copy ,paste and check the port then run the app.py.

app.py (very simple Code )

# Use an official Python runtime as a parent image
print("Goodbye, World!")


Now you have the dockerfile under the directory and the app.py file, then run the build command. This creates a Docker image,

docker build -t test .

Check by

$ docker image ls

 Run the app, mapping your machine’s port 4000 to the container’s published port 80 using -p:

docker run -p 4000:80 test

Once the above command will be run the log will indicates that you could test your code using this link http://localhost:80 but this is only from inside docker, so in case you need to test it outside the docker the port will be http://localhost:4000

Cheers 👌
Osama Mustafa

The Ultimate guide to DevOps Tools Part #1 : Docker

I will try to cover the Docker basics in different posts to allow people and reader understand more about this tools, also i will provide reference in each of the posts in case you need more information:-

  • Set up your Docker environment
  • Build an image and run it as one container
  • Scale your app to run multiple containers
  • Distribute your app across a cluster
  • Stack services by adding a backend database
  • Deploy your app to production
Docker Concept:-
To Understand docker more you can imagine or can been seen as computer inside your current computer, the most cool thing about docker is that you will not even feel that there is another computer running inside your computer and share the same resource of your computer, include to that if you friend ask for the  same container all you have to do is send it to them and they will have the same output for anything running at this container.
Why Should i use docker when there are similar solution :-
  • Very simple to configure.
    • Docker provides this same capability without the overhead of a virtual machine
  • Code management
    • Docker provides a consistent environment for the application from dev through production, easing the code development and deployment pipeline.
  • App Isolation.
  • Server Consolidation.
There is more than these reasons to use docker but i choose to mentioned the one i used docker for, since it will be more reliable and trusted to share something i already done it and used it before.
Basic Vocabulary that you should understand before using Docker:-
  • Container Vs Image 
    • This is very common question to people who using docker what is the difference between container and image ? so the answer is very simple, Container is running the image but not vice versa, so the container is launched by running an image, and the image is group of executable package that include everything you can imagine to run the application such as libraries, code, .. etc.
  • Containers vs Virtual Machine
    • i mentioned earlier that containers/Docker could computer inside your computer which means it’s running on your  operating system without any third party solution or client, and share the same resource of your PC, runs a discrete process, taking no more memory than any other executable, making it lightweight.
    • VM it’s totally different solution which is could be installed in two different way, the first one installed client that control the Server resource using another software such as VMware and ESXI, or the native way for example vmware workstation that installed on the guest PC.
First example on Docker

  • install Docker, Docker could be installed on different operating system distribution you can check here 
    • Yum install docker-engine
    • service docker start
  • to check the current version of docker 
    • docker –version 

[oracle@dockertest ~]$ docker –version
Docker version 1.6.1, build a8a31ef/1.6.1
[oracle@dockertest ~]$

  •  if you need more information about docker that installed on your system.
  • Need to test if your installation is correct without any issue.
  •  The last useful command which listing your image, the image as i already mentioned is executable package to run your code and each image having different executable file depends on your docker purpose.

The first command listing all the images under your machine, the second one List the hello-world image that was downloaded to your machine.

Cheers
i will update you with part 2 soon.

Osama

Steps to Create Linux Container

After my last post about Docker Project, i start testing Linux Container but this time for lxc which is another amazing Package and should be used, if you installed and follow my steps in Previous steps here  then you can use lxc command without any suffer of installation 🙂

lxc stand for Linux Container.

Now i will start to describe how to create container using this command 

  • You need to know when lxc installed, it’s create file under /etc/lxc/ called default.conf this file should contain your network interface name and you need to add it.

[root@OEL6 ~]# cat /etc/lxc/default.conf
lxc.network.type = veth
lxc.network.link = docker0
lxc.network.flags = up

Sample output for ifconfig command :

docker0   Link encap:Ethernet  HWaddr 00:00:00:00:00:00
          inet addr:172.17.42.1  Bcast:0.0.0.0  Mask:255.255.0.0
          inet6 addr: fe80::28ce:eeff:fe80:1fc8/64 Scope:Link
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:17 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:1112 (1.0 KiB)  TX bytes:408 (408.0 b)

I used docker0 Interface because i already installed it , and configure the IP Address, if you don’t modify this file when you start container you will receive error :

[root@OEL6 container]# lxc-start –name test-container
lxc-start: failed to attach ‘vethaITNmu’ to the bridge ‘virbr0’ : No such device
lxc-start: failed to create netdev
lxc-start: failed to create the network
lxc-start: failed to spawn ‘test-container’

Anyway now after add the file with the right Interface name, you will be able to run and start working on lxc just follow the below steps :
  • Before Create any container you need to create Directory under /, if you don’t do this step another error will be appeared asking for this directory and telling you /container not found.

mkdir /container will solve the problem.

Now Let’s Start Creating new container called Test-container :

[root@OEL6 lxc]# lxc-create -n test-container -t oracle — -R 6.5

lxc-create: No config file specified, using the default config /etc/lxc/default.conf
Host is OracleServer 6.5
Create configuration file /container/test-container/config
Downloading release 6.5 for x86_64
Loaded plugins: refresh-packagekit, security
ol6_u5_base                                                     | 1.4 kB     00:00
ol6_u5_base/primary                                             | 3.2 MB     00:32
ol6_u5_base                                                                  8573/8573
Setting up Install Process

the above command will take some while to finish the configuration, it’s installing some packages needed by container you can have more than one container with different name.
After the creation is done you should be notice the below line :

Complete!
Rebuilding rpm database
Configuring container for Oracle Linux 6.5
Added container user:oracle password:oracle
Added container user:root password:root

Container : /container/test-container/rootfs
Config    : /container/test-container/config
Network   : eth0 (veth) on virbr0
‘oracle’ template installed
‘test-container’ created

the container is not started yet !!! so we need to do this using the below command :

[root@OEL6 lxc]# lxc-start -n test-container
                Welcome to Oracle Linux Server
Setting hostname test-container:                        [  OK  ]
Checking filesystems
                                                                        [  OK  ]
Mounting local filesystems:                                [  OK  ]
No such file or directory
Enabling /etc/fstab swaps:                                 [  OK  ]
Entering non-interactive startup
Bringing up loopback interface:                         [  OK  ]
Bringing up interface eth0:
Determining IP information for eth0… failed.
                                                                      [FAILED]
Starting system logger:                                    [  OK  ]
Mounting filesystems:                                      [  OK  ]
Generating SSH1 RSA host key: No such file or directory
                                                                      [  OK  ]
Generating SSH2 RSA host key: No such file or directory
                                                                     [  OK  ]
Generating SSH2 DSA host key: No such file or directory
                                                                     [  OK  ]
Starting sshd:                                                 [  OK  ]
Oracle Linux Server release 6.5
Kernel 3.8.13-16.2.1.el6uek.x86_64 on an x86_64
test-container login:

I will fix FAILED Later now you need to connect to the container using the above User name and password given to you in the above line.
After this 
[root@test-container ~]#
I am connected 🙂 

You can delete the container using command 

lxc-destroy -n test-container  

Reference :
1- Oracle Linux containers Here 
2- Oracle Linux 6.5 and Docker Here

Thank you
Osama mustafa

Enable Docker On Linux

Oracle Linux Released Before 2 week, i already blogged about this and mean while i was testing new features for Oracle Linux 6.5 which is simply amazing i will start writing about it.

Enable Docker , What is the Docker you can check the official Website to take look what i mean by Docker here .

If you tried to install Docker Directly you will get the below error :

[root@OEL6 u01]# rpm -ivh docker-io-0.7.0-14.el6.x86_64.rpm

warning: docker-io-0.7.0-14.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
error: Failed dependencies:
lxc is needed by docker-io-0.7.0-14.el6.x86_64

and if you need to install lxc package :

[root@OEL6 Packages]# rpm -ivh lxc-0.9.0-2.0.5.el6.x86_64.rpm 

warning: lxc-0.9.0-2.0.5.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
error: Failed dependencies:
libvirt is needed by lxc-0.9.0-2.0.5.el6.x86_64

So Let’s Start :

root@OEL6 Packages]# rpm -ivh libvirt-0.10.2-29.0.1.el6.x86_64.rpm 

warning: libvirt-0.10.2-29.0.1.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
error: Failed dependencies:
/usr/bin/qemu-img is needed by libvirt-0.10.2-29.0.1.el6.x86_64
ebtables is needed by libvirt-0.10.2-29.0.1.el6.x86_64
libnetcf.so.1()(64bit) is needed by libvirt-0.10.2-29.0.1.el6.x86_64
libnetcf.so.1(NETCF_1.0.0)(64bit) is needed by libvirt-0.10.2-29.0.1.el6.x86_64
libnetcf.so.1(NETCF_1.2.0)(64bit) is needed by libvirt-0.10.2-29.0.1.el6.x86_64
libnetcf.so.1(NETCF_1.3.0)(64bit) is needed by libvirt-0.10.2-29.0.1.el6.x86_64
libnetcf.so.1(NETCF_1.4.0)(64bit) is needed by libvirt-0.10.2-29.0.1.el6.x86_64
lzop is needed by libvirt-0.10.2-29.0.1.el6.x86_64
numad is needed by libvirt-0.10.2-29.0.1.el6.x86_64
radvd is needed by libvirt-0.10.2-29.0.1.el6.x86_64

First:

[root@OEL6 Packages]# rpm -ivh lzo

lzo-2.03-3.1.el6.x86_64.rpm       lzop-1.02-0.9.rc1.el6.x86_64.rpm
[root@OEL6 Packages]# rpm -ivh lzop-1.02-0.9.rc1.el6.x86_64.rpm 
warning: lzop-1.02-0.9.rc1.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Preparing…                ########################################### [100%]
   1:lzop                   ########################################### [100%]

Second :

[root@OEL6 Packages]# rpm -ivh numa

numactl-2.0.7-8.el6.i686.rpm
numactl-2.0.7-8.el6.x86_64.rpm
numactl-devel-2.0.7-8.el6.i686.rpm
numactl-devel-2.0.7-8.el6.x86_64.rpm
numad-0.5-9.20130814git.el6.x86_64.rpm

[root@OEL6 Packages]# rpm -ivh numad-0.5-9.20130814git.el6.x86_64.rpm 

warning: numad-0.5-9.20130814git.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Preparing…                ########################################### [100%]
   1:numad                  ########################################### [100%]

Third:
[root@OEL6 Packages]# rpm -ivh radvd-1.6-1.el6.x86_64.rpm 
warning: radvd-1.6-1.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Preparing…                ########################################### [100%]
   1:radvd                  ########################################### [100%]
Fourth :

[root@OEL6 Packages]# rpm -ivh augeas-libs-1.0.0-5.el6.x86_64.rpm
warning: augeas-libs-1.0.0-5.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Preparing…                ########################################### [100%]
   1:augeas-libs            ########################################### [100%]

[root@OEL6 Packages]# rpm -ivh netcf-libs-0.1.9-4.el6.x86_64.rpm
warning: netcf-libs-0.1.9-4.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Preparing…                ########################################### [100%]
   1:netcf-libs             ########################################### [100%]

Now you need to enable qemu-img like the below :

[root@OEL6 Packages]# rpm -ivh libgfortran-4.4.7-4.el6.x86_64.rpm
warning: libgfortran-4.4.7-4.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key                                                                              ID ec551f03: NOKEY
Preparing…                ########################################### [100%]
        package libgfortran-4.4.7-4.el6.x86_64 is already installed

[root@OEL6 Packages]# rpm -ivh qemu-img-0.12.1.2-2.415.el6.x86_64.rpm
warning: qemu-img-0.12.1.2-2.415.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature,                                                                              key ID ec551f03: NOKEY
error: Failed dependencies:
        libgfapi.so.0()(64bit) is needed by qemu-img-2:0.12.1.2-2.415.el6.x86_64
        libusbredirparser.so.1()(64bit) is needed by qemu-img-2:0.12.1.2-2.415.e                                                                             l6.x86_64
[root@OEL6 Packages]# rpm -ivh glusterfs-api-3.4.0.36rhs-1.0.1.el6.x86_64.rpm
warning: glusterfs-api-3.4.0.36rhs-1.0.1.el6.x86_64.rpm: Header V3 RSA/SHA256 Si                                                                             gnature, key ID ec551f03: NOKEY
Preparing…                ########################################### [100%]
   1:glusterfs-api          ########################################### [100%]
[root@OEL6 Packages]# rpm -ivh qemu-img-0.12.1.2-2.415.el6.x86_64.rpm
warning: qemu-img-0.12.1.2-2.415.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature,                                                                              key ID ec551f03: NOKEY
error: Failed dependencies:
        libusbredirparser.so.1()(64bit) is needed by qemu-img-2:0.12.1.2-2.415.e                                                                             l6.x86_64
[root@OEL6 Packages]# rpm -ivh usbredir-0.5.1-1.el6.x86_64.rpm
warning: usbredir-0.5.1-1.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, ke ID                                                                              ec551f03: NOKEY
Preparing…                ########################################### [100%]
   1:usbredir               ########################################### [100%]

[root@OEL6 Packages]# rpm -ivh qemu-img-0.12.1.2-2.415.el6.x86_64.rpm
warning: qemu-img-0.12.1.2-2.415.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature,                                                                              key ID ec551f03: NOKEY
Preparing…                ########################################### [100%]
   1:qemu-img               ########################################### [100%]

Finally the last Package :

[root@OEL6 Packages]# rpm -ivh ebtables-2.0.9-6.el6.x86_64.rpm
warning: ebtables-2.0.9-6.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Preparing…                ########################################### [100%]
   1:ebtables               ########################################### [100%]

[root@OEL6 Packages]# rpm -ivh libvirt-0.10.2-29.0.1.el6.x86_64.rpm

warning: libvirt-0.10.2-29.0.1.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Preparing…                ########################################### [100%]
   1:libvirt                ########################################### [100%]

we have to download two more package 

[root@OEL6 Packages]# rpm -ivh lxc-0.9.0-2.0.5.el6.x86_64.rpm

warning: lxc-0.9.0-2.0.5.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Preparing…                ########################################### [100%]
   1:lxc                    ########################################### [100%]

[root@OEL6 u01]# rpm -ivh docker-io-0.7.0-14.el6.x86_64.rpm
warning: docker-io-0.7.0-14.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing…                ########################################### [100%]
   1:docker-io              ########################################### [100%]

Now you Can Use Docker 🙂 I will post more blog about this Package and how to use.
Thank you 
Osama Mustafa

Oracle SOA Installation on Solaris 11.1

Another Post Describe how to install Oracle SOA, Steo by Step To Install Oracle SOA and Extend Admin Server.

As Usual you can download this document From SlideShare.

Download Document Here.

Thank you
Osama Mustafa

Oracle Business Intelligence Installation

Before start describes steps, I would like to share some notes:
  •     Extend Weblogic Server will not work (config.sh).
  •    BI server should be added first before any managed server otherwise AdminServer will corrupted.
  •   If you already have AdminServer configured you can created new BI Domain, Or backup your AdminServer  domain and Reconfigure again.

The above notes are useful and must be considered before installing Oracle BI.
You can download the document from Here
Thank you

Osama Mustafa

Step by Step Configure SSO Using Oracle Fusion Middle-ware

I would like to share this document , which is describe step by step dealing with :

  • WebLogic
  • Oracle Internet Directory
  • Oracle Content Server
  • Oracle Access manager 
Every thing mentioned with Installation &  Configuration Steps.
I tried To make it simple as i can, Included with Screen Shots ,Step By Step how to install The above Oracle Products and how to configure them to prepare your application for Single-Sing-On 
Please if you would like to share this document ask me before.

You can View and Download the Document from Here
Thank you 
Osama mustafa