From 458cc5237c6b6b0fafeb638f0f8e33362b5e5b55 Mon Sep 17 00:00:00 2001 From: gamagec Date: Thu, 18 Jul 2024 14:36:46 +0930 Subject: [PATCH 01/11] Initial Commit --- .gitignore | 1 + OracleApplicationExpress/.gitignore | 1 + OracleApplicationExpress/README.md | 123 ++++++++++++++++ .../dockerfiles/Dockerfile | 34 +++++ .../dockerfiles/download_apex.sh | 37 +++++ .../dockerfiles/setup_apex.sh | 51 +++++++ .../dockerfiles/19.3.0/Dockerfile | 1 + OracleRestDataServices/dockerfiles/Dockerfile | 138 +++++++++--------- .../dockerfiles/Dockerfile_old | 81 ++++++++++ .../dockerfiles/buildImage.sh | 43 ++++++ .../dockerfiles/check_db_ready.sh | 24 +++ .../dockerfiles/download_ords.sh | 37 +++++ .../dockerfiles/gen_pool_xml.sh | 33 +++++ .../dockerfiles/ords_params.properties | 0 install_db_apex_ords.sh | 124 ++++++++++++++++ install_ords.sh | 0 setup_oracle.sh | 85 +++++++++++ setup_oracle_old.sh | 85 +++++++++++ 18 files changed, 826 insertions(+), 72 deletions(-) create mode 100644 OracleApplicationExpress/.gitignore create mode 100644 OracleApplicationExpress/README.md create mode 100644 OracleApplicationExpress/dockerfiles/Dockerfile create mode 100644 OracleApplicationExpress/dockerfiles/download_apex.sh create mode 100644 OracleApplicationExpress/dockerfiles/setup_apex.sh create mode 100644 OracleRestDataServices/dockerfiles/Dockerfile_old create mode 100644 OracleRestDataServices/dockerfiles/buildImage.sh create mode 100644 OracleRestDataServices/dockerfiles/check_db_ready.sh create mode 100644 OracleRestDataServices/dockerfiles/download_ords.sh create mode 100644 OracleRestDataServices/dockerfiles/gen_pool_xml.sh create mode 100644 OracleRestDataServices/dockerfiles/ords_params.properties create mode 100644 install_db_apex_ords.sh create mode 100644 install_ords.sh create mode 100644 setup_oracle.sh create mode 100644 setup_oracle_old.sh diff --git a/.gitignore b/.gitignore index 90f98f2337..b7d6f8ce8e 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ .idea/ .DS_Store .vscode/ +**/tmp/ diff --git a/OracleApplicationExpress/.gitignore b/OracleApplicationExpress/.gitignore new file mode 100644 index 0000000000..e43b0f9889 --- /dev/null +++ b/OracleApplicationExpress/.gitignore @@ -0,0 +1 @@ +.DS_Store diff --git a/OracleApplicationExpress/README.md b/OracleApplicationExpress/README.md new file mode 100644 index 0000000000..f2521e22da --- /dev/null +++ b/OracleApplicationExpress/README.md @@ -0,0 +1,123 @@ +# Oracle REST Data Services on Docker + +Sample Docker build files to facilitate installation, configuration, and environment setup for DevOps users. +For more information about Oracle REST Data Services (ORDS) please see the [ORDS Documentation](http://www.oracle.com/technetwork/developer-tools/rest-data-services/documentation/index.html). + +## How to build and run + +This project offers sample Dockerfiles for Oracle REST Data Services + +To assist in building the images, you can use the [buildContainerImage.sh](dockerfiles/buildContainerImage.sh) script. See below for instructions and usage. + +The `buildContainerImage.sh` script is just a utility shell script that performs MD5 checks and is an easy way for beginners to get started. Expert users are welcome to directly call `docker build` with their preferred set of parameters. + +### Building Oracle REST Data Services Install Images + +**IMPORTANT:** You can provide the installation binaries of ORDS and put them into the `dockerfiles` folder. You only need to provide the binaries for the version you are going to install.\ +The binaries can be downloaded from the [Oracle Technology Network](http://www.oracle.com/technetwork/developer-tools/rest-data-services/downloads/index.html) and placed in `OracleRestDataServices/dockerfiles` directory. Note that you must not uncompress the binaries. The script will handle that for you and fail if you uncompress them manually! + +**If no binaries are provided, [the latest ords zip](https://download.oracle.com/otn_software/java/ords/ords-latest.zip) file is downloaded automatically.** + +The image builds on top of the `oracle/serverjre:8` image which is also provided in this repository, see [OracleJava](../OracleJava). This base image is fetched from the container registry. So for successful fetch the user needs to login to the [container-registry](container-registry.oracle.com) and accept the license agreement.\ +The user can also build the `oracle/serverjre:8` image locally before building this image using the [OracleJava](../OracleJava) repo. After building this image locally, the user can run the following command: + +```bash +./buildContainerImage.sh -o '--build-arg BASE_IMAGE=' +``` + +Before you build the image make sure that you have provided the installation binaries and put them into the right folder. Once you have done that go into the **dockerfiles** folder and run the **buildContainerImage.sh** script: + +```bash + [oracle@localhost dockerfiles]$ ./buildContainerImage.sh -h + + Usage: buildContainerImage.sh [-i] [-o] [Docker build option] + Builds a Docker Image for Oracle Rest Data Services + + Parameters: + -i: ignores the MD5 checksums + -o: passes on Docker build option + + LICENSE UPL 1.0 + + Copyright (c) 2014-2017 Oracle and/or its affiliates. All rights reserved. +``` + +**IMPORTANT:** The resulting images will be an image with the ORDS binaries installed. On first startup of the container ORDS will be setup. + +### Running Oracle REST Data Services in a Docker container + +Before you run your ORDS Docker container you will have to specify a network in which ORDS will communicate with the database you would like it to expose via REST. +In order to do so you need to create a [user-defined network](https://docs.docker.com/engine/userguide/networking/#user-defined-networks) first. +This can be done via following command: + +```bash + docker network create +``` + +Once you have created the network you can double check by running: + +```bash + docker network ls +``` + +You should see your network, amongst others, in the output. + +As a next step you will have to start your database container with the specified network. This can be done via the `docker run` `--network` option, for example: + +```bash + docker run --name oracledb --network= oracle/database:12.2.0.1-ee +``` + +The database container will be visible within the network by its name passed on with the `--name` option, in the example above **oracledb**. +Once your database container is up and running and the database available, you can run a new ORDS container. + +To run your ORDS Docker image use the **docker run** command as follows: + +```bash + docker run --name \ + --network= \ + -p :8888 \ + -e ORACLE_HOST= \ + -e ORACLE_PORT= \ + -e ORACLE_SERVICE= \ + -e ORACLE_PWD= \ + -e ORDS_PWD= \ + -e CONTEXT_ROOT= \ + -v [:]/opt/oracle/ords/config/ords \ + oracle/restdataservices:3.0.12 + + Parameters: + --name: The name of the container (default: auto generated) + --network: The network to use to communicate with databases. + -p: The port mapping of the host port to the container port. + One port is exposed: 8888 + -e ORACLE_HOST: The Oracle Database hostname that ORDS should use (default: localhost) + This should be the name that you gave your Oracle database Docker container, e.g. "oracledb" + -e ORACLE_PORT: The Oracle Database port that ORSD should use (default: 1521) + -e ORACLE_SERVICE: The Oracle Database Service name that ORDS should use (default: ORCLPDB1) + -e ORACLE_PWD: The Oracle Database SYS password + -e ORDS_PWD: The ORDS_PUBLIC_USER password + -e CONTEXT_ROOT: (optional) The http context-root that ORDS should use (default: ords) + -v /opt/oracle/ords/config/ords + The data volume to use for the ORDS configuration files. + Has to be writable by the Unix "oracle" (uid: 54321) user inside the container! + If omitted the ORDS configuration files will not be persisted over container recreation. +``` + +Once the container has been started and ORDS configured you can send REST calls to ORDS. + +## Known issues + +None + +## Support + +## License + +To download and run ORDS, regardless whether inside or outside a Docker container, you must download the binaries from the Oracle website and accept the license indicated at that page. + +All scripts and files hosted in this project and GitHub [docker-images/OracleRestDataServices](./) repository required to build the Docker images are, unless otherwise noted, released under the Universal Permissive License (UPL), Version 1.0. + +## Copyright + +Copyright (c) 2014-2017 Oracle and/or its affiliates. All rights reserved. diff --git a/OracleApplicationExpress/dockerfiles/Dockerfile b/OracleApplicationExpress/dockerfiles/Dockerfile new file mode 100644 index 0000000000..efd6535757 --- /dev/null +++ b/OracleApplicationExpress/dockerfiles/Dockerfile @@ -0,0 +1,34 @@ +# Use Oracle 19c image as the base +ARG BASE_IMAGE +FROM ${BASE_IMAGE} + +# Set environment variables +ENV ORACLE_SID=DEV +ENV ORACLE_PDB=PDB1 +ENV PATH=$ORACLE_HOME/bin:$PATH + + +USER root +# Install Java 11 OpenJDK +RUN yum install -y java-11-openjdk-devel + +# Copy the APEX installation files to the container +COPY tmp/apex /opt/oracle/apex +COPY tmp/apex/images /opt/oracle/apex/images + +# Copy scripts to configure APEX and ORDS +COPY setup_apex.sh /opt/oracle/scripts/setup/ + +# Expose necessary ports +EXPOSE 1521 8080 8443 + +# Make scripts executable +USER root +RUN chmod +x /opt/oracle/scripts/setup/setup_apex.sh + +# Run the Oracle Database setup and the APEX setup scripts +USER oracle + +# Default command to start the Oracle Database and APEX setup +CMD ["/bin/bash", "/opt/oracle/scripts/setup/setup_apex.sh"] + diff --git a/OracleApplicationExpress/dockerfiles/download_apex.sh b/OracleApplicationExpress/dockerfiles/download_apex.sh new file mode 100644 index 0000000000..3553817a64 --- /dev/null +++ b/OracleApplicationExpress/dockerfiles/download_apex.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +# Variables +DOWNLOAD_LINK=$1 +DESTINATION_FOLDER=$2 + +# Check if both arguments are provided +if [ -z "$DOWNLOAD_LINK" ] || [ -z "$DESTINATION_FOLDER" ]; then + echo "Usage: $0 " + exit 1 +fi + +# Create the destination folder if it does not exist +mkdir -p "$DESTINATION_FOLDER" + +# Download the file +curl -L "$DOWNLOAD_LINK" -o /tmp/downloaded.zip + +# Check if the download was successful +if [ $? -ne 0 ]; then + echo "Failed to download the file from $DOWNLOAD_LINK" + exit 1 +fi + +# Unzip the file to the destination folder +unzip /tmp/downloaded.zip -d "$DESTINATION_FOLDER" + +# Check if the unzip was successful +if [ $? -ne 0 ]; then + echo "Failed to unzip the file to $DESTINATION_FOLDER" + exit 1 +fi + +# Cleanup +rm /tmp/downloaded.zip + +echo "Download and unzip completed successfully." diff --git a/OracleApplicationExpress/dockerfiles/setup_apex.sh b/OracleApplicationExpress/dockerfiles/setup_apex.sh new file mode 100644 index 0000000000..fd2539af52 --- /dev/null +++ b/OracleApplicationExpress/dockerfiles/setup_apex.sh @@ -0,0 +1,51 @@ +#!/bin/bash + +DB_HOST=$1 +DB_PORT=$2 +DB_SERVICE=$3 +DB_USER=$4 +DB_PASSWORD=$5 + +echo "Removing any existing APEX setup..." +cd /opt/oracle/apex +sqlplus -s sys/SysPassw0rd@192.168.4.48:1521/DEV as sysdba <> ~/.bashrc + +# Create the configuration directory +RUN mkdir -p $CONFIG_DIR + +# Provide database connection details and other configurations +RUN echo "db.hostname=192.168.4.48" > $CONFIG_DIR/ords_params.properties && \ + echo "db.port=1521" >> $CONFIG_DIR/ords_params.properties && \ + echo "db.servicename=DEV" >> $CONFIG_DIR/ords_params.properties && \ + echo "db.username=sys" >> $CONFIG_DIR/ords_params.properties && \ + echo "db.password=SysPassw0rd" >> $CONFIG_DIR/ords_params.properties && \ + echo "db.apex.password=ApexPassw0rd" >> $CONFIG_DIR/ords_params.properties && \ + echo "db.ords.password=OrdsPassw0rd" >> $CONFIG_DIR/ords_params.properties && \ + echo "feature.sdw=true" >> $CONFIG_DIR/ords_params.properties && \ + echo "feature.db-api=true" >> $CONFIG_DIR/ords_params.properties && \ + echo "feature.restEnabledSql=true" >> $CONFIG_DIR/ords_params.properties && \ + echo "plsql.gateway.add=true" >> $CONFIG_DIR/ords_params.properties && \ + echo "plsql.gateway.mode=proxied" >> $CONFIG_DIR/ords_params.properties && \ + echo "rest.services.enabled=true" >> $CONFIG_DIR/ords_params.properties -# Environment variables required for this build (do NOT change) -# ------------------------------------------------------------- -ENV ORDS_HOME=/opt/oracle/ords \ - INSTALL_FILE=ords*.zip \ - CONFIG_PROPS="ords_params.properties.tmpl" \ - STANDALONE_PROPS="standalone.properties.tmpl" \ - RUN_FILE="runOrds.sh" +# Install ORDS using the new CLI with non-interactive parameters +RUN cd $ORDS_HOME && \ + ./bin/ords --config $CONFIG_DIR install \ + --log-folder ${ORDS_CONF}/logs \ + --admin-user SYS \ + --db-hostname 192.168.4.48 \ + --db-port 1521 \ + --db-servicename DEV \ + --feature-db-api true \ + --feature-rest-enabled-sql true \ + --feature-sdw true \ + --gateway-mode proxied \ + --gateway-user APEX_PUBLIC_USER \ + --proxy-user \ + --password-stdin < "$OUTPUT_FILE" + + + +Saved on $(date) +basic +192.168.4.48 +1521 + +DEV +ORDS_PUBLIC_USER +true +proxied +true +ords_util.authorize_plsql_gateway + +EOL + +# Verify the creation of the file +if [ -f "$OUTPUT_FILE" ]; then + echo "pool.xml file has been successfully created at $OUTPUT_FILE" +else + echo "Failed to create pool.xml file at $OUTPUT_FILE" +fi diff --git a/OracleRestDataServices/dockerfiles/ords_params.properties b/OracleRestDataServices/dockerfiles/ords_params.properties new file mode 100644 index 0000000000..e69de29bb2 diff --git a/install_db_apex_ords.sh b/install_db_apex_ords.sh new file mode 100644 index 0000000000..82980fb9bd --- /dev/null +++ b/install_db_apex_ords.sh @@ -0,0 +1,124 @@ +#!/bin/bash + + +# Configuration +SCRIPT_DIR=$(dirname "$0") +NETWORK_NAME="my-net" +ORACLE_IMAGE="oracle/database:19.3.0-ee" +ORACLE_CONTAINER="oracledb19.3" +ORDS_IMAGE="ords:24.2" +APEX_IMAGE="apex:24.1" +ORDS_CONTAINER="ords24.2" +APEX_CONTAINER="apex24.1" +TMP_DIR="$SCRIPT_DIR/tmp" + +# Database environment variables +DB_PORT=1521 +DB_HOST=192.168.4.48 +DB_SERVICE="DEV" +DB_USER="sys" +DB_PASSWORD="SysPassw0rd" + +# Create Docker network if it doesn't exist +create_docker_network() { + if ! docker network ls --format '{{.Name}}' | grep -w $NETWORK_NAME > /dev/null; then + echo "Creating Docker network: $NETWORK_NAME" + docker network create $NETWORK_NAME + else + echo "Docker network $NETWORK_NAME already exists" + fi || exit 1 +} + +# Remove TMP_DIR if it exists +cleanup_tmp_dir() { +echo "Cleaning $TMP_DIR" + if [ -d "$TMP_DIR" ]; then + echo "Removing existing tmp directory: $TMP_DIR" + rm -rf "$TMP_DIR" + fi +} + +# Build Oracle Database container image +build_oracle_image() { + cd "$SCRIPT_DIR/OracleDatabase/SingleInstance/dockerfiles" || exit 1 + ./buildContainerImage.sh -v 19.3.0 -e || exit 1 + cd - || exit 1 +} + +# Run Oracle Database container +run_oracle_container() { + docker run -d --name $ORACLE_CONTAINER --network=$NETWORK_NAME \ + -p 1521:1521 \ + -p 5500:5500 \ + -p 2484:2484 \ + --ulimit nofile=1024:65536 \ + --ulimit nproc=2047:16384 \ + --ulimit stack=10485760:33554432 \ + --ulimit memlock=3221225472 \ + -e ORACLE_SID=dev \ + -e ORACLE_PDB=pdb1 \ + -e ORACLE_PWD=$DB_PASSWORD \ + -e INIT_SGA_SIZE=1000 \ + -e INIT_PGA_SIZE=500 \ + -e INIT_CPU_COUNT=4 \ + -e INIT_PROCESSES=100 \ + -e ORACLE_EDITION=enterprise \ + -e ORACLE_CHARACTERSET=AL32UTF8 \ + -e ENABLE_ARCHIVELOG=true \ + -e ENABLE_FORCE_LOGGING=true \ + -e ENABLE_TCPS=true \ + -v /opt/oracle/oradata \ + $ORACLE_IMAGE || exit 1 + sleep 1200 +} + +# Download and unzip APEX +download_apex() { + cd "$SCRIPT_DIR/OracleApplicationExpress/dockerfiles" || exit 1 + cleanup_tmp_dir + ./download_apex.sh "https://download.oracle.com/otn_software/apex/apex_24.1.zip" "$TMP_DIR" || exit 1 + cd - || exit 1 +} + +# Build and run APEX container +build_run_apex_container() { + cd "$SCRIPT_DIR/OracleApplicationExpress/dockerfiles" || exit 1 + docker build --no-cache --build-arg BASE_IMAGE=$ORACLE_IMAGE -t $APEX_IMAGE . || exit 1 + docker run -d --name $APEX_CONTAINER --network $NETWORK_NAME \ + -e DB_HOST=$DB_HOST \ + -e DB_PORT=$DB_PORT \ + -e DB_SERVICE=$DB_SERVICE \ + -e DB_USER=$DB_USER \ + -e DB_PASSWORD=$DB_PASSWORD \ + $APEX_IMAGE || exit 1 + cd - || exit 1 +} + +# Download and unzip ORDS +download_ords() { + cd "$SCRIPT_DIR/OracleRestDataServices/dockerfiles" || exit 1 + cleanup_tmp_dir + ./download_ords.sh "https://download.oracle.com/otn_software/java/ords/ords-24.2.2.187.1943.zip" "$TMP_DIR" || exit 1 + cd - || exit 1 +} + +# Build and run ORDS container +build_run_ords_container() { + cd "$SCRIPT_DIR/OracleRestDataServices/dockerfiles" || exit 1 + docker build --no-cache --build-arg BASE_IMAGE=$ORACLE_IMAGE -t $ORDS_IMAGE . || exit 1 + #./buildImage.sh || exit 1 + docker run -d --name $ORDS_CONTAINER -p 8080:8080 $ORDS_IMAGE || exit 1 + + cd - || exit 1 +} + +# Main script execution +#create_docker_network +#build_oracle_image +#run_oracle_container +#download_apex +#build_run_apex_container +#download_ords +build_run_ords_container + +echo "Setup completed successfully." diff --git a/install_ords.sh b/install_ords.sh new file mode 100644 index 0000000000..e69de29bb2 diff --git a/setup_oracle.sh b/setup_oracle.sh new file mode 100644 index 0000000000..e5bc32bd05 --- /dev/null +++ b/setup_oracle.sh @@ -0,0 +1,85 @@ +#!/bin/bash + + +# Get the directory where the script is located +SCRIPT_DIR=$(dirname "$0") + +# Check if the Docker network exists +NETWORK_NAME="my-net" +if ! docker network ls --format '{{.Name}}' | grep -w $NETWORK_NAME > /dev/null; then + echo "Creating Docker network: $NETWORK_NAME" + docker network create $NETWORK_NAME +else + echo "Docker network $NETWORK_NAME already exists" +fi || exit 1 + +# Change to the Oracle Database directory +cd "$SCRIPT_DIR/OracleDatabase/SingleInstance/dockerfiles" || exit 1 + +# Build the Oracle Database container image +./buildContainerImage.sh -v 19.3.0 -e || exit 1 + +# Run the Oracle Database container +docker run -d --name oracledb19.3 --network=my-net \ + -p 1521:1521 \ + -p 5500:5500 \ + -p 2484:2484 \ + --ulimit nofile=1024:65536 \ + --ulimit nproc=2047:16384 \ + --ulimit stack=10485760:33554432 \ + --ulimit memlock=3221225472 \ + -e ORACLE_SID=dev \ + -e ORACLE_PDB=pdb1 \ + -e ORACLE_PWD=SysPassw0rd \ + -e INIT_SGA_SIZE=1000 \ + -e INIT_PGA_SIZE=500 \ + -e INIT_CPU_COUNT=4 \ + -e INIT_PROCESSES=100 \ + -e ORACLE_EDITION=enterprise \ + -e ORACLE_CHARACTERSET=AL32UTF8 \ + -e ENABLE_ARCHIVELOG=true \ + -e ENABLE_FORCE_LOGGING=true \ + -e ENABLE_TCPS=true \ + -v /opt/oracle/oradata \ + oracle/database:19.3.0-ee + +sleep 1200 + +cd .. || exit 1 +cd .. || exit 1 +cd .. || exit 1 +# Change to the Oracle REST Data Services directory +cd "OracleApplicationExpress/dockerfiles" || exit 1 + +# Download and unzip ORDS +./download_apex.sh "https://download.oracle.com/otn_software/apex/apex_24.1.zip" "$SCRIPT_DIR/tmp" || exit 1 + +# Build the ORDS Docker image +docker build --build-arg BASE_IMAGE=oracle/database:19.3.0-ee -t apex:24.1 . || exit 1 + +#Run the ORDS container +docker run -d --name apex24.1 --network my-net \ + -e DB_HOST=192.168.4.48 \ + -e DB_PORT=1521 \ + -e DB_SERVICE=DEV \ + -e DB_USER=sys \ + -e DB_PASSWORD=SysPassw0rd \ +apex:24.1 || exit 1 + + + +cd .. || exit 1 +cd .. || exit 1 +# Change to the Oracle REST Data Services directory +cd "OracleRestDataServices/dockerfiles" || exit 1 + +# Download and unzip ORDS +./download_ords.sh "https://download.oracle.com/otn_software/java/ords/ords-24.2.2.187.1943.zip" "$SCRIPT_DIR/tmp" || exit 1 + +# Build the ORDS Docker image +docker build --build-arg BASE_IMAGE=oracle/database:19.3.0-ee -t ords:latest . || exit 1 + +# Run the ORDS container +docker run -d --name ords -p 8080:8080 ords:latest || exit 1 + +echo "Setup completed successfully." diff --git a/setup_oracle_old.sh b/setup_oracle_old.sh new file mode 100644 index 0000000000..e5bc32bd05 --- /dev/null +++ b/setup_oracle_old.sh @@ -0,0 +1,85 @@ +#!/bin/bash + + +# Get the directory where the script is located +SCRIPT_DIR=$(dirname "$0") + +# Check if the Docker network exists +NETWORK_NAME="my-net" +if ! docker network ls --format '{{.Name}}' | grep -w $NETWORK_NAME > /dev/null; then + echo "Creating Docker network: $NETWORK_NAME" + docker network create $NETWORK_NAME +else + echo "Docker network $NETWORK_NAME already exists" +fi || exit 1 + +# Change to the Oracle Database directory +cd "$SCRIPT_DIR/OracleDatabase/SingleInstance/dockerfiles" || exit 1 + +# Build the Oracle Database container image +./buildContainerImage.sh -v 19.3.0 -e || exit 1 + +# Run the Oracle Database container +docker run -d --name oracledb19.3 --network=my-net \ + -p 1521:1521 \ + -p 5500:5500 \ + -p 2484:2484 \ + --ulimit nofile=1024:65536 \ + --ulimit nproc=2047:16384 \ + --ulimit stack=10485760:33554432 \ + --ulimit memlock=3221225472 \ + -e ORACLE_SID=dev \ + -e ORACLE_PDB=pdb1 \ + -e ORACLE_PWD=SysPassw0rd \ + -e INIT_SGA_SIZE=1000 \ + -e INIT_PGA_SIZE=500 \ + -e INIT_CPU_COUNT=4 \ + -e INIT_PROCESSES=100 \ + -e ORACLE_EDITION=enterprise \ + -e ORACLE_CHARACTERSET=AL32UTF8 \ + -e ENABLE_ARCHIVELOG=true \ + -e ENABLE_FORCE_LOGGING=true \ + -e ENABLE_TCPS=true \ + -v /opt/oracle/oradata \ + oracle/database:19.3.0-ee + +sleep 1200 + +cd .. || exit 1 +cd .. || exit 1 +cd .. || exit 1 +# Change to the Oracle REST Data Services directory +cd "OracleApplicationExpress/dockerfiles" || exit 1 + +# Download and unzip ORDS +./download_apex.sh "https://download.oracle.com/otn_software/apex/apex_24.1.zip" "$SCRIPT_DIR/tmp" || exit 1 + +# Build the ORDS Docker image +docker build --build-arg BASE_IMAGE=oracle/database:19.3.0-ee -t apex:24.1 . || exit 1 + +#Run the ORDS container +docker run -d --name apex24.1 --network my-net \ + -e DB_HOST=192.168.4.48 \ + -e DB_PORT=1521 \ + -e DB_SERVICE=DEV \ + -e DB_USER=sys \ + -e DB_PASSWORD=SysPassw0rd \ +apex:24.1 || exit 1 + + + +cd .. || exit 1 +cd .. || exit 1 +# Change to the Oracle REST Data Services directory +cd "OracleRestDataServices/dockerfiles" || exit 1 + +# Download and unzip ORDS +./download_ords.sh "https://download.oracle.com/otn_software/java/ords/ords-24.2.2.187.1943.zip" "$SCRIPT_DIR/tmp" || exit 1 + +# Build the ORDS Docker image +docker build --build-arg BASE_IMAGE=oracle/database:19.3.0-ee -t ords:latest . || exit 1 + +# Run the ORDS container +docker run -d --name ords -p 8080:8080 ords:latest || exit 1 + +echo "Setup completed successfully." From a3db3a5fc7692126a3b2cbbeab0a6ae40c589ced Mon Sep 17 00:00:00 2001 From: gamagecb <158429045+gamagecb@users.noreply.github.com> Date: Thu, 18 Jul 2024 23:57:45 +0930 Subject: [PATCH 02/11] Update README.md Initial Commit --- README.md | 117 +++++++++++++++++++++++------------------------------- 1 file changed, 49 insertions(+), 68 deletions(-) diff --git a/README.md b/README.md index 2f7637cf9c..93ca1f25f7 100644 --- a/README.md +++ b/README.md @@ -1,89 +1,70 @@ -# Docker Images from Oracle +# Installing Oracle DB, APEX and ORDS in Docker -This repository contains [Dockerfiles](https://docs.docker.com/engine/reference/builder/) -and samples to build [Docker](https://www.docker.com/what-docker) images for -Oracle commercial products and [Oracle sponsored open source projects](https://opensource.oracle.com). -## Container Images on GitHub +## Step 1: Installing Docker -These images will require you to download any required Oracle commercial -software before installation. If you want commercial software downloaded for you, - view [Pre-Built Images with Commercial Software](#pre-built-images-with-commercial-software). +Follow the instructions on the Docker official documentation to install Docker Desktop on Windows: +- [Docker Desktop Installation for Windows](https://docs.docker.com/desktop/install/windows-install/) -### Oracle Commercial Products +**Important**: Download 'Docker Desktop for Windows - x86_64' and + Do not run the `.exe` file by double-clicking. Instead, follow these steps: +1. Navigate to the installer directory. +2. Open a Command Prompt and run the following command: + ```sh + start /w "" "Docker Desktop Installer.exe" install -accept-license --installation-dir="D:\Docker\Docker" --wsl-default-data-root="D:\Docker\wsl" --windows-containers-default-data-root="D:\Docker" + ``` -- [Oracle Access Management](/OracleAccessManagement) -- [Oracle BI](/OracleBI) -- [Oracle Cloud Infrastructure Tools](/OracleCloudInfrastructure) -- [Oracle Coherence](/OracleCoherence) -- [Oracle Database](/OracleDatabase) -- [Oracle Essbase](/OracleEssbase) -- [Oracle FMW Infrastructure](/OracleFMWInfrastructure) -- [Oracle GoldenGate](/OracleGoldenGate) -- [Oracle HTTP Server](/OracleHTTPServer) -- [Oracle Identity Governance](/OracleIdentityGovernance) -- [Oracle Instant Client](/OracleInstantClient) (Basic, SDK and SQL*Plus) -- [Oracle Java](/OracleJava) -- [Oracle Rest Data Services](OracleRestDataServices) (ORDS) -- [Oracle SOA Suite](/OracleSOASuite) -- [Oracle Tuxedo](/OracleTuxedo) -- [Oracle Unified Directory](/OracleUnifiedDirectory) -- [Oracle Unified Directory Service Manager](/OracleUnifiedDirectorySM) -- [Oracle WebLogic Server](/OracleWebLogic) -- [Oracle WebCenter Content](/OracleWebCenterContent) -- [Oracle WebCenter Portal](/OracleWebCenterPortal) -- [Oracle WebCenter Sites](/OracleWebCenterSites) +Verify the Docker installation by running: +```sh +docker --version +``` -### Oracle Sponsored Open Source Projects +Start the Docker engine if it's not already running. -- [GraalVM CE](https://github.com/graalvm/container/tree/master/community) -- [MySQL](https://github.com/mysql/mysql-docker) -- [Oracle OpenJDK](/OracleOpenJDK) -- [Oracle NoSQL Database](/NoSQL) -- [Oracle Linux](https://github.com/oracle/container-images) +## Step 2: Download Oracle Database 19.3.0 (Enterprise Edition) -### Community Contributions +Clone this repository: +```sh +git clone +cd +``` -- [Oracle Forms and Reports](https://github.com/oracle/docker-images/issues/212) -- [Oracle Unified Directory](Contrib/OracleUnifiedDirectory/) +Download Oracle Database 19c for Linux x86-64 from the following link: +- [Oracle Database 19c for Linux x86-64 ZIP](https://www.oracle.com/au/database/technologies/oracle-database-software-downloads.html#db_ee) -### Archived Projects +Copy the `.zip` file into the folder: +``` +Oracle-Docker-Images\OracleDatabase\SingleInstance\dockerfiles\19.3.0\ +``` -- [ContainerCloud](/Archive/ContainerCloud) -- [Oracle Data Integrator](/Archive/OracleDataIntegrator) -- [Oracle Enterprise Data Quality](/Archive/OracleEDQ) -- [Oracle TSAM Plus](/Archive/OracleTuxedo/tsam) +## Step 3: Installing Oracle Database 19.3.0 (Enterprise Edition), APEX 24.1, and ORDS 24.2 -## Pre-Built Images with Commercial Software +Open a Git Bash window in the root directory of this project and run the following script: +```sh +./install.sh +``` -These sources already contain Oracle commercial software and require license -acceptance prior to download: +This process will take approximately 30 minutes. -- [Oracle Container Registry](https://container-registry.oracle.com) +## Step 4: Reset Password for the APEX Administration Services Account -## Support +Create a connection in SQL Developer using the following details: -For support and certification information, please consult the documentation -for each product. +- **DB_PORT**: `1521` +- **DB_HOST**: `` +- **DB_SERVICE**: `DEV` +- **DB_USER**: `sys` +- **DB_PASSWORD**: `SysPassw0rd` -For support, bug reporting and feedback about the provided Dockerfiles, please -open an [issue on GitHub](https://github.com/oracle/docker-images/issues). +After logging in, run the following command and provide the Admin Username, Email Address, and Password: +```sql +@D:\Path\To\Oracle-Docker-Images\OracleApplicationExpress\dockerfiles\tmp\apex\apxchpwd.sql; +``` -If you need general support with running containers on Oracle Linux, you can submit -a question under the [Containers and Orchestration](https://community.oracle.com/tech/apps-infra/categories/containers-and-orchestration) -category of the Applications and Infrastructure Community of Oracle Communities. +## Step 5: Login to APEX -## Contributing +Use the credentials set in Step 4 to log in to APEX: +- [APEX Login](http://localhost:8081/ords/pdb1/r/apex/workspace-sign-in/administration-sign-in) -This project welcomes contributions from the community. Before submitting a pull request, please [review our contribution guide](./CONTRIBUTING.md) +--- -## Security - -Please consult the [security guide](./SECURITY.md) for our responsible security vulnerability disclosure process - -## License - -Copyright (c) 2019, 2023 Oracle and/or its affiliates. - -Released under the Universal Permissive License v1.0 as shown at -. From ba24b19c5fc9f367352d29706595be8f1d5367f3 Mon Sep 17 00:00:00 2001 From: gamagecb <158429045+gamagecb@users.noreply.github.com> Date: Fri, 19 Jul 2024 00:07:56 +0930 Subject: [PATCH 03/11] Update README.md --- README.md | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/README.md b/README.md index 93ca1f25f7..a373900840 100644 --- a/README.md +++ b/README.md @@ -23,16 +23,10 @@ Start the Docker engine if it's not already running. ## Step 2: Download Oracle Database 19.3.0 (Enterprise Edition) -Clone this repository: -```sh -git clone -cd -``` - Download Oracle Database 19c for Linux x86-64 from the following link: - [Oracle Database 19c for Linux x86-64 ZIP](https://www.oracle.com/au/database/technologies/oracle-database-software-downloads.html#db_ee) -Copy the `.zip` file into the folder: +Clone this repository and Copy the `.zip` file into the folder: ``` Oracle-Docker-Images\OracleDatabase\SingleInstance\dockerfiles\19.3.0\ ``` From e84c018ac66587adc4545ae16b7c2ec0afb4863b Mon Sep 17 00:00:00 2001 From: gamagecb <158429045+gamagecb@users.noreply.github.com> Date: Fri, 19 Jul 2024 00:11:06 +0930 Subject: [PATCH 04/11] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a373900840..ba99b49a53 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ This process will take approximately 30 minutes. Create a connection in SQL Developer using the following details: - **DB_PORT**: `1521` -- **DB_HOST**: `` +- **DB_HOST**: `localhost` - **DB_SERVICE**: `DEV` - **DB_USER**: `sys` - **DB_PASSWORD**: `SysPassw0rd` From 9675c9e1b0db4bb4a164084e715e3b784e91d5aa Mon Sep 17 00:00:00 2001 From: gamagecb <158429045+gamagecb@users.noreply.github.com> Date: Fri, 19 Jul 2024 08:15:45 +0930 Subject: [PATCH 05/11] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index ba99b49a53..a5ec48012b 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,7 @@ Create a connection in SQL Developer using the following details: After logging in, run the following command and provide the Admin Username, Email Address, and Password: ```sql +alter session set container = PDB1; @D:\Path\To\Oracle-Docker-Images\OracleApplicationExpress\dockerfiles\tmp\apex\apxchpwd.sql; ``` From 5508dffdc9710d08a79118cc834aec9c6a2c182e Mon Sep 17 00:00:00 2001 From: gamagecb <158429045+gamagecb@users.noreply.github.com> Date: Fri, 19 Jul 2024 10:00:11 +0930 Subject: [PATCH 06/11] Update README.md --- README.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/README.md b/README.md index a5ec48012b..8e16676126 100644 --- a/README.md +++ b/README.md @@ -7,12 +7,6 @@ Follow the instructions on the Docker official documentation to install Docker D - [Docker Desktop Installation for Windows](https://docs.docker.com/desktop/install/windows-install/) **Important**: Download 'Docker Desktop for Windows - x86_64' and - Do not run the `.exe` file by double-clicking. Instead, follow these steps: -1. Navigate to the installer directory. -2. Open a Command Prompt and run the following command: - ```sh - start /w "" "Docker Desktop Installer.exe" install -accept-license --installation-dir="D:\Docker\Docker" --wsl-default-data-root="D:\Docker\wsl" --windows-containers-default-data-root="D:\Docker" - ``` Verify the Docker installation by running: ```sh From aa3238a8ebbff20e3ac93b02a0008a95c6aca741 Mon Sep 17 00:00:00 2001 From: gamagec Date: Fri, 19 Jul 2024 10:04:15 +0930 Subject: [PATCH 07/11] Added installation script for Apex 24.1 and Ords 24.2 --- .../dockerfiles/Dockerfile | 6 -- .../dockerfiles/setup_apex.sh | 55 ++++++------ OracleRestDataServices/dockerfiles/Dockerfile | 72 ++++++++++------ .../dockerfiles/buildImage.sh | 36 ++------ .../dockerfiles/check_db_ready.sh | 24 ------ config.properties | 30 +++++++ install_db_apex_ords.sh => install.sh | 65 ++++++-------- install_ords.sh | 0 setup_oracle.sh | 85 ------------------- setup_oracle_old.sh | 85 ------------------- 10 files changed, 140 insertions(+), 318 deletions(-) delete mode 100644 OracleRestDataServices/dockerfiles/check_db_ready.sh create mode 100644 config.properties rename install_db_apex_ords.sh => install.sh (67%) delete mode 100644 install_ords.sh delete mode 100644 setup_oracle.sh delete mode 100644 setup_oracle_old.sh diff --git a/OracleApplicationExpress/dockerfiles/Dockerfile b/OracleApplicationExpress/dockerfiles/Dockerfile index efd6535757..3e7ace1429 100644 --- a/OracleApplicationExpress/dockerfiles/Dockerfile +++ b/OracleApplicationExpress/dockerfiles/Dockerfile @@ -3,11 +3,8 @@ ARG BASE_IMAGE FROM ${BASE_IMAGE} # Set environment variables -ENV ORACLE_SID=DEV -ENV ORACLE_PDB=PDB1 ENV PATH=$ORACLE_HOME/bin:$PATH - USER root # Install Java 11 OpenJDK RUN yum install -y java-11-openjdk-devel @@ -19,9 +16,6 @@ COPY tmp/apex/images /opt/oracle/apex/images # Copy scripts to configure APEX and ORDS COPY setup_apex.sh /opt/oracle/scripts/setup/ -# Expose necessary ports -EXPOSE 1521 8080 8443 - # Make scripts executable USER root RUN chmod +x /opt/oracle/scripts/setup/setup_apex.sh diff --git a/OracleApplicationExpress/dockerfiles/setup_apex.sh b/OracleApplicationExpress/dockerfiles/setup_apex.sh index fd2539af52..63f56c75c9 100644 --- a/OracleApplicationExpress/dockerfiles/setup_apex.sh +++ b/OracleApplicationExpress/dockerfiles/setup_apex.sh @@ -1,15 +1,12 @@ #!/bin/bash -DB_HOST=$1 -DB_PORT=$2 -DB_SERVICE=$3 -DB_USER=$4 -DB_PASSWORD=$5 +# Source the properties file +source ../../config.properties echo "Removing any existing APEX setup..." cd /opt/oracle/apex -sqlplus -s sys/SysPassw0rd@192.168.4.48:1521/DEV as sysdba < 'ORDS_PUBLIC_USER', + p_plsql_gateway_user => 'APEX_PUBLIC_USER' + ); + + apex_instance_admin.set_parameter( + p_parameter => 'IMAGE_PREFIX', + p_value => 'https://static.oracle.com/cdn/apex/24.1.0/' ); + + else + dbms_output.put_line('APEX_PUBLIC_USER not found. Installation may not have completed successfully.'); + end if; + end; / exit; EOF diff --git a/OracleRestDataServices/dockerfiles/Dockerfile b/OracleRestDataServices/dockerfiles/Dockerfile index 6421766c15..a422b48e3a 100644 --- a/OracleRestDataServices/dockerfiles/Dockerfile +++ b/OracleRestDataServices/dockerfiles/Dockerfile @@ -2,17 +2,45 @@ ARG BASE_IMAGE FROM ${BASE_IMAGE} +ARG DB_HOST +ARG DB_PORT +ARG DB_SERVICE +ARG DB_USER +ARG DB_PASSWORD +ARG ORDS_DB_API +ARG ORDS_REST_ENABLED_SQL +ARG ORDS_SDW +ARG ORDS_GATEWAY_MODE +ARG ORDS_GATEWAY_USER +ARG ORDS_PROXY_USER +ARG ORDS_PASSWORD_SYS +ARG ORDS_PASSWORD_APEX + + + # Set environment variables ENV ORACLE_HOME=/opt/oracle/product/19c/dbhome_1 ENV PATH=$ORACLE_HOME/bin:$PATH ENV ORDS_HOME=/opt/oracle/ords ENV CONFIG_DIR=/etc/ords/config +ENV DB_HOST=$DB_HOST +ENV DB_PORT=$DB_PORT +ENV DB_SERVICE=$DB_SERVICE +ENV DB_USER=$DB_USER +ENV DB_PASSWORD=$DB_PASSWORD +ENV ORDS_DB_API=$ORDS_DB_API +ENV ORDS_REST_ENABLED_SQL=$ORDS_REST_ENABLED_SQL +ENV ORDS_SDW=$ORDS_SDW +ENV ORDS_GATEWAY_MODE=$ORDS_GATEWAY_MODE +ENV ORDS_GATEWAY_USER=$ORDS_GATEWAY_USER +ENV ORDS_PROXY_USER=$ORDS_PROXY_USER +ENV ORDS_PASSWORD_SYS=$ORDS_PASSWORD_SYS +ENV ORDS_PASSWORD_APEX=$ORDS_PASSWORD_APEX # Copy the ORDS files into the container COPY tmp $ORDS_HOME COPY ords_params.properties $CONFIG_DIR/ -COPY gen_pool_xml.sh $CONFIG_DIR/ USER root @@ -26,28 +54,28 @@ RUN echo 'export PATH="$PATH:$ORDS_HOME/bin"' >> ~/.bashrc RUN mkdir -p $CONFIG_DIR # Provide database connection details and other configurations -RUN echo "db.hostname=192.168.4.48" > $CONFIG_DIR/ords_params.properties && \ - echo "db.port=1521" >> $CONFIG_DIR/ords_params.properties && \ - echo "db.servicename=DEV" >> $CONFIG_DIR/ords_params.properties && \ - echo "db.username=sys" >> $CONFIG_DIR/ords_params.properties && \ - echo "db.password=SysPassw0rd" >> $CONFIG_DIR/ords_params.properties && \ - echo "db.apex.password=ApexPassw0rd" >> $CONFIG_DIR/ords_params.properties && \ - echo "db.ords.password=OrdsPassw0rd" >> $CONFIG_DIR/ords_params.properties && \ - echo "feature.sdw=true" >> $CONFIG_DIR/ords_params.properties && \ - echo "feature.db-api=true" >> $CONFIG_DIR/ords_params.properties && \ - echo "feature.restEnabledSql=true" >> $CONFIG_DIR/ords_params.properties && \ +RUN echo "db.hostname=$DB_HOST" > $CONFIG_DIR/ords_params.properties && \ + echo "db.port=$DB_PORT" >> $CONFIG_DIR/ords_params.properties && \ + echo "db.servicename=$DB_SERVICE" >> $CONFIG_DIR/ords_params.properties && \ + echo "db.username=$DB_USER" >> $CONFIG_DIR/ords_params.properties && \ + echo "db.password=$DB_PASSWORD" >> $CONFIG_DIR/ords_params.properties && \ + echo "db.apex.password=$ORDS_PASSWORD_APEX" >> $CONFIG_DIR/ords_params.properties && \ + echo "db.ords.password=$ORDS_PASSWORD_SYS" >> $CONFIG_DIR/ords_params.properties && \ + echo "feature.sdw=$ORDS_SDW" >> $CONFIG_DIR/ords_params.properties && \ + echo "feature.db-api=$ORDS_DB_API" >> $CONFIG_DIR/ords_params.properties && \ + echo "feature.restEnabledSql=$ORDS_REST_ENABLED_SQL" >> $CONFIG_DIR/ords_params.properties && \ echo "plsql.gateway.add=true" >> $CONFIG_DIR/ords_params.properties && \ - echo "plsql.gateway.mode=proxied" >> $CONFIG_DIR/ords_params.properties && \ - echo "rest.services.enabled=true" >> $CONFIG_DIR/ords_params.properties + echo "plsql.gateway.mode=$ORDS_GATEWAY_MODE" >> $CONFIG_DIR/ords_params.properties && \ + echo "rest.services.enabled=ORDS_REST_ENABLED_SQL" >> $CONFIG_DIR/ords_params.properties # Install ORDS using the new CLI with non-interactive parameters RUN cd $ORDS_HOME && \ ./bin/ords --config $CONFIG_DIR install \ --log-folder ${ORDS_CONF}/logs \ - --admin-user SYS \ - --db-hostname 192.168.4.48 \ - --db-port 1521 \ - --db-servicename DEV \ + --admin-user $DB_USER \ + --db-hostname $DB_HOST \ + --db-port $DB_PORT \ + --db-servicename $DB_SERVICE \ --feature-db-api true \ --feature-rest-enabled-sql true \ --feature-sdw true \ @@ -59,16 +87,8 @@ SysPassw0rd ApexPassw0rd EOF -# Run the gen_pool_xml.sh script -RUN cd $CONFIG_DIR && \ - bash ./gen_pool_xml.sh - -# Optional: Clean up by removing the script if no longer needed -RUN rm $CONFIG_DIR/gen_pool_xml.sh - +RUN sed -i 's|disabled|proxied|g' /etc/ords/config/databases/default/pool.xml -# Expose the ORDS port -EXPOSE 8080 # Start ORDS using the new CLI CMD ["sh", "-c", "$ORDS_HOME/bin/ords --config $CONFIG_DIR serve"] diff --git a/OracleRestDataServices/dockerfiles/buildImage.sh b/OracleRestDataServices/dockerfiles/buildImage.sh index db3d7f5886..2287155289 100644 --- a/OracleRestDataServices/dockerfiles/buildImage.sh +++ b/OracleRestDataServices/dockerfiles/buildImage.sh @@ -1,37 +1,15 @@ #!/bin/bash -# Function to read a property from a properties file -# function get_property { - # local file=$1 - # local key=$2 - # local value=$(grep -w "$key" "$file" | cut -d'=' -f2) - # echo $value -# } - -# Path to the properties file -PROPERTIES_FILE="ords_params.properties" - -# Read values from the properties file -BASE_IMAGE=oracle/database:19.3.0-ee -DB_HOST=192.168.112.1 -DB_PORT=1521 -DB_SERVICENAME=DEV -ORDS_ADMIN_USER=SYS -ORDS_DB_API=true -ORDS_REST_ENABLED_SQL=true -ORDS_SDW=true -ORDS_GATEWAY_MODE=proxied -ORDS_GATEWAY_USER=APEX_PUBLIC_USER -ORDS_PROXY_USER=true -ORDS_PASSWORD_SYS=SysPassw0rd -ORDS_PASSWORD_APEX=ApexPassw0rd +# Source the properties file +source ../../config.properties # Build the Docker image with the build arguments -docker build --build-arg BASE_IMAGE=$BASE_IMAGE \ +docker build --no-cache --build-arg BASE_IMAGE=$ORACLE_IMAGE \ --build-arg DB_HOST=$DB_HOST \ --build-arg DB_PORT=$DB_PORT \ - --build-arg DB_SERVICENAME=$DB_SERVICENAME \ - --build-arg ORDS_ADMIN_USER=$ORDS_ADMIN_USER \ + --build-arg DB_SERVICE=$DB_SERVICE \ + --build-arg DB_USER=$DB_USER \ + --build-arg DB_PASSWORD=$DB_PASSWORD \ --build-arg ORDS_DB_API=$ORDS_DB_API \ --build-arg ORDS_REST_ENABLED_SQL=$ORDS_REST_ENABLED_SQL \ --build-arg ORDS_SDW=$ORDS_SDW \ @@ -40,4 +18,4 @@ docker build --build-arg BASE_IMAGE=$BASE_IMAGE \ --build-arg ORDS_PROXY_USER=$ORDS_PROXY_USER \ --build-arg ORDS_PASSWORD_SYS=$ORDS_PASSWORD_SYS \ --build-arg ORDS_PASSWORD_APEX=$ORDS_PASSWORD_APEX \ - -t ords:latest . + -t $ORDS_IMAGE . diff --git a/OracleRestDataServices/dockerfiles/check_db_ready.sh b/OracleRestDataServices/dockerfiles/check_db_ready.sh deleted file mode 100644 index 3ccd311619..0000000000 --- a/OracleRestDataServices/dockerfiles/check_db_ready.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -# Function to check if the listener and database are up -check_db_ready() { - local DB_USER="sys" - local DB_PASSWORD="SysPassw0rd" - local DB_HOST="192.168.4.42" - local DB_PORT="1521" - local DB_SERVICE="DEV" - - while true; do - echo "exit" | sqlplus -s "$DB_USER/$DB_PASSWORD@$DB_HOST:$DB_PORT/$DB_SERVICE as sysdba" > /dev/null 2>&1 - if [ $? -eq 0 ]; then - echo "Listener and database are up and ready." - break - else - echo "Waiting for listener and database to be ready..." - sleep 10 - fi - done -} - -# Call the function to check if the database and listener are up -check_db_ready diff --git a/config.properties b/config.properties new file mode 100644 index 0000000000..7757dcb21f --- /dev/null +++ b/config.properties @@ -0,0 +1,30 @@ +# Configuration +NETWORK_NAME=my-net +ORACLE_IMAGE=oracle/database:19.3.0-ee +ORDS_IMAGE=ords:24.2 +APEX_IMAGE=apex:24.1 +ORACLE_CONTAINER=oracledb19.3 +ORDS_CONTAINER=ords24.2 +APEX_CONTAINER=apex24.1 +TMP_DIR=./tmp + +ORDS_PORT=8081 +ORDS_DB_API=true +ORDS_REST_ENABLED_SQL=true +ORDS_SDW=true +ORDS_PROXY_USER=true +ORDS_GATEWAY_MODE=proxied +ORDS_GATEWAY_USER=APEX_PUBLIC_USER +ORDS_PASSWORD_APEX=ApexPassw0rd +ORDS_PASSWORD_SYS=OrdsPassw0rd + +# Database environment variables +DB_PORT=1521 +DB_HOST=host.docker.internal +DB_SERVICE=DEV +DB_USER=sys +DB_PASSWORD=SysPassw0rd + +# Download URLs +APEX_URL=https://download.oracle.com/otn_software/apex/apex_24.1.zip +ORDS_URL=https://download.oracle.com/otn_software/java/ords/ords-24.2.2.187.1943.zip diff --git a/install_db_apex_ords.sh b/install.sh similarity index 67% rename from install_db_apex_ords.sh rename to install.sh index 82980fb9bd..261053ca23 100644 --- a/install_db_apex_ords.sh +++ b/install.sh @@ -1,25 +1,10 @@ #!/bin/bash - -# Configuration +# Source the properties file +source ./config.properties SCRIPT_DIR=$(dirname "$0") -NETWORK_NAME="my-net" -ORACLE_IMAGE="oracle/database:19.3.0-ee" -ORACLE_CONTAINER="oracledb19.3" -ORDS_IMAGE="ords:24.2" -APEX_IMAGE="apex:24.1" -ORDS_CONTAINER="ords24.2" -APEX_CONTAINER="apex24.1" -TMP_DIR="$SCRIPT_DIR/tmp" - -# Database environment variables -DB_PORT=1521 -DB_HOST=192.168.4.48 -DB_SERVICE="DEV" -DB_USER="sys" -DB_PASSWORD="SysPassw0rd" -# Create Docker network if it doesn't exist +# Function to create Docker network if it doesn't exist create_docker_network() { if ! docker network ls --format '{{.Name}}' | grep -w $NETWORK_NAME > /dev/null; then echo "Creating Docker network: $NETWORK_NAME" @@ -29,26 +14,26 @@ create_docker_network() { fi || exit 1 } -# Remove TMP_DIR if it exists +# Function to clean up the temporary directory cleanup_tmp_dir() { -echo "Cleaning $TMP_DIR" + echo "Cleaning $TMP_DIR" if [ -d "$TMP_DIR" ]; then echo "Removing existing tmp directory: $TMP_DIR" rm -rf "$TMP_DIR" fi } -# Build Oracle Database container image +# Function to build Oracle Database container image build_oracle_image() { cd "$SCRIPT_DIR/OracleDatabase/SingleInstance/dockerfiles" || exit 1 ./buildContainerImage.sh -v 19.3.0 -e || exit 1 cd - || exit 1 } -# Run Oracle Database container +# Function to run Oracle Database container run_oracle_container() { docker run -d --name $ORACLE_CONTAINER --network=$NETWORK_NAME \ - -p 1521:1521 \ + -p $DB_PORT:1521 \ -p 5500:5500 \ -p 2484:2484 \ --ulimit nofile=1024:65536 \ @@ -72,15 +57,15 @@ run_oracle_container() { sleep 1200 } -# Download and unzip APEX +# Function to download and unzip APEX download_apex() { cd "$SCRIPT_DIR/OracleApplicationExpress/dockerfiles" || exit 1 - cleanup_tmp_dir - ./download_apex.sh "https://download.oracle.com/otn_software/apex/apex_24.1.zip" "$TMP_DIR" || exit 1 + cleanup_tmp_dir + ./download_apex.sh "$APEX_URL" "$TMP_DIR" || exit 1 cd - || exit 1 } -# Build and run APEX container +# Function to build and run APEX container build_run_apex_container() { cd "$SCRIPT_DIR/OracleApplicationExpress/dockerfiles" || exit 1 docker build --no-cache --build-arg BASE_IMAGE=$ORACLE_IMAGE -t $APEX_IMAGE . || exit 1 @@ -94,31 +79,33 @@ build_run_apex_container() { cd - || exit 1 } -# Download and unzip ORDS +# Function to download and unzip ORDS download_ords() { cd "$SCRIPT_DIR/OracleRestDataServices/dockerfiles" || exit 1 cleanup_tmp_dir - ./download_ords.sh "https://download.oracle.com/otn_software/java/ords/ords-24.2.2.187.1943.zip" "$TMP_DIR" || exit 1 + ./download_ords.sh "$ORDS_URL" "$TMP_DIR" || exit 1 cd - || exit 1 } -# Build and run ORDS container +# Function to build and run ORDS container build_run_ords_container() { cd "$SCRIPT_DIR/OracleRestDataServices/dockerfiles" || exit 1 - docker build --no-cache --build-arg BASE_IMAGE=$ORACLE_IMAGE -t $ORDS_IMAGE . || exit 1 - #./buildImage.sh || exit 1 - docker run -d --name $ORDS_CONTAINER -p 8080:8080 $ORDS_IMAGE || exit 1 + ./buildImage.sh || exit 1 + #docker build --no-cache --build-arg BASE_IMAGE=$ORACLE_IMAGE -t $ORDS_IMAGE . || exit 1 + docker run -d --name $ORDS_CONTAINER --network $NETWORK_NAME -p $ORDS_PORT:8080 $ORDS_IMAGE || exit 1 + cd - || exit 1 } # Main script execution -#create_docker_network -#build_oracle_image -#run_oracle_container -#download_apex -#build_run_apex_container -#download_ords +# create_docker_network +# build_oracle_image +# run_oracle_container +# download_apex +# build_run_apex_container +# download_ords build_run_ords_container echo "Setup completed successfully." + diff --git a/install_ords.sh b/install_ords.sh deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/setup_oracle.sh b/setup_oracle.sh deleted file mode 100644 index e5bc32bd05..0000000000 --- a/setup_oracle.sh +++ /dev/null @@ -1,85 +0,0 @@ -#!/bin/bash - - -# Get the directory where the script is located -SCRIPT_DIR=$(dirname "$0") - -# Check if the Docker network exists -NETWORK_NAME="my-net" -if ! docker network ls --format '{{.Name}}' | grep -w $NETWORK_NAME > /dev/null; then - echo "Creating Docker network: $NETWORK_NAME" - docker network create $NETWORK_NAME -else - echo "Docker network $NETWORK_NAME already exists" -fi || exit 1 - -# Change to the Oracle Database directory -cd "$SCRIPT_DIR/OracleDatabase/SingleInstance/dockerfiles" || exit 1 - -# Build the Oracle Database container image -./buildContainerImage.sh -v 19.3.0 -e || exit 1 - -# Run the Oracle Database container -docker run -d --name oracledb19.3 --network=my-net \ - -p 1521:1521 \ - -p 5500:5500 \ - -p 2484:2484 \ - --ulimit nofile=1024:65536 \ - --ulimit nproc=2047:16384 \ - --ulimit stack=10485760:33554432 \ - --ulimit memlock=3221225472 \ - -e ORACLE_SID=dev \ - -e ORACLE_PDB=pdb1 \ - -e ORACLE_PWD=SysPassw0rd \ - -e INIT_SGA_SIZE=1000 \ - -e INIT_PGA_SIZE=500 \ - -e INIT_CPU_COUNT=4 \ - -e INIT_PROCESSES=100 \ - -e ORACLE_EDITION=enterprise \ - -e ORACLE_CHARACTERSET=AL32UTF8 \ - -e ENABLE_ARCHIVELOG=true \ - -e ENABLE_FORCE_LOGGING=true \ - -e ENABLE_TCPS=true \ - -v /opt/oracle/oradata \ - oracle/database:19.3.0-ee - -sleep 1200 - -cd .. || exit 1 -cd .. || exit 1 -cd .. || exit 1 -# Change to the Oracle REST Data Services directory -cd "OracleApplicationExpress/dockerfiles" || exit 1 - -# Download and unzip ORDS -./download_apex.sh "https://download.oracle.com/otn_software/apex/apex_24.1.zip" "$SCRIPT_DIR/tmp" || exit 1 - -# Build the ORDS Docker image -docker build --build-arg BASE_IMAGE=oracle/database:19.3.0-ee -t apex:24.1 . || exit 1 - -#Run the ORDS container -docker run -d --name apex24.1 --network my-net \ - -e DB_HOST=192.168.4.48 \ - -e DB_PORT=1521 \ - -e DB_SERVICE=DEV \ - -e DB_USER=sys \ - -e DB_PASSWORD=SysPassw0rd \ -apex:24.1 || exit 1 - - - -cd .. || exit 1 -cd .. || exit 1 -# Change to the Oracle REST Data Services directory -cd "OracleRestDataServices/dockerfiles" || exit 1 - -# Download and unzip ORDS -./download_ords.sh "https://download.oracle.com/otn_software/java/ords/ords-24.2.2.187.1943.zip" "$SCRIPT_DIR/tmp" || exit 1 - -# Build the ORDS Docker image -docker build --build-arg BASE_IMAGE=oracle/database:19.3.0-ee -t ords:latest . || exit 1 - -# Run the ORDS container -docker run -d --name ords -p 8080:8080 ords:latest || exit 1 - -echo "Setup completed successfully." diff --git a/setup_oracle_old.sh b/setup_oracle_old.sh deleted file mode 100644 index e5bc32bd05..0000000000 --- a/setup_oracle_old.sh +++ /dev/null @@ -1,85 +0,0 @@ -#!/bin/bash - - -# Get the directory where the script is located -SCRIPT_DIR=$(dirname "$0") - -# Check if the Docker network exists -NETWORK_NAME="my-net" -if ! docker network ls --format '{{.Name}}' | grep -w $NETWORK_NAME > /dev/null; then - echo "Creating Docker network: $NETWORK_NAME" - docker network create $NETWORK_NAME -else - echo "Docker network $NETWORK_NAME already exists" -fi || exit 1 - -# Change to the Oracle Database directory -cd "$SCRIPT_DIR/OracleDatabase/SingleInstance/dockerfiles" || exit 1 - -# Build the Oracle Database container image -./buildContainerImage.sh -v 19.3.0 -e || exit 1 - -# Run the Oracle Database container -docker run -d --name oracledb19.3 --network=my-net \ - -p 1521:1521 \ - -p 5500:5500 \ - -p 2484:2484 \ - --ulimit nofile=1024:65536 \ - --ulimit nproc=2047:16384 \ - --ulimit stack=10485760:33554432 \ - --ulimit memlock=3221225472 \ - -e ORACLE_SID=dev \ - -e ORACLE_PDB=pdb1 \ - -e ORACLE_PWD=SysPassw0rd \ - -e INIT_SGA_SIZE=1000 \ - -e INIT_PGA_SIZE=500 \ - -e INIT_CPU_COUNT=4 \ - -e INIT_PROCESSES=100 \ - -e ORACLE_EDITION=enterprise \ - -e ORACLE_CHARACTERSET=AL32UTF8 \ - -e ENABLE_ARCHIVELOG=true \ - -e ENABLE_FORCE_LOGGING=true \ - -e ENABLE_TCPS=true \ - -v /opt/oracle/oradata \ - oracle/database:19.3.0-ee - -sleep 1200 - -cd .. || exit 1 -cd .. || exit 1 -cd .. || exit 1 -# Change to the Oracle REST Data Services directory -cd "OracleApplicationExpress/dockerfiles" || exit 1 - -# Download and unzip ORDS -./download_apex.sh "https://download.oracle.com/otn_software/apex/apex_24.1.zip" "$SCRIPT_DIR/tmp" || exit 1 - -# Build the ORDS Docker image -docker build --build-arg BASE_IMAGE=oracle/database:19.3.0-ee -t apex:24.1 . || exit 1 - -#Run the ORDS container -docker run -d --name apex24.1 --network my-net \ - -e DB_HOST=192.168.4.48 \ - -e DB_PORT=1521 \ - -e DB_SERVICE=DEV \ - -e DB_USER=sys \ - -e DB_PASSWORD=SysPassw0rd \ -apex:24.1 || exit 1 - - - -cd .. || exit 1 -cd .. || exit 1 -# Change to the Oracle REST Data Services directory -cd "OracleRestDataServices/dockerfiles" || exit 1 - -# Download and unzip ORDS -./download_ords.sh "https://download.oracle.com/otn_software/java/ords/ords-24.2.2.187.1943.zip" "$SCRIPT_DIR/tmp" || exit 1 - -# Build the ORDS Docker image -docker build --build-arg BASE_IMAGE=oracle/database:19.3.0-ee -t ords:latest . || exit 1 - -# Run the ORDS container -docker run -d --name ords -p 8080:8080 ords:latest || exit 1 - -echo "Setup completed successfully." From ff9e5f6723d0f25d3641ff23cf7eeb0a68390528 Mon Sep 17 00:00:00 2001 From: Charith <158429045+gamagecb@users.noreply.github.com> Date: Fri, 19 Jul 2024 11:02:47 +0930 Subject: [PATCH 08/11] Update install.sh Uncomment the functions --- install.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/install.sh b/install.sh index 261053ca23..b8a3875241 100644 --- a/install.sh +++ b/install.sh @@ -99,12 +99,12 @@ build_run_ords_container() { } # Main script execution -# create_docker_network -# build_oracle_image -# run_oracle_container -# download_apex -# build_run_apex_container -# download_ords +create_docker_network +build_oracle_image +run_oracle_container +download_apex +build_run_apex_container +download_ords build_run_ords_container echo "Setup completed successfully." From a3016fb29de7d2de2cc6a8445b8592e91d92b1c5 Mon Sep 17 00:00:00 2001 From: Charith <158429045+gamagecb@users.noreply.github.com> Date: Fri, 19 Jul 2024 11:39:20 +0930 Subject: [PATCH 09/11] Update gen_pool_xml.sh Updated hostname --- OracleRestDataServices/dockerfiles/gen_pool_xml.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OracleRestDataServices/dockerfiles/gen_pool_xml.sh b/OracleRestDataServices/dockerfiles/gen_pool_xml.sh index ccd7624d69..f941a00798 100644 --- a/OracleRestDataServices/dockerfiles/gen_pool_xml.sh +++ b/OracleRestDataServices/dockerfiles/gen_pool_xml.sh @@ -13,7 +13,7 @@ cat < "$OUTPUT_FILE" Saved on $(date) basic -192.168.4.48 +host.docker.internal 1521 DEV From 34e1f811278bbfcaa746a8fcb012edd97745125a Mon Sep 17 00:00:00 2001 From: Charith <158429045+gamagecb@users.noreply.github.com> Date: Fri, 19 Jul 2024 11:41:45 +0930 Subject: [PATCH 10/11] Update Dockerfile Update to generate pool.xml file by script --- OracleRestDataServices/dockerfiles/Dockerfile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/OracleRestDataServices/dockerfiles/Dockerfile b/OracleRestDataServices/dockerfiles/Dockerfile index a422b48e3a..d10ee4c4e5 100644 --- a/OracleRestDataServices/dockerfiles/Dockerfile +++ b/OracleRestDataServices/dockerfiles/Dockerfile @@ -41,7 +41,7 @@ ENV ORDS_PASSWORD_APEX=$ORDS_PASSWORD_APEX # Copy the ORDS files into the container COPY tmp $ORDS_HOME COPY ords_params.properties $CONFIG_DIR/ - +COPY gen_pool_xml.sh $CONFIG_DIR/ USER root # Install Java 11 OpenJDK @@ -87,8 +87,12 @@ SysPassw0rd ApexPassw0rd EOF -RUN sed -i 's|disabled|proxied|g' /etc/ords/config/databases/default/pool.xml +# Run the gen_pool_xml.sh script +RUN cd $CONFIG_DIR && \ + bash ./gen_pool_xml.sh +# Clean up by removing the script if no longer needed +RUN rm $CONFIG_DIR/gen_pool_xml.sh # Start ORDS using the new CLI CMD ["sh", "-c", "$ORDS_HOME/bin/ords --config $CONFIG_DIR serve"] From a6ce8568ff1e3173efbc9f22b9886228966c36b9 Mon Sep 17 00:00:00 2001 From: gamagec Date: Fri, 28 Mar 2025 14:18:32 +1030 Subject: [PATCH 11/11] Modifications to add Apex 24.2 version --- OracleApplicationExpress/dockerfiles/setup_apex.sh | 2 +- config.properties | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/OracleApplicationExpress/dockerfiles/setup_apex.sh b/OracleApplicationExpress/dockerfiles/setup_apex.sh index 63f56c75c9..65cde7e625 100644 --- a/OracleApplicationExpress/dockerfiles/setup_apex.sh +++ b/OracleApplicationExpress/dockerfiles/setup_apex.sh @@ -45,7 +45,7 @@ sqlplus -s $DB_USER/$DB_PASSWORD@$DB_HOST:$DB_PORT/$DB_SERVICE as sysdba < 'IMAGE_PREFIX', - p_value => 'https://static.oracle.com/cdn/apex/24.1.0/' ); + p_value => 'https://static.oracle.com/cdn/apex/24.2.0/' ); else dbms_output.put_line('APEX_PUBLIC_USER not found. Installation may not have completed successfully.'); diff --git a/config.properties b/config.properties index 7757dcb21f..af6d3ad45d 100644 --- a/config.properties +++ b/config.properties @@ -2,10 +2,10 @@ NETWORK_NAME=my-net ORACLE_IMAGE=oracle/database:19.3.0-ee ORDS_IMAGE=ords:24.2 -APEX_IMAGE=apex:24.1 +APEX_IMAGE=apex:24.2 ORACLE_CONTAINER=oracledb19.3 ORDS_CONTAINER=ords24.2 -APEX_CONTAINER=apex24.1 +APEX_CONTAINER=apex24.2 TMP_DIR=./tmp ORDS_PORT=8081 @@ -26,5 +26,5 @@ DB_USER=sys DB_PASSWORD=SysPassw0rd # Download URLs -APEX_URL=https://download.oracle.com/otn_software/apex/apex_24.1.zip +APEX_URL=https://download.oracle.com/otn_software/apex/apex_24.2.zip ORDS_URL=https://download.oracle.com/otn_software/java/ords/ords-24.2.2.187.1943.zip