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..3e7ace1429 --- /dev/null +++ b/OracleApplicationExpress/dockerfiles/Dockerfile @@ -0,0 +1,28 @@ +# Use Oracle 19c image as the base +ARG BASE_IMAGE +FROM ${BASE_IMAGE} + +# Set environment variables +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/ + +# 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..65cde7e625 --- /dev/null +++ b/OracleApplicationExpress/dockerfiles/setup_apex.sh @@ -0,0 +1,58 @@ +#!/bin/bash + +# Source the properties file +source ../../config.properties + +echo "Removing any existing APEX setup..." +cd /opt/oracle/apex +sqlplus -s $DB_USER/$DB_PASSWORD@$DB_HOST:$DB_PORT/$DB_SERVICE 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.2.0/' ); + + else + dbms_output.put_line('APEX_PUBLIC_USER not found. Installation may not have completed successfully.'); + end if; + end; + / + exit; +EOF +echo "Finished resetting password for APEX_PUBLIC_USER..." + diff --git a/OracleDatabase/SingleInstance/dockerfiles/19.3.0/Dockerfile b/OracleDatabase/SingleInstance/dockerfiles/19.3.0/Dockerfile index 04c2704694..e9a6686d33 100644 --- a/OracleDatabase/SingleInstance/dockerfiles/19.3.0/Dockerfile +++ b/OracleDatabase/SingleInstance/dockerfiles/19.3.0/Dockerfile @@ -142,3 +142,4 @@ HEALTHCHECK --interval=1m --start-period=5m --timeout=30s \ # Define default command to start Oracle Database. CMD [ "/bin/bash", "-c", "exec $ORACLE_BASE/$RUN_FILE" ] + diff --git a/OracleRestDataServices/dockerfiles/Dockerfile b/OracleRestDataServices/dockerfiles/Dockerfile index 9881090d90..d10ee4c4e5 100644 --- a/OracleRestDataServices/dockerfiles/Dockerfile +++ b/OracleRestDataServices/dockerfiles/Dockerfile @@ -1,80 +1,98 @@ -# LICENSE UPL 1.0 -# -# Copyright (c) 1982-2017 Oracle and/or its affiliates. All rights reserved. -# -# ORACLE DOCKERFILES PROJECT -# -------------------------- -# This is the Dockerfile for Oracle Rest Data Services -# -# REQUIRED FILES TO BUILD THIS IMAGE -# ---------------------------------- -# (1) ords.3.0.10.165.06.53.zip -# Download Oracle Rest Data Services from -# http://www.oracle.com/technetwork/developer-tools/rest-data-services/downloads/index.html -# -# HOW TO BUILD THIS IMAGE -# ----------------------- -# Put the downloaded file in the same directory as this Dockerfile -# Run: -# $ docker build -t oracle/restdataservices:3.0.10 . -# -# Pull base image -# --------------- - -ARG BASE_IMAGE=container-registry.oracle.com/java/serverjre:latest +# Use a base image passed as a build argument +ARG BASE_IMAGE FROM ${BASE_IMAGE} -# Labels -# ---------- -LABEL maintainer "gerald.venzl@oracle.com" +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 +# Install Java 11 OpenJDK +RUN yum install -y java-11-openjdk-devel + +# Add ORDS bin directory to PATH +RUN echo 'export PATH="$PATH:$ORDS_HOME/bin"' >> ~/.bashrc -# 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" +# Create the configuration directory +RUN mkdir -p $CONFIG_DIR -# Copy binaries -# ------------- -COPY $INSTALL_FILE $CONFIG_PROPS $STANDALONE_PROPS $RUN_FILE $ORDS_HOME/ +# Provide database connection details and other configurations +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=$ORDS_GATEWAY_MODE" >> $CONFIG_DIR/ords_params.properties && \ + echo "rest.services.enabled=ORDS_REST_ENABLED_SQL" >> $CONFIG_DIR/ords_params.properties -# ARG for installing APEX prerequisites -ARG INCLUDE_APEX=true +# 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 $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 \ + --gateway-mode proxied \ + --gateway-user APEX_PUBLIC_USER \ + --proxy-user \ + --password-stdin < " + 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/OracleRestDataServices/dockerfiles/gen_pool_xml.sh b/OracleRestDataServices/dockerfiles/gen_pool_xml.sh new file mode 100644 index 0000000000..f941a00798 --- /dev/null +++ b/OracleRestDataServices/dockerfiles/gen_pool_xml.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +# Set the output file path +OUTPUT_FILE="/etc/ords/config/databases/default/pool.xml" + +# Create the directory if it doesn't exist +mkdir -p $(dirname "$OUTPUT_FILE") + +# Generate the pool.xml content +cat < "$OUTPUT_FILE" + + + +Saved on $(date) +basic +host.docker.internal +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/README.md b/README.md index 2f7637cf9c..8e16676126 100644 --- a/README.md +++ b/README.md @@ -1,89 +1,59 @@ -# 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 -- [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 +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) -- [Oracle Forms and Reports](https://github.com/oracle/docker-images/issues/212) -- [Oracle Unified Directory](Contrib/OracleUnifiedDirectory/) +Clone this repository and Copy the `.zip` file into the folder: +``` +Oracle-Docker-Images\OracleDatabase\SingleInstance\dockerfiles\19.3.0\ +``` -### Archived Projects +## Step 3: Installing Oracle Database 19.3.0 (Enterprise Edition), APEX 24.1, and ORDS 24.2 -- [ContainerCloud](/Archive/ContainerCloud) -- [Oracle Data Integrator](/Archive/OracleDataIntegrator) -- [Oracle Enterprise Data Quality](/Archive/OracleEDQ) -- [Oracle TSAM Plus](/Archive/OracleTuxedo/tsam) +Open a Git Bash window in the root directory of this project and run the following script: +```sh +./install.sh +``` -## Pre-Built Images with Commercial Software +This process will take approximately 30 minutes. -These sources already contain Oracle commercial software and require license -acceptance prior to download: +## Step 4: Reset Password for the APEX Administration Services Account -- [Oracle Container Registry](https://container-registry.oracle.com) +Create a connection in SQL Developer using the following details: -## Support +- **DB_PORT**: `1521` +- **DB_HOST**: `localhost` +- **DB_SERVICE**: `DEV` +- **DB_USER**: `sys` +- **DB_PASSWORD**: `SysPassw0rd` -For support and certification information, please consult the documentation -for each product. +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; +``` -For support, bug reporting and feedback about the provided Dockerfiles, please -open an [issue on GitHub](https://github.com/oracle/docker-images/issues). +## Step 5: Login to APEX -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. +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) -## Contributing +--- -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 -. diff --git a/config.properties b/config.properties new file mode 100644 index 0000000000..af6d3ad45d --- /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.2 +ORACLE_CONTAINER=oracledb19.3 +ORDS_CONTAINER=ords24.2 +APEX_CONTAINER=apex24.2 +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.2.zip +ORDS_URL=https://download.oracle.com/otn_software/java/ords/ords-24.2.2.187.1943.zip diff --git a/install.sh b/install.sh new file mode 100644 index 0000000000..b8a3875241 --- /dev/null +++ b/install.sh @@ -0,0 +1,111 @@ +#!/bin/bash + +# Source the properties file +source ./config.properties +SCRIPT_DIR=$(dirname "$0") + +# 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" + docker network create $NETWORK_NAME + else + echo "Docker network $NETWORK_NAME already exists" + fi || exit 1 +} + +# Function to clean up the temporary directory +cleanup_tmp_dir() { + echo "Cleaning $TMP_DIR" + if [ -d "$TMP_DIR" ]; then + echo "Removing existing tmp directory: $TMP_DIR" + rm -rf "$TMP_DIR" + fi +} + +# 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 +} + +# Function to run Oracle Database container +run_oracle_container() { + docker run -d --name $ORACLE_CONTAINER --network=$NETWORK_NAME \ + -p $DB_PORT: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 +} + +# Function to download and unzip APEX +download_apex() { + cd "$SCRIPT_DIR/OracleApplicationExpress/dockerfiles" || exit 1 + cleanup_tmp_dir + ./download_apex.sh "$APEX_URL" "$TMP_DIR" || exit 1 + cd - || exit 1 +} + +# 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 + 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 +} + +# Function to download and unzip ORDS +download_ords() { + cd "$SCRIPT_DIR/OracleRestDataServices/dockerfiles" || exit 1 + cleanup_tmp_dir + ./download_ords.sh "$ORDS_URL" "$TMP_DIR" || exit 1 + cd - || exit 1 +} + +# Function to build and run ORDS container +build_run_ords_container() { + cd "$SCRIPT_DIR/OracleRestDataServices/dockerfiles" || 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 +build_run_ords_container + +echo "Setup completed successfully." +