Docker – Apache and Oracle mod_wl (Apache HTTP Server Plug-In)

Maybe a lot of you have already heard and maybe even mastered Docker. This is my first docker image and I’ll like to share some basic concepts I have learned from it.

I will also appreciate any comment to improve this image.

So, what is Docker?

Wikipedia: “Docker is an open-source project that automates the deployment of applications inside software containers, by providing an additional layer of abstraction and automation of operating-system-level virtualization on Linux”

I see it like a nice way to automate tasks (avoid repeating the same task over and over) and making a container of it, allowing me to use it “where ever” I want.

Basic Docker Operations:

Build

docker build -t [username]/[imagename] [Dockerfile path]

docker build  -t   mfh/webtier  /home/docker/webtier/.

This will use a Dockerfile stored in “/home/docker/webtier/” to create an image called “mfh/WebTier”.

Run

docker run [arguments] [image]

docker run -p 80:80 mfh/webtier

docker run -it mfh/webtier /bin/bash

docker run -d -p 80:80 mfh/webtier

ps

docker ps

This will display the docker containers currently running and its name and id.

Exec

docker exec [running container id]

docker exec -it c357930de48c /bin/bash

This will allow you to look into a running container.

My Scenario:

We constantly have clients using a front end server to receive all the incoming requests and then send it to the final destination. In terms of Oracle this will mean, Apache Web Server with mod_wl.so redirecting to WebLogic ( More than half of the clients use OHS).

Hands On!

  1. Create a Dockerfile
  2. Download and / or create external files.
  3. Build Dockerfile
  4. Run the Docker container

Dockerfile

This file was based on appcontainers/apache.


FROM centos:centos7

MAINTAINER mauro.flores.g@gmail.com

ENV APP_NAME apache.local
ENV APACHE_LOG_DIR /var/log/httpd

# Clean, Update, and Install... then clear non English local data.
RUN yum clean all && \
yum -y update && \

# Install required packages
yum -y install httpd24.x86_64 mod_rewrite mod_ssl mod_env && \

# Remove yum cache this bad boy can be 150MBish
yum clean all && \
rm -fr /var/cache/*

# Remove locales other than english
RUN for x in `ls /usr/share/locale | grep -v -i en | grep -v -i local`;do rm -fr /usr/share/locale/$x; done && \
for x in `ls /usr/share/i18n/locales/ | grep -v en_`; do rm -fr /usr/share/i18n/locales/$x; done && \
rm -fr ca* den men wen zen && \
cd /usr/lib/locale && \
localedef --list-archive | grep -v -i ^en | xargs localedef --delete-from-archive && \
mv -f locale-archive locale-archive.tmpl && \
build-locale-archive

ADD apache-config.conf /etc/httpd/conf.d/

# Copy site
CMD ["mkdir", "/var/www/html"]
ADD site /var/www/html/

# Expose ports
EXPOSE 80
EXPOSE 443

#Copy Apache HTTP Server Plug-In
COPY ./mod_wl/lib/*.so /usr/lib64/httpd/modules/
COPY mod_wl.conf /etc/httpd/conf.d/
COPY mod_wl.load.conf /etc/httpd/conf.modules.d/

#Create Volume
VOLUME ["/var/www/html", "/var/log/httpd"]

# Start apache.
CMD /usr/sbin/httpd -D FOREGROUND

To run the container:

docker run -d -p 80:80 -v ~/docker/webtier/html:/var/ww/html webtier

More information regarding Docker:

https://docs.docker.com/

Advertisements

Jenkins User Conference London – World Tour 2015

I had the opportunity to attend to this conference and I want to share some quick notes about my experience, also to give you some information of what’s coming and share some resources.

2015-06-23 10.26.16

Based on the amount of people/companies attending, you can tell how the enterprise is paying more attention to Continuous Integration (CI) and Continuous Delivery (CD). This has as a consequence that Jenkins needs to start putting some order into what happens in the community and start driving Best Practices to it’s Best.

Now to the information:

Keynote by the Jenkins Master:

  • History of Jenkins
  • Docker integration with Jenkins
  • WorkFlow Plugin
  • Jenkins in Hardware
  • Jenkins and DevOps
  • Community Growth

I won’t go through all the sessions and I will just give a simplified version of what I think is worth mentioning in this post:

“Seven Habits of Highly Effective Jenkins Users”

Great session by Andrew Bayer, the community and some private companies have developed more than 1000 plugins already and is hard to know what to use, also the lack of initial documentation made people use Jenkins the best they could, this is what I take from his session:

  • Have a Production Environment and DON’T break it.
    • Upgrade only if you need to and if you plan to do so, don’t do it directly in Production.
    • Same applies for plugins already in use.
    • Backup your configuration files
  • Have multiple Masters and Slaves!!!
    • You can break this per teams or projects or how ever fits best in your organization.
  • Make sure you only install plugins you need.
    • In all environments, is great if you want to play with some, but do so in a development environment and erase it if it wasn’t useful.
  • Integrate with Other tools
    • Jira, Git, etc.

“How to optimize Automated Testing with Everyone’s Favorite Butler”
by Viktor Clerc

This was another good session, mainly about testing, for some it might seem repetitive as at this stage we all should be aware of best practices around testing, but there are a couple of things that are worth mentioning from this session:

  • “Developers are becoming Testers” / “Testers are Developers”
  • Continuous Delivery = Execution + Analysis = Speed + Quality
  • Cohn’s Pyramid
    • UI, Service, Unit.
  • FAIL FASTER!!!
    • Test Use Cases
      • Functional Coverage not Technical Coverage.
    • Involve users in every stage of the delivery process.

“Evolving the Jenkins UI”
by Tom Fennelly and Gus Reiber

Is there anything else to say? I think is great they are doing this, I’m pretty sure that this will make UX much better and it should improve productivity:

  • CSS Modularization
    • Using Less
  • JavaScript Modularization
  • Change of some components

You can get involved in here:

“Orchestrating Your Pipelines with Jenkins, Python and the Jenkins API”
by Pradeepto K. Bhattacharya

This session was related to a real life experience using Jenkin’s APIs with Python Wrappers. You can tell the APIs are quite limited but useful enough to start using them actively. This is what you can do with Python:

  • Create new jobs
  • Copy existing jobs
  • Delete jobs
  • Update jobs
  • Get a job’s build information
  • Get Jenkins master version information
  • Get Jenkins plugin information
  • Start a build on a job
  • Create nodes
  • Enable/Disable nodes
  • Get information on nodes

There are no official “Java Wrappers” for this API, but you can consume it as:

  1. XML
  2. JSON
  3. Python

You can get more information here: Jenkins

“Scaling Your Jenkins Master with Docker”
by Christophe Muller

I’m not an expert in Docker, well at least not yet, so my opinion might be irrelevant, never the less, I think this was a really good presentation in order to understand the level of integration between Jenkins and Docker.

“Scaling of Jenkins Pipeline Creation and Maintenance”
by Damien Coraboeuf

Another interesting session, where an extension of the Job DSL Plugin was presented which helps to simplify life when you have a “jungle” of jobs: Seed Plugin that it should help to automate the generation and maintenance of pipelines.

Implementation overview

“Jenkins Made Easy”
by Nobuaki Ogawa

I was tempted not to include this one in my post, but there is 1 diagram that is worth mentioning in here and is self explanatory regarding the confusion between Continuous Integration, Continuous Build, Continuous Testing, Continuous Delivery,Continuous Deployment and Continuous Feedback:

Continuous-Integration

If you wan’t more information please click the links provided in the post. I’m pretty sure there was much more than this in other sessions, if you have the slides please share them in the comments otherwise, thanks for reading.

P.S. If you tought I’ll leave Oracle out of this post think twice: Open Source Tools for Java Development

WebCenter Patch 11.1.1.9

I have been out for some time, but wanted to share the new WebCenter Release, I’ll create another post to provide a personal feedback.
JDeveloper 11.1.1.9
 
Download:
 
WebCenter Portal 11.1.1.9
 
Download:
 
What’s New:
 
WebCenter Content 11.1.1.9
 
Download:

http://www.oracle.com/technetwork/middleware/webcenter/content/downloads/index.html

What’s New:

Oracle Mobile Application Framework

After a long wait the evolution of Oracle ADF Mobile has been released, the name: Oracle Mobile Application Framework or MAF.
http://www.oracle.com/technetwork/developer-tools/maf/overview/index.html

Documentation:
http://docs.oracle.com/middleware/mobile200/mobile/docs.htm

2014-07-03_0243

To use it, you just need to download JDeveloper 12c (12.1.3.0) and go to updates to download the extension.

JDeveloper 12c
http://www.oracle.com/technetwork/developer-tools/jdev/downloads/index.html

One of the most important improvements is the Security, and I’m not talking only about the Oracle Mobile Security Suite:
http://www.oracle.com/us/products/middleware/identity-management/mobile-security/overview/index.html

From the start of the application you start to notice important difference between the applications:

Oracle MAF

2014-07-03_0152

Oracle MAF

2014-07-03_0157

 

Oracle ADF Mobile

 

2014-07-03_0233

Oracle MAF

2014-07-03_0202_001

Oracle ADF Mobile

2014-07-03_0202

 

Oracle MAF

2014-07-03_0203

Oracle ADF Mobile

2014-07-03_0205

 

Oracle MAF

2014-07-03_0206I’ll go into details in future posts.

http://www.oracle.com/technetwork/developer-tools/maf/documentation/oraclemaf-datasheet-2220993.pdf
http://www.oracle.com/us/technologies/mobile/oracle-mobile-suite-ds-2085011.pdf

Customize Profile for users in WebCenter Portal (Spaces/Builder)

Have you notice that when using WebCenter Portal (Spaces/Builder) you can only modify specific things from your profile? Or how about preventing the user from changing his password?

2014-05-29_0455

Well this can be customized really easily for all your users, just login as an Admin user:

2014-05-29_04502014-05-29_0451
2014-05-29_04532014-05-29_0454You can also tune your application changing the cache settings for profile sync between Portal and your LDAP:

2014-05-29_0506

 

Oracle Access Manager – Custom Pages

I have been recently working on a project to customize OAM, sounds easy right? it is if you have the correct information, you have to pay attention to the details so you know what to look for and where you to find it:

Considerations:

  1. Custom pages does not mean Login page only
  2. Change password and dependants are also included
  3. Version of OAM 11.1.2.0.0
  4. Custom Pages technology JSP
  5. Cluster environment.

OAM Setup:

  1. Configure WebGate (Not part of this post)
  2. Create a New Authentication Scheme
  3. Update Password Service URL

New Authentication Scheme

  • Login to  oamconsole http:server:port/oamconsole
  • Create a New Authentication Scheme

2014-05-20_0140

The important bit:

  • Challenge Method: Form
  • Challenge URL:  Your login page
  • Context Type: external

2014-05-20_0136

Custom Pages

OAM provides a base project so you don’t have to start everything from scratch or at least it will give you an idea of the proper structure your project should have. You can use any web echnology you prefer, I’ll show the solution with JSP.

Login Page

 Get values from Header and from URL:

<%
 //Request OAM_REQ parameter from Header OAM Version 11.1.2
 String oamReq = request.getHeader("OAM_REQ");
 //Error code sent by OAM in case of failure
 String errCode = request.getHeader("p_error_code"); 

 String requestId = request.getParameter("request_id");
 String resourceUrl = request.getParameter("resource_url");
%>

The Form:

 <form name="ssoFrm" id="login" autocomplete="off"
 action="/oam/server/auth_cred_submit"
 method="POST">

 <label for="username">Username</label>
 <input name="userid" type="text" id="username"
 class="required"></input>

 <label for="password">Password</label>
 <input name="password" type="password" id="password"
 class="required" size="36"></input>

 <input name="request_id" value="<%=requestId%>"
 type="hidden"></input>

 <% if(oamReq != null && !"".equals(oamReq) ) { %>

 <input id="serverctx" name="OAM_REQ" type="hidden"
 value='<%=oamReq%>'/>
 <% }%>

<%
if(!errCode.equals("")){
//You can map this value in a Resource Bundle
 errorMessage=errCode;
 }
 %>
 <%=errorMessage%>

 <button id="sSubmit" name="sSubmit" type="submit">
Login</button>
 </form>

Change Password

Make sure you change the Password Service URL to point to your custom page: 2014-05-21_0331   Change Password  Page must contain:

 
<%
 //Set the Expires and Cache Control Headers
 response.setHeader("Cache-Control", "no-cache, no-store");
 response.setHeader("Pragma", "no-cache");
 response.setHeader("Expires", "0");
 response.setContentType("text/html; charset=UTF-8");
%>

There are 2 considerations we need to take into account for this page:

  1. Get policy rules from OAM
  2. In case of errors being present get password error messages
 
 <%
String reqId = request.getParameter(GenericConstants.REQUEST_ID);
//Password Policies
String rules=request.getParameter("ruleDesc");
//In case of error, gets the error messages
String errorCode=request.getHeader("p_error_code");
String errorMsg=request.getParameter("p_sec_error_msg");
//Type of the request.
String type= request.getParameter("type");
//In case of not following Password Policies, errors thrown back.
String rejectedRules=request.getParameter("rejectedRuleDesc");
%>
 
  <%
 if(type.equals("CHANGE_ACCEPT")){
 String redirectURL = "LandingPage.jsp";
 response.sendRedirect("/"+redirectURL);
 }
%>
 
<%
 String rejectedMsg = "";
 if(rejectedRules != ""){
 if(rejectedRules.indexOf('~') != -1) {
 String[] rejected = rejectedRules.split("~");
 for(String eachResult : rejected) {
 if(eachResult.indexOf(":") != -1) {
 String messageKey = eachResult.substring(0, eachResult.indexOf(":"));
 String placeHolderValue = eachResult.substring(eachResult.indexOf("::") + 2, eachResult.length());
 String msgString = props.getProperties().getProperty(messageKey);
 String message = MessageFormat.format(msgString, placeHolderValue);
 String displayValue = placeHolderValue;
 rejectedMsg +=message + "";
 }
 else {
 String resourceBundleKey = eachResult;
 String msgString = props.getProperties().getProperty(resourceBundleKey);
 if(null != msgString){
 rejectedMsg += msgString +"";
 }
 }
}
}
}
%>

Log the user in when the change is accepted:

<%
if(type.equals("CHANGE_ACCEPT")){
 %>
<script type="text/javascript">
 window.document.forms[0].submit();
 </script>
 <%
 }
 %>
References:
http://docs.oracle.com/cd/E40329_01/dev.1112/e27134/custpages.htm

WebCenter Pagelet Producer – Part 1

In one of my previous posts I wrote about Web Clipping, this time I’ll like to write something about WebCenter Pagelet Producer :

  1. How to create a Resource
  2. How to extract Content
  3. How to Inject Content (In the extracted content)
  4. How to consume a Pagelet

WebCenter Pagelet Producer

Allows you to publish content from back-end applications via pagelets. A pagelet is a reusable UI component that can run on any web page or web application. 

In other words is a Mashup Enabler.

Example: You have a requirement where you need to integrate different pieces of content from an external page/system into your Web Application/ Portal ( HR Intranet wants to display content from Finance Intranet)

Hands On

Requirements

  1. Oracle WebCenter Server
  2. Have WC_Portlet Managed Server Running
  3. Admin user (ex. weblogic)
  4. The URL of the Application where you want to extract information
    I’ll use infoMENTUM’s.

Login to WebCenter Pagelet Producer Admin:
http://server:8889/pagelets/admin

2014-04-05_2042
To create a resource (Pagelet and its resources):
2014-04-05_2042_002

2014-04-05_2043
For the Source URL make sure to keep it generic so in the future you can access all the levels of the Application (ex. http://www.infomentum.com/uk/). It’s recommended to always select DHTML Rewriting.
2014-04-05_2048
Now the important part, the Pagelet.
2014-04-05_2058
Insert the General information for your Pagelet.

In the URL Suffix include the rest of the URL to access the resource you want to access (ex. about-us/media-centre/videos-and-webcasts/generationc).

The final URL will look like this when browsed for Content: http://www.infomentum.com/uk/about-us/media-centre/videos-and-webcasts/generationc

2014-04-05_2139
To extract the content you’re looking for, go to the Clipper section and create a new one:
2014-04-05_2136_001
To extract content you have two different ways of doing it:
Graphical Clipper: It will open a window with the content URL so you select the piece of content you want to clip to your Pagelet.
Advanced Clipper: You need to add the tag and an attribute of that tag so it gets recognized by the Clipper.

 

2014-04-05_2140

 

2014-04-05_2141

 

2014-04-06_0300
Now let’s use a bit of Injection:
2014-04-06_1349
Select where do you want to inject your content, this can be as simple as a string.

2014-04-06_1354
Write the content you want to inject:

 

2014-04-06_1357
Final Result:2014-04-06_1402

If you want to know how to access your Pagelet go to the Documentation section:
2014-04-06_0242_001
You can select your preferred method for integration, REST or Javascript.

That’s it for a basic Pagelet I’ll talk about Advance Features in a following post.

 

Oracle ADF Faces Cookbook as a Technical Reviewer

Oracle ADF

Author: Amr Gawish
Technical Reviewers: Mauro Flores, Matteo Formica, Bejoy thomas, Victor Jabur, Daniel Ribeiro

I recently had the opportunity to review this cookbook. As you might or might not know, cookbooks are meant for people to learn/know about a specific topic following recipes, this makes life easier for the reader but it makes it complex for the author to keep it simple but at the same time useful.

Amr Gawish did a great job with this book, he really tried to kept it focus to what it really matter, that in this case was ADF Faces.

We need to remember that ADF follows an MVC Architecture, for this reason it’s important to distinguish the difference between every layer, so it’s not the same to say ADF than ADF FACES. The latter is the front end or view layer of the ADF Framework.

From my personal point of view I like this book because it covers the most important topics of ADF FACES, it has interesting recipes about complex and basic topics and part of my recommendations was to always follow best practices, which he tries to encourage.

As mentioned before this will only cover one layer of the ADF Framework but it does a good job with it, I’ll recommend you to have a complimentary book to understand or have your recipes to hand regarding the other two layers.

It doesn’t matter if you’re a beginner or an expert in ADF, this book needs to be part of your library.

http://www.packtpub.com/oracle-adf-faces-cookbook/book

Hands On Time! – WebCenter Portal Tools part 1

When it comes to Portal I’m not a big fan of using Portlets, don’t get me wrong they are great but they can get messy if you’re not careful enough, whenever I can I prefer to use ADF TaskFlows….. yes yes I know they are made for different things and Yannick Ongena has a good article about it.  But the portlets that WebCenter bundles are really useful if you know how to use them. Let’s start with “Portal Tools”:

Web Clipping Producer

Is a publishing portlet that enables you to integrate any web application with applications built using Oracle WebCenter.

Requirements:

  1. JDeveloper with WebCenter Extension. I’m using (11.1.1.8)
  2. Demo WebCenter Portal Framework Application

You don’t have to install a full WebCenter environment to work with this, we’ll make use of the one integrated in JDeveloper: 1. Start your integrated WebLogic Server 2014-03-02_2356 2. Deploy PortalTools Portlet Producer 2014-03-02_2153 2014-03-03_0228

3. Create a new Oracle PDK-Java Producer connection:

2014-03-03_0237

2014-03-03_0238 2014-03-03_0241 2014-03-03_0242

2014-03-03_0243

4. Drag and Drop the portlet to your page. In my case I’m using home.jspx.
NOTE: You can use the portlet as many times as you want inside the page.

2014-03-03_0248

5. Run your Portal,  Login and go to your page:

2014-03-03_0250

6. Edit the Portlet:

2014-03-03_0250_001

7. Now the interesting part, select the site where you would like to take your “Mash-ups” from, in this example I’m using Oracle – WebCenter : http://www.oracle.com/technetwork/middleware/webcenter/suite/overview/index.html

2014-03-04_0019

2014-03-04_00182014-03-04_0019_0012014-03-04_0019_0022014-03-04_00212014-03-04_00222014-03-04_0022_001

8. Repeat this procedure for all the portlets:

2014-03-04_0028

NOTE: You can add more WebClipping Portlets in run time with Composer.

Create a free website or blog at WordPress.com.

Up ↑

%d bloggers like this: