Docker & Essbase Session ID: 10928

Bring the Cloud To You Prepared by: Jason Jones Senior Solutions Architect Applied OLAP

Remember to complete your evaluation for this session within the app! About the Speaker

• Essbase/Hyperion • Java • Drillbridge • Oracle ACE • Applied OLAP • Blogging Agenda/Goals

• Introduce Docker • Docker Concepts • View simple Docker example • Apply Docker to Essbase • Q & A • Back of this slide deck contains brief overview of Essbase Dockerfile usage What is Docker?

• Containerization technology • Think of a container as a portable VM for a single application • Build up a machine image based on layers • Thinner than a VM Traditional Web App Installation

• Consider an application such as Dodeca that has: – (MySQL) – web server (Apache Tomcat) – servlet files (dodeca.war) – requires Java • Sequence: – Install/verify Java – Install Tomcat – Setup database schema – Deploy WAR – Misc (open ports, config files, etc.) Containerized Web Application

• Just pull/run the Dodeca image that was built from a Dockerfile • Additional config: – Map ports such as 80 -> 8080 – Set environment variables/parameters • Integrate the Docker image build process into continuous integration • Don’t need to worry about installing prerequisites Virtual Machine vs. Docker Containers Docker Container vs. Virtual Machine

• Layered filesystem vs. monolithic • Inherit from parent containers, e.g.: – base OS • Install Java – Copy program files • VM – Needs full OS – Consumes more space (OS files, etc.) – Startup time Getting Started with Docker

• Downloads available for Linux, Mac, Windows • Runs natively on Linux • Mac/Windows will use a very small Linux VM (VirtualBox) Docker “Hello World” Example

• Assume with me, for a moment, that the following is true: – There are various organizations that have publicly available Docker images – These images are located in a central, public repository – The Docker software/client is installed on my local machine • Let’s run a Docker test/”Hello World” image that is simply a web server that shows a single web page • This will result in my machine running a fully configured webserver • NGINX – Web server – Has publicly available Docker images Run It

docker run -p 8000:80 -d nginxdemos/hello

Program Command Map host port to Detached Image container port Docker Web Server Example

Jasons-MBP:jasonwjones$ docker run –p 8000:80 -d nginxdemos/hello Unable to find image 'nginxdemos/hello:latest' locally latest: Pulling from nginxdemos/hello 550fe1bea624: Pull complete d421ba34525b: Pull complete fdcbcb327323: Pull complete bfbcec2fc4d5: Pull complete 0497d4d5654f: Pull complete File system layers being pulled/cached f9518aaa159c: Pull complete a70e975849d8: Pull complete Digest: sha256:f5a0b2a5fe9af497c4a7c186ef6412bb91ff19d39d6ac24a4997eaed2b0bb334 Status: Downloaded newer image for nginxdemos/hello:latest 1bfa522e41617570f7ed0c1648075818ac6383e671c00bfc14297ef2ca3845aa Jasons-MBP:jasonwjones$ A Simple Docker Web Server Running What just happened?

• Components (files) of the docker image were not in cache and were pulled from a global repository • A running container was created from the image • On Mac/Windows, the container is running in a tiny Linux VM (would be running natively on Linux) • The container contains all programs/data necessary to run • The host port 8000 was mapped to the container’s port 80 • Accessed via our web browser The Dockerfile

• Contains a recipe for building a Docker image • Relatively few types of commands • Builds the image based on an exact sequence of commands and files • Generally is in software version control – Can refine over time and make improvements Dockerfile Commands

• FROM • VOLUME • RUN • ARG • CMD • ONBUILD • LABEL • STOPSIGNAL • ADD/COPY • HEALTHCHECK • ENTRYPOINT • SHELL • USER • MAINTAINER • WORKDIR • ARG Source Code Mainline Notes

• Alpine Linux often used • Install packages via command-line Docker & Essbase Stand up an Essbase Server in minutes

• Exactly the same every single time • Clean slate • Do anything you want • Throw it away when done (or keep it, whatever) Cattle, not pets. Containerizing Essbase

• Essbase 11.1.2.4 on Linux • Oracle relational backend • Support development/testing • Not for production Not. For. Production.

• Really. About the Image

• Based on CentOS 6.9 • Note on Linux flavors: – Red Hat Enterprise Linux (RHEL) – CentOS – Oracle Enterprise Linux (OEL) • 5-10 minute bootup – Can probably shrink this down a good bit (DB2?) – Oracle backend • “Fat image” (db + Essbase combined) • Simple stub/launcher page Use Cases (Bringing the Cloud)

• Testing/development – Dodeca – Drillbridge – Getting an Essbase server up and running very quickly for any purpose • Programming – Java API • Experimental automation • Test an idea without fear Files

Dockerfile Essbase-11124-linux64.zip Foundation-11124-linux64-Part1.zip Foundation-11124-linux64-Part2.zip Foundation-11124-linux64-Part4.zip Foundation-11124-Part3.zip linuxamd64_12102_database_se2_1of2.zip linuxamd64_12102_database_se2_2of2.zip docker-essbase-startup.sh load-sample-.msh README.md silentInstall. site/ Building the Image docker build -t essbase . Example Run Command (using already built image)

• docker run -d --rm --name essbase -p 9000:9000 -p 80:8080 -- add-host epmvirt:127.0.0.1 essbase

• Options – -d – run detached – --rm – delete after running – --name – give container specific name – -p 9000:9000 – map host port 9000 to container port 9000 (compact Essbase deployment port) – -p 80:8080 – map host web port 80 to container port 8080 (running a convenience web page with links) – --add-host epmvirt:127.0.0.1 – add a host entry (required by current configuration) Simple Jump Page Launch EAS via JNLP Convenience EAS Launcher

#!/bin/bash javaws http://dockertest.corp.appliedolap.com:9000/easconsole/easconsole .jnlp

(above as all one line) EAS – Add EssbaseCluster-1 Smart View Connection Future Improvements

• DB2 backend – DB2 has a very nice, fast, compact Docker image • Multi-stage build – save space on final image • Preload Sample/Basic with data • MaxL on PATH • Note on Compose/Swarm/Kubernetes • Oracle & Docker How You Can Use This

• Please contact me directly for now – Dockerfile + related scripts • I am researching the feasibility of releasing this as an open-source project Thanks!

• Q & A • Blog: https://www.jasonwjones.com • Sample Essbase Dockerfile at end of this presentation • Email me for the files you need Essbase Dockerfile Prerequisites

• Docker installed • Essbase ZIP files in folder • Oracle RDBMS files in folder • Then run docker build command, e.g.: – docker build -t essbase . Files

Dockerfile Essbase-11124-linux64.zip Foundation-11124-linux64-Part1.zip Foundation-11124-linux64-Part2.zip Foundation-11124-linux64-Part4.zip Foundation-11124-Part3.zip linuxamd64_12102_database_se2_1of2.zip linuxamd64_12102_database_se2_2of2.zip docker-essbase-startup.sh load-sample-databases.msh README.md silentInstall.xml site/ Make Sure Host (Linux) Has Enough Swap dd if=/dev/zero of=/swapfile bs=1024 count=1024k && \ chmod 0600 /swapfile && \ chown root:root /swapfile && \ mkswap /swapfile && \ swapon /swapfile && \ swapon -s Dockerfile – Beginning

FROM centos:6.9

LABEL maintainer="[email protected]"

RUN touch /var/lib/rpm/* && yum -y install zip \ emacs \ unzip \ xauth \ xdpyinfo \ compat-libcap1 \ libstdc++-devel \ sysstat \ gcc \ gcc-++ \ Base, Cont’d ksh \ libaio \ libaio-devel \ lsof \ numactl \ glibc-devel \ glibc-devel.i686 \ libgcc \ libgcc.i686 \ compat-libstdc++-33 \ compat-libstdc++-33.i686 \ openssh-clients Add/Extract Oracle RDBMS

ENV DOWNLOAD_HOME /u0/install/downloads ENV ORACLE_INSTALL_STAGING_HOME /u0/install/oracle_db

COPY linuxamd64_12102_database_se2_1of2.zip $DOWNLOAD_HOME RUN unzip $DOWNLOAD_HOME/linuxamd64_12102_database_se2_1of2.zip - d $ORACLE_INSTALL_STAGING_HOME && \ rm $DOWNLOAD_HOME/linuxamd64_12102_database_se2_1of2.zip

COPY linuxamd64_12102_database_se2_2of2.zip $DOWNLOAD_HOME RUN unzip $DOWNLOAD_HOME/linuxamd64_12102_database_se2_2of2.zip - d $ORACLE_INSTALL_STAGING_HOME && \ rm $DOWNLOAD_HOME/linuxamd64_12102_database_se2_2of2.zip Add Essbase Zips (from E-Delivery)

COPY Foundation-11124-linux64-Part1.zip $DOWNLOAD_HOME COPY Foundation-11124-linux64-Part2.zip $DOWNLOAD_HOME COPY Foundation-11124-linux64-Part4.zip $DOWNLOAD_HOME COPY Foundation-11124-Part3.zip $DOWNLOAD_HOME COPY Essbase-11124-linux64.zip $DOWNLOAD_HOME Oracle RDBMS Config

COPY u0/automation/database/init.ora /u0/automation/database COPY u0/automation/database/installDB_main.sh /u0/automation/database

RUN su - oracle -c "/u0/install/oracle_db/database/runInstaller -silent - waitforcompletion -showProgress -ignorePrereq -responseFile /u0/automation/database/db.rsp" && \ /u0/app/oraInventory/orainstRoot.sh && \ /u0/app/oracle/product/12.1.0/dbhome_1/root.sh Environment

USER oracle

ENV SID HYPDB ENV ORACLE_HOME /u0/app/oracle/product/12.1.0/dbhome_1 ENV LD_LIBRARY_PATH ${ORACLE_HOME}/lib ENV ORACLE_SID $SID ENV TNS_ADMIN /u0/app/oracle/product/12.1.0/dbhome_1/network/admin/${SID} ENV WEB_PORT 9000 ENV PATH="${ORACLE_HOME}/bin:/u0/Oracle/Middleware/user_projects/epmsystem1/ EssbaseServer/essbaseserver1/bin:${PATH}" Extract Essbase Zips

RUN unzip -o /u0/install/downloads/Foundation-11124-linux64-Part1.zip -d /u0/install/epm && \ unzip -o /u0/install/downloads/Foundation-11124-linux64-Part2.zip -d /u0/install/epm && \ unzip -o /u0/install/downloads/Foundation-11124-linux64-Part4.zip -d /u0/install/epm && \ unzip -o /u0/install/downloads/Foundation-11124-Part3.zip -d /u0/install/epm && \ unzip -o /u0/install/downloads/Essbase-11124-linux64.zip -d /u0/install/epm Add Installer Response Files

COPY silentInstall.xml /u0/automation/epm/ RUN /u0/install/epm/installTool.sh -silent /u0/automation/epm/silentInstall.xml RDBMS Config

RUN mkdir -p /u0/app/oracle/admin/$SID/arch && \ mkdir -p /u0/app/oracle/admin/$SID/flash_recovery_area && \ mkdir -p /u0/app/oracle/oradata/$SID/ && \ mkdir -p /u0/app/oracle/admin/$SID/adump && \ mkdir -p $TNS_ADMIN && \ cp /u0/automation/database/listener.ora $TNS_ADMIN && \ -p -i -e s/__SID__/$SID/g $TNS_ADMIN/listener.ora && \ cp /u0/automation/database/tnsnames.ora $TNS_ADMIN && \ perl -p -i -e s/__SID__/$SID/g $TNS_ADMIN/tnsnames.ora && \ cp /u0/automation/database/init.ora $ORACLE_HOME/dbs/init$SID.ora && \ perl -p -i -e s/__SID__/$SID/g $ORACLE_HOME/dbs/init$SID.ora More DB Config

RUN sqlplus / as sysdba < /u0/automation/database/installDB_1.sql

RUN echo "startup;" | sqlplus / as sysdba && \ cp /u0/automation/database/install_DB_create_db. /tmp/ && \ perl -p -i -e s/__SID__/$SID/g /tmp/install_DB_create_db.sql && \ sqlplus / as sysdba < /tmp/install_DB_create_db.sql && \ sqlplus system/orcl < /u0/app/oracle/product/12.1.0/dbhome_1/sqlplus/admin/pupbld.sql && \ cp /u0/automation/database/install_DB_create_objects.sql /tmp/ && \ perl -p -i -e s/__SID__/$SID/g /tmp/install_DB_create_objects.sql && \ sqlplus / as sysdba < /tmp/install_DB_create_objects.sql Final Config

WORKDIR /home/oracle

COPY load-sample-databases.msh . COPY --chown=oracle:oracle docker-essbase-startup.sh . COPY site/* ./ RUN perl -p -i -e s/__PORT__/$WEB_PORT/g index.html

EXPOSE 8080 9000

CMD ["./docker-essbase-startup.sh"] Load Sample Databases Script login "admin" "password" on "localhost"; import database "Sample"."Basic" data from server data_file "Calcdat" on error abort; execute calculation default on "Sample"."Basic"; Docker Startup Script

#!/bin/bash

echo "startup;" | sqlplus / as sysdba lsnrctl start $SID

/u0/Oracle/Middleware/EPMSystem11R1/common/config/11.1.2.0/configtool.sh -silent /u0/automation/epm/EPMconfig_Foundation.xml /u0/Oracle/Middleware/EPMSystem11R1/common/config/11.1.2.0/configtool.sh -silent /u0/automation/epm/EPMconfig_Essbase.xml

/u0/Oracle/Middleware/user_projects/epmsystem1/bin/start.sh

# should be invoked from /home/oracle, which should be the working dir python -m SimpleHTTPServer 8080 &

# load and calc sample databases in background startMaxl.sh load-sample-databases.msh &

tail -F /u0/Oracle/Middleware/user_projects/domains/EPMSystem/servers/EPMServer0/logs/apsserver.log Launch Essbase Docker Container docker run -d --rm --name essbase \ -p 9000:9000 -p 80:8080 \ --add-host epmvirt:127.0.0.1 essbase

Or as little as: docker run --add-host epmvirt:127.0.0.1 essbase [email protected]

Session ID: 10928

Remember to complete your evaluation for this session within the app!