BLOG

COLLABORATE 19 – IOUG

First Conference of the year COLLABORATE 19 – IOUG “Inchallah”

Untitled

Will Deliver two presentation in this conference :-

  • The first one will be with my friend Sudhir Balasubramanian talking about Cloud.
  • The second one will deliver Python scripting and how to use it with Oracle.

I hope to you see guys there, Learn and share your knowledge with people.

You can Register for the conference here.

Cheers

Osama

Coding with Python

Python is a powerful high-level, object-oriented programming language created by Guido van Rossum.

It has simple easy-to-use syntax, making it the perfect language for someone trying to learn computer programming for the first time.

I Will keep working frequtely on this part and this programing langyage since i am using it on daily basis for different things such as Analytics, Scripting and Devops, for simple, easy to learn and more than this powerful.

For the begginers and people who wants simple code and examples i uploaded code samples on my github Press on the icon below.

icons8-github-50

 

Thank you

Osama

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

Clone Weblogic Software from One Machine to another

Cloning is the process of copying an existing entity to a different location while preserving its state. Some situations in which cloning Oracle Fusion Middleware is useful are:

  • Creating a Middleware home or Oracle home that is a copy of a production, test, or development environment. Cloning enables you to create a new Middleware home or an Oracle home with all patches applied to it in a single step. This is in contrast to separately installing, configuring and applying any patches to separate Oracle homes.
  • Preparing a “gold” image of a patched home and deploying it to many hosts.
When you move a Middleware home, you create an archive of the source Middleware home and use the archive to create the copy of the Middleware home:
  • ./copyBinary.sh -javaHome /u01/jdk -archiveLoc /u01/test.jar -sourceOracleHomeLoc /u01/Oracle/Middleware/fmw_soa
After this copy the jar file to new location and run the following command :-
  • ./pasteBinary.sh -javaHome /u01/jdk -archiveLoc /u01/test.jar -targetOracleHomeName /u01/osama/
It’s very simple and useful
Reference:-
Oracle Doc here.
Cheers
Osama

Oracle API Gateway Installation as cluster and single node

I wrote this article because there is no much information about this product to configure it as cluster so i choose to write it step by step to help people around the world in case they need information about this product.

this article is fully details and working on Solaris but the same steps could be follow for Unix/Linux and windows.

The Link here

Cheers
Osama

Oracle Database 18c (18.3) is now available / Oracle XE

  • Now you can download Oracle Database 18c (18.3) from OTN , Time for testing

Here

  • Also now you can download Oracle Database XE , free for everyone:-
    • Free Oracle Database for Everyone: 
    • Up to 12 GB of user data
    • Up to 2 GB of database RAM
    • Up to 2 CPU threads
    • Up to 3 Pluggable Databases

Here

Thank
Osama Mustafa