Skip to Main Content

ORDS, SODA & JSON in the Database

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Docker with Tomcat

partlycloudyOct 11 2019 — edited Oct 12 2019

All the resources, blog posts and Github repos out there around building and running the Oracle, APEX, ORDS, etc. stack while extremely helpful don't quite address a Production deployment.

They either do too much (run Oracle in a container, install APEX/ORDS) or do too little.

I would like to build a Docker image to acesss just the APEX runtime engine (ORDS REST API stuff not needed other than the /r/{xxx} used to serve up APEX app/workspaces/plugin files over ORDS)

So starting with

  1. FROM oracle/serverjre:8
  2. Add Tomcat latest
  3. Add ORDS latest
  4. Build the image with Tomcat webapps/ords.war
  5. The following volumesĀ  on the host server are available
    1. images folder from the APEX distribution with the static files
    2. Tomcat defaults.xml file (contains host:port:sid to connect to existing Oracle instance that already has APEX installed) and conf/ folder containing apex*.xml files (contain username & password for Oracle userids used by ORDS/APEX)
  6. Run the container - preferably with no parameters since the Tomcat config files already identify required components
  7. APEX should be accesible over the standard HTTPS port 443
    1. Install SSL certificate into Java keystore?
    2. Use nginx to reverse proxy the port exposed by the Docker container?

How can I go about doing this? Any guidance appreciated.

Thanks

Update: This turned out to be pretty straightforward if you start with a Tomcat base image from Docker Hub, here is my Dockerfile

# From Docker Hub [docker pull tomcat]

FROM docker.io/tomcat:latest

# Copy ORDS webapp

COPY ords.war /usr/local/tomcat/webapps/apex.war

# Copy static files

COPY images-19.1.zip /tmp

# Copy config files

COPY apex.zip /tmp

# Unzip

RUN unzip /tmp/images-19.1.zip -d /usr/local/tomcat/webapps/i && rm /tmp/images-19.1.zip \

&& unzip /tmp/apex.zip -d /usr/local/tomcat/apex && rm /tmp/apex.zip \

&& java -jar /usr/local/tomcat/webapps/apex.war configdir /usr/local/tomcat/apex

EXPOSE 8080

CMD ["catalina.sh", "run"]

Build the image and run the container

docker build -t apex .

docker run -p 8080:8080 --name apex -dit apex

The APEX URL is http://host:8080/apex

I still need help with #7 i.e. how can I use HTTPS over the standard port 443?

Also, what is a good HEALTHCHECK script to include in the Dockerfile so that docker ps reports container health? The purpose of the container is to provide access to APEX so the script should verify that APEX is up and running, static files ,both the /i/ and /r/{xxx}/ are available, etc.

Thanks

Comments
Post Details
Added on Oct 11 2019
0 comments
2,103 views