Quickstart Apex with docker-compose v2

As I read an article about Oracle providing version 23c “for free to developers” (https://blogs.oracle.com/database/post/oracle-database-23c-free) I wondered if it was usable for a quick deploy of Apex. As ORDS has been updated as well it turns out that needed some tweaking…

Incorporating the 23c release of the Oracle database is quite easy. Just specify the url where to get the image. Changing to ORDS version 22 required a bit more tweaking.

Oracle has changed the way you configure ORDS in a silent install, no more ords_params.properties but command-line options. And no more calling the war file, but a command file. You can read about the “old” installation in Quickstart Apex with docker-compose. This post is mainly about the changes in relation to that post.

So which changes were needed? First the docker-compose file needed changes to incorporate the image oracle provides in their container registry.

version: '2'

                cpu_count: 2
                image: container-registry.oracle.com/database/free:latest
                container_name: 23c_free
                restart: always
                        - /opt/DockerData/Oracle/containers/23cApex22/oradata:/opt/oracle/oradata
                        - /opt/DockerData/Oracle/containers/23cApex22/stage:/opt/stage
                        - /opt/DockerData/Oracle/containers/23cApex22/scripts:/opt/scripts
                        - 1522:1521
                #image: tomcat:9.0
                image: ords
                build: buildOrds
                        - ApexDB
                container_name: ords
                restart: always
                        - /opt/DockerData/Oracle/containers/23cApex22/stage/apex/images:/usr/local/tomcat/webapps/i
                        - 8081:8080
                        - ApexDB

Next, the build script for the ORDS container had one of the commands removed (setting the config dir within the war file). And also the ords_params.properties file is no longer required.

FROM tomcat:9.0

RUN mkdir -p /opt/ords
COPY ords-latest.zip /opt/

RUN unzip /opt/ords-latest.zip -d /opt/ords
RUN mkdir -p /opt/ords/conf
COPY first_run.sh /
RUN chmod +x /first_run.sh

CMD /first_run.sh

The start-up script needed some changes as well, as the installation procedure for ORDS has changed.

# Apex startup script v 1.1
# Checks if this is the first run, if so perform installation, if not
# just copy the war file (to be on the safe side) and fire up Tomcat
# (c) 2023 Patrick v Zweden


export JAVA_OPTS="-Dconfig.url=/opt/ords/conf/"

if [ -e /INSTALLED ]; then
        cp /opt/ords/ords.war /usr/local/tomcat/webapps
        catalina.sh run
        echo "First run, setting up the system..."
        echo "First wait a bit for Oracle to stabilize...."
        sleep 60
        cd /opt/ords
        bin/ords --config /opt/ords/conf/ install \
                --admin-user sys \
                --db-hostname ${ORACLE_DB_HOST} \
                --db-port 1521 \
                --db-servicename ${ORACLE_DB} \
                --feature-sdw true \
                --feature-db-api true \
                --feature-rest-enabled-sql true \
                --gateway-mode proxied \
                --gateway-user APEX_PUBLIC_USER \
                --proxy-user --password-stdin <<PASSWD
        if [ $? -eq 0 ]; then
                touch /INSTALLED

        cp ords.war /usr/local/tomcat/webapps
        catalina.sh run

And because the database naming is different from “self-build” images the installation script for kicking off the APEX installation needed some changes as well. To get a new version of the installation scripts, see the end of this post.

So, it took a bit of tweaking but it then you have Oracle APEX with the newest version of ORDS (22) and the newest Oracle Database (23c).