Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Modernizing Oracle Tuxedo Applications with Python

You're reading from   Modernizing Oracle Tuxedo Applications with Python A practical guide to using Oracle Tuxedo in the 21st century

Arrow left icon
Product type Paperback
Published in Mar 2021
Publisher Packt
ISBN-13 9781801070584
Length 202 pages
Edition 1st Edition
Languages
Concepts
Arrow right icon
Author (1):
Arrow left icon
Aivars Kalvans Aivars Kalvans
Author Profile Icon Aivars Kalvans
Aivars Kalvans
Arrow right icon
View More author details
Toc

Table of Contents (18) Chapters Close

Preface 1. Section 1: The Basics
2. Chapter 1: Introduction and Installing Tuxedo FREE CHAPTER 3. Chapter 2: Building Your First Tuxedo Application 4. Chapter 3: Tuxedo in Detail 5. Chapter 4: Understanding Typed Buffers 6. Section 2: The Good Bits
7. Chapter 5: Developing Servers and Clients 8. Chapter 6: Administering the Application Using MIBs 9. Chapter 7: Distributed Transactions 10. Chapter 8: Using Tuxedo Message Queue 11. Chapter 9: Working with Oracle Database 12. Section 3: Integrations
13. Chapter 10: Accessing the Tuxedo Application 14. Chapter 11: Consuming External Services in Tuxedo 15. Chapter 12: Modernizing the Tuxedo Applications 16. Assessments 17. Other Books You May Enjoy

Installing Tuxedo and Python

Oracle provides Dockerfiles and commands to build Docker images for Oracle products on GitHub (https://github.com/oracle/docker-images). Tuxedo is no exception, although Oracle considers it old content and has moved into an archive location where it is available today. Therefore, we will create more up-to-date Docker images ourselves.

To install Tuxedo, you must first download it from the Oracle website (http://www.oracle.com/technetwork/middleware/tuxedo/downloads/index.html). You will have to create an account if you don't already have one. Tuxedo is available for different operating systems: AIX, Linux, HP-UX, Solaris, and Microsoft Windows. For all examples in this book, we will use the latest release of Oracle Tuxedo 12cR2 (12.2.2) and an installation package that includes all the required add-ons called "Oracle Tuxedo 12cR2 (12.2.2)" (including Tuxedo, SALT, and Jolt) for Linux x86-64 (64-bit). The downloaded file will be named tuxedo122200_64_Linux_01_x86.zip.

Create a new folder and put the downloaded tuxedo122200_64_Linux_01_x86.zip file there. You will need to create tuxedo1222.rsp and Dockerfile files in the same folder as the downloaded file.

We start with tuxedo1222.rsp, which contains answers for Oracle Tuxedo installer so that it can be installed in silent mode:

RESPONSEFILE_VERSION=2.2.1.0.0
FROM_LOCATION="/home/oracle/Disk1/stage/products.xml"
ORACLE_HOME="/home/oracle/tuxhome"
ORACLE_HOME_NAME="tuxhome"
INSTALL_TYPE="Custom Install"
DEPENDENCY_LIST={"tuxedoServer:12.2.2.0.0","atmiClient:12.2.2.0.0"}
TLISTEN_PASSWORD="oracle"

This is a minimized response file that contains only the required responses. Here are the most important things:

  • FROM_LOCATION gives the location of the unpacked ZIP file.
  • ORACLE_HOME and ORACLE_HOME_NAME say that Tuxedo will be installed under /home/oracle/tuxhome.
  • INSTALL_TYPE says we will install only selected components.
  • TOPLEVEL_COMPONENT and DEPENDENCY_LIST say that only the core Tuxedo should be installed.

Then we need a Dockerfile file that contains instructions for building a Docker image:

FROM oraclelinux:8
RUN yum -y install oracle-release-el8 && \
    yum -y install \
           libnsl java-devel gcc-c++ python3-devel \
           unzip file hostname which sudo && \
    rm -rf /var/cache/yum
RUN groupadd oracle && \
        useradd -m -g oracle -s /bin/bash oracle && \
        echo 'oracle ALL=(ALL) NOPASSWD:ALL' \
        >> /etc/sudoers.d/oracle
USER oracle
COPY tuxedo1222.rsp tuxedo122200_64_Linux_01_x86.zip /home/oracle/
ENV ORACLE_HOME=/home/oracle/tuxhome \
    JAVA_HOME=/etc/alternatives/java_sdk
RUN cd ~/ && \
      jar xf tuxedo122200_64_Linux_01_x86.zip && \
      cd ~/Disk1/install && \
      chmod -R +x * && \
      ./runInstaller.sh -responseFile ~/tuxedo1222.rsp \
            -silent -waitforcompletion && \
      rm -rf ~/Disk1 && \
      rm -f ~/tuxedo1222.rsp ~/tuxedo122200_64_Linux_01_x86.zip
ENV TUXDIR=/home/oracle/tuxhome/tuxedo12.2.2.0.0
ENV PATH=$PATH:$TUXDIR/bin
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$TUXDIR/lib
USER root
RUN pip3 install tuxedo
USER oracle
WORKDIR /home/oracle

Once you have it, you can run the following command:

docker build -t tuxpy .

This command creates the Docker image. While it runs for several minutes, let's take a look at the most important steps:

  1. The Docker image will be created from Oracle Linux 8. Other Linux distributions may also be used, but the choice of Oracle Linux will come in handy when we start using the Oracle database.
  2. We run the yum package manager to install Python version 3, Java for running the Oracle Tuxedo installer, and the GCC compiler for building a Python module.
  3. We create a regular Linux user named oracle and give permissions to run sudo for installing other software packages.
  4. Once all the files are put into the container, the Tuxedo installation is unpacked.
  5. The Tuxedo installation is run in non-interactive mode with a response file containing all the necessary inputs. Tuxedo can also be installed using a graphical interface or console interface like all other Oracle products, which is handy if you don't use containers.
  6. We export the TUXDIR environment variable that points to the directory where Tuxedo is installed and set up program and library paths to include Tuxedo binaries.
  7. After that is done, the Python tuxedo module is installed using the pip3 tool.

After that, you can start the newly created image by using the following command:

docker run -ti --privileged tuxpy bash

If you are using Docker Desktop on Microsoft Windows, you may need to add winpty in front of the command:

winpty docker run -ti --privileged tuxpy bash

The --privileged parameter gives extended privileges to the container that will be needed in Chapter 3, Tuxedo in Detail to resize message queues.

If you have any preferences for a text editor or other tools, you can install them by using sudo yum install and the package name. As an exercise, take a look at the Python examples that use SCA under $TUXDIR/samples/sca/simp_python. It will make you appreciate the simplicity of your first Tuxedo application in Python, which we will create in the next chapter.

You have been reading a chapter from
Modernizing Oracle Tuxedo Applications with Python
Published in: Mar 2021
Publisher: Packt
ISBN-13: 9781801070584
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime