-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Feature/adding oracle apex #2952
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
458cc52
a3db3a5
ba24b19
e84c018
9675c9e
5508dff
aa3238a
c59f51c
ff9e5f6
a3016fb
34e1f81
a6ce856
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,4 @@ | |
.idea/ | ||
.DS_Store | ||
.vscode/ | ||
**/tmp/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.DS_Store |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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=<local-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 <your network name> | ||
``` | ||
|
||
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=<your network name> 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 <container name> \ | ||
--network=<name of your created network> \ | ||
-p <host port>:8888 \ | ||
-e ORACLE_HOST=<Your Oracle DB host (default: localhost)> \ | ||
-e ORACLE_PORT=<Your Oracle DB port (default: 1521)> \ | ||
-e ORACLE_SERVICE=<your Oracle DB Service name (default: ORCLPDB1)> \ | ||
-e ORACLE_PWD=<your database SYS password> \ | ||
-e ORDS_PWD=<your ORDS password> \ | ||
-e CONTEXT_ROOT=<http context-root to use (default: ords)> \ | ||
-v [<host mount point>:]/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 | ||
|
||
Comment on lines
+113
to
+114
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If there is no content for this section, it should be removed. |
||
## 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. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As before, the copyright date is incorrect and "all rights reserved" should be removed. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Use Oracle 19c image as the base | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add a copyright header to this file. |
||
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add |
||
|
||
# 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"] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/bin/bash | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add a copyright header to this file. |
||
|
||
# Variables | ||
DOWNLOAD_LINK=$1 | ||
DESTINATION_FOLDER=$2 | ||
|
||
# Check if both arguments are provided | ||
if [ -z "$DOWNLOAD_LINK" ] || [ -z "$DESTINATION_FOLDER" ]; then | ||
echo "Usage: $0 <download_link> <destination_folder>" | ||
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." |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#!/bin/bash | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add a copyright header to this file. |
||
|
||
# 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 <<EOF | ||
alter session set container = PDB1; | ||
@apxremov.sql | ||
exit; | ||
EOF | ||
echo "Finished removing APEX setup..." | ||
|
||
# Configure APEX | ||
echo "Starting APEX setup..." | ||
cd /opt/oracle/apex | ||
|
||
sqlplus -s $DB_USER/$DB_PASSWORD@$DB_HOST:$DB_PORT/$DB_SERVICE as sysdba <<EOF | ||
alter session set container = PDB1; | ||
@apexins.sql SYSAUX SYSAUX TEMP /i/ | ||
exit; | ||
EOF | ||
echo "Finished APEX setup..." | ||
|
||
|
||
|
||
# Check if APEX_PUBLIC_USER exists before attempting operations | ||
sqlplus -s $DB_USER/$DB_PASSWORD@$DB_HOST:$DB_PORT/$DB_SERVICE as sysdba <<EOF | ||
alter session set container = pdb1; | ||
set serveroutput on | ||
declare | ||
user_exists number; | ||
begin | ||
select count(*) into user_exists from dba_users where username = 'APEX_PUBLIC_USER'; | ||
if user_exists = 1 then | ||
execute immediate 'alter user APEX_PUBLIC_USER account unlock'; | ||
execute immediate 'alter user APEX_PUBLIC_USER identified by ApexPassw0rd'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oracle security does not permit the use of fixed passwords. This should be randomly generated at runtime and provided to the user via output or log. |
||
dbms_output.put_line('APEX_PUBLIC_USER unlocked and password set.'); | ||
|
||
ords_admin.config_plsql_gateway( | ||
p_runtime_user => '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..." | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a brand new file. It should be
Copyright (c) 2025 Oracle and/or its affiliates.
Oracle no longer includes the phrase "all rights reserved"