├── .gitattributes ├── .gitignore ├── 01-build.sh ├── 02-run.sh ├── LICENSE ├── README.md ├── files └── .gitkeep ├── oml-kit └── installR.sh ├── quickstart.sh ├── scripts ├── setup │ ├── 01-install.sh │ ├── 02-emaccess.sh │ └── package │ │ ├── enableEmAccess.sh │ │ ├── enableORE.sh │ │ ├── installApex.sh │ │ ├── installOrds.sh │ │ ├── postInstallApexOrds.sh │ │ └── setupBaseWallet.sh └── startup │ ├── 01-run.sh │ └── package │ ├── installOreDeps.sh │ ├── installRequiredPackages.R │ └── runOrds.sh ├── settings.env.sample ├── settings_db19c.env.sample └── settings_db21c.env.sample /.gitattributes: -------------------------------------------------------------------------------- 1 | ## GITATTRIBUTES FOR WEB PROJECTS 2 | # 3 | # These settings are for any web project. 4 | # 5 | # Details per file setting: 6 | # text These files should be normalized (i.e. convert CRLF to LF). 7 | # binary These files are binary and should be left untouched. 8 | # 9 | # Note that binary is a macro for -text -diff. 10 | ###################################################################### 11 | 12 | ## AUTO-DETECT 13 | ## Handle line endings automatically for files detected as 14 | ## text and leave all files detected as binary untouched. 15 | ## This will handle all files NOT defined below. 16 | * text=auto 17 | 18 | ## SOURCE CODE 19 | *.bat text eol=crlf 20 | *.coffee text 21 | *.css text 22 | *.htm text diff=html 23 | *.html text diff=html 24 | *.inc text 25 | *.ini text 26 | *.js text 27 | *.json text 28 | *.jsx text 29 | *.less text 30 | *.od text 31 | *.onlydata text 32 | *.php text diff=php 33 | *.pl text 34 | *.py text diff=python 35 | *.rb text diff=ruby 36 | *.sass text 37 | *.scm text 38 | *.scss text 39 | *.sh text eol=lf 40 | *.sql text 41 | *.styl text 42 | *.tag text 43 | *.ts text 44 | *.tsx text 45 | *.vue text 46 | *.xml text 47 | *.xhtml text diff=html 48 | 49 | ## DOCKER 50 | *.dockerignore text 51 | Dockerfile text 52 | 53 | ## DOCUMENTATION 54 | *.ipynb text 55 | *.markdown text 56 | *.md text 57 | *.mdwn text 58 | *.mdown text 59 | *.mkd text 60 | *.mkdn text 61 | *.mdtxt text 62 | *.mdtext text 63 | *.txt text 64 | AUTHORS text 65 | CHANGELOG text 66 | CHANGES text 67 | CONTRIBUTING text 68 | COPYING text 69 | copyright text 70 | *COPYRIGHT* text 71 | INSTALL text 72 | license text 73 | LICENSE text 74 | NEWS text 75 | readme text 76 | *README* text 77 | TODO text 78 | 79 | ## TEMPLATES 80 | *.dot text 81 | *.ejs text 82 | *.haml text 83 | *.handlebars text 84 | *.hbs text 85 | *.hbt text 86 | *.jade text 87 | *.latte text 88 | *.mustache text 89 | *.njk text 90 | *.phtml text 91 | *.tmpl text 92 | *.tpl text 93 | *.twig text 94 | 95 | ## LINTERS 96 | .csslintrc text 97 | .eslintrc text 98 | .htmlhintrc text 99 | .jscsrc text 100 | .jshintrc text 101 | .jshintignore text 102 | .stylelintrc text 103 | 104 | ## CONFIGS 105 | *.bowerrc text 106 | *.cnf text 107 | *.conf text 108 | *.config text 109 | .babelrc text 110 | .browserslistrc text 111 | .editorconfig text 112 | .env text 113 | .gitattributes text 114 | .gitconfig text 115 | .gitignore text 116 | .htaccess text 117 | *.lock text 118 | *.npmignore text 119 | *.yaml text 120 | *.yml text 121 | browserslist text 122 | Makefile text 123 | makefile text 124 | 125 | ## HEROKU 126 | Procfile text 127 | .slugignore text 128 | 129 | ## GRAPHICS 130 | *.ai binary 131 | *.bmp binary 132 | *.eps binary 133 | *.gif binary 134 | *.ico binary 135 | *.jng binary 136 | *.jp2 binary 137 | *.jpg binary 138 | *.jpeg binary 139 | *.jpx binary 140 | *.jxr binary 141 | *.pdf binary 142 | *.png binary 143 | *.psb binary 144 | *.psd binary 145 | *.svg text 146 | *.svgz binary 147 | *.tif binary 148 | *.tiff binary 149 | *.wbmp binary 150 | *.webp binary 151 | 152 | ## AUDIO 153 | *.kar binary 154 | *.m4a binary 155 | *.mid binary 156 | *.midi binary 157 | *.mp3 binary 158 | *.ogg binary 159 | *.ra binary 160 | 161 | ## VIDEO 162 | *.3gpp binary 163 | *.3gp binary 164 | *.as binary 165 | *.asf binary 166 | *.asx binary 167 | *.fla binary 168 | *.flv binary 169 | *.m4v binary 170 | *.mng binary 171 | *.mov binary 172 | *.mp4 binary 173 | *.mpeg binary 174 | *.mpg binary 175 | *.ogv binary 176 | *.swc binary 177 | *.swf binary 178 | *.webm binary 179 | 180 | ## ARCHIVES 181 | *.7z binary 182 | *.gz binary 183 | *.jar binary 184 | *.rar binary 185 | *.tar binary 186 | *.zip binary 187 | 188 | ## FONTS 189 | *.ttf binary 190 | *.eot binary 191 | *.otf binary 192 | *.woff binary 193 | *.woff2 binary 194 | 195 | ## EXECUTABLES 196 | *.exe binary 197 | *.pyc binary -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Created by https://www.gitignore.io/api/osx,macos,linux,windows 3 | # Edit at https://www.gitignore.io/?templates=osx,macos,linux,windows 4 | 5 | ### Linux ### 6 | *~ 7 | 8 | # temporary files which can be created if a process still has a handle open of a deleted file 9 | .fuse_hidden* 10 | 11 | # KDE directory preferences 12 | .directory 13 | 14 | # Linux trash folder which might appear on any partition or disk 15 | .Trash-* 16 | 17 | # .nfs files are created when an open file is removed but is still being accessed 18 | .nfs* 19 | 20 | ### macOS ### 21 | # General 22 | .DS_Store 23 | .AppleDouble 24 | .LSOverride 25 | 26 | # Icon must end with two \r 27 | Icon 28 | 29 | # Thumbnails 30 | ._* 31 | 32 | # Files that might appear in the root of a volume 33 | .DocumentRevisions-V100 34 | .fseventsd 35 | .Spotlight-V100 36 | .TemporaryItems 37 | .Trashes 38 | .VolumeIcon.icns 39 | .com.apple.timemachine.donotpresent 40 | 41 | # Directories potentially created on remote AFP share 42 | .AppleDB 43 | .AppleDesktop 44 | Network Trash Folder 45 | Temporary Items 46 | .apdisk 47 | 48 | ### OSX ### 49 | # General 50 | 51 | # Icon must end with two \r 52 | 53 | # Thumbnails 54 | 55 | # Files that might appear in the root of a volume 56 | 57 | # Directories potentially created on remote AFP share 58 | 59 | ### Windows ### 60 | # Windows thumbnail cache files 61 | Thumbs.db 62 | ehthumbs.db 63 | ehthumbs_vista.db 64 | 65 | # Dump file 66 | *.stackdump 67 | 68 | # Folder config file 69 | [Dd]esktop.ini 70 | 71 | # Recycle Bin used on file shares 72 | $RECYCLE.BIN/ 73 | 74 | # Windows Installer files 75 | *.cab 76 | *.msi 77 | *.msix 78 | *.msm 79 | *.msp 80 | 81 | # Windows shortcuts 82 | *.lnk 83 | 84 | # End of https://www.gitignore.io/api/osx,macos,linux,windows 85 | *.zip 86 | *.rpm 87 | *.tar 88 | *.gz 89 | *.swp 90 | tmp 91 | dockerfiles 92 | oradata 93 | *-oradata 94 | *.env 95 | *.bak 96 | *.log 97 | *.tar.gz -------------------------------------------------------------------------------- /01-build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ENV_FILE=${1:-.env} 4 | 5 | . $ENV_FILE 6 | 7 | BASE_DIR=$(pwd -P) 8 | DB_VERSION=${DB_VERSION:-18.4.0} 9 | DB_EDITION=$(echo ${DB_EDITION:-xe} | tr '[:upper:]' '[:lower:]') 10 | FILES_DIR=${FILES_DIR:-$BASE_DIR/files} 11 | ALLOW_DB_PATCHING=${ALLOW_DB_PATCHING:-N} 12 | OML4R_SUPPORT=${OML4R_SUPPORT:-N} 13 | XE_DOWNLOAD_BASE_URL="https://download.oracle.com/otn-pub/otn_software/db-express/" 14 | 15 | SED_OPTS='-i -r' 16 | if [[ "$OSTYPE" == "darwin"* ]]; then 17 | SED_OPTS='-i .bak -E' 18 | fi 19 | 20 | case "$DB_EDITION" in 21 | "ee") 22 | DB_EDITION_FLAG=-e 23 | ;; 24 | "se2") 25 | DB_EDITION_FLAG=-s 26 | ;; 27 | *) 28 | DB_EDITION_FLAG=-x 29 | ;; 30 | esac 31 | 32 | function setupR() { 33 | echo "Installing R for Oracle ML Support" 34 | # Copy the installR.sh to the base Docker directory. 35 | cp -R $BASE_DIR/oml-kit/installR.sh . 36 | 37 | # Modify the COPY statement. 38 | sed $SED_OPTS "s|^(COPY)(.+CHECK_SPACE_FILE.+INSTALL_DIR/)$|\1 installR.sh\2|g" ${DOCKER_FILE:-Dockerfile} 39 | 40 | REPLACEMENT_STRING=$'\$INSTALL_DIR/installR.sh \&\& \\\ \\\n ' 41 | sed $SED_OPTS "s|(rm -rf .INSTALL_DIR.*)$|${REPLACEMENT_STRING}\1|g" ${DOCKER_FILE:-Dockerfile} 42 | } 43 | 44 | if [ -d 'dockerfiles' ]; then 45 | rm -rf dockerfiles; 46 | fi 47 | 48 | echo "##### Grabbing official Docker images from Oracle #####" 49 | git clone https://github.com/oracle/docker-images.git tmp 50 | 51 | mv tmp/OracleDatabase/SingleInstance/dockerfiles/ . 52 | 53 | rm -rf tmp/ 54 | 55 | echo "##### Staging RPM #####" 56 | if [ $DB_VERSION = '21.3.0' ]; then 57 | if [ $DB_EDITION = 'xe' ]; then 58 | DOCKER_FILE=Dockerfile.$DB_EDITION 59 | if [[ $XE_USE_LOCAL_COPY =~ (Y|y) ]]; then 60 | cd dockerfiles/$DB_VERSION && curl --progress-bar -O file://$FILES_DIR/oracle-database-xe-21c-1.0-1.ol7.x86_64.rpm 61 | sed $SED_OPTS "s|${XE_DOWNLOAD_BASE_URL}||g" ${DOCKER_FILE:-Dockerfile} 62 | sed $SED_OPTS "s|^(COPY)(.+CHECK_SPACE_FILE.+INSTALL_DIR/)$|\1 \$INSTALL_FILE_1\2|g" ${DOCKER_FILE:-Dockerfile} 63 | fi 64 | else 65 | cd dockerfiles/$DB_VERSION && curl --progress-bar -O file://$FILES_DIR/LINUX.X64_213000_db_home.zip 66 | DOCKER_FILE=Dockerfile 67 | fi 68 | elif [ $DB_VERSION = '19.3.0' ]; then 69 | cd dockerfiles/$DB_VERSION && curl --progress-bar -O file://$FILES_DIR/LINUX.X64_193000_db_home.zip 70 | DOCKER_FILE=Dockerfile 71 | elif [ $DB_VERSION = '18.4.0' ] && [ $DB_EDITION = 'xe' ]; then 72 | DOCKER_FILE=Dockerfile.$DB_EDITION 73 | if [[ $XE_USE_LOCAL_COPY =~ (Y|y) ]]; then 74 | cd dockerfiles/$DB_VERSION && curl --progress-bar -O file://$FILES_DIR/oracle-database-xe-18c-1.0-1.x86_64.rpm 75 | sed $SED_OPTS "s|${XE_DOWNLOAD_BASE_URL}||g" ${DOCKER_FILE:-Dockerfile} 76 | sed $SED_OPTS "s|^(COPY)(.+CHECK_SPACE_FILE.+INSTALL_DIR/)$|\1 \$INSTALL_FILE_1\2|g" ${DOCKER_FILE:-Dockerfile} 77 | fi 78 | elif [ $DB_VERSION = '18.3.0' ]; then 79 | cd dockerfiles/$DB_VERSION && curl --progress-bar -O file://$FILES_DIR/LINUX.X64_180000_db_home.zip 80 | DOCKER_FILE=Dockerfile 81 | elif [ $DB_VERSION = '12.2.0.1' ]; then 82 | cd dockerfiles/$DB_VERSION && curl --progress-bar -O file://$FILES_DIR/linuxx64_12201_database.zip 83 | DOCKER_FILE=Dockerfile 84 | elif [ $DB_VERSION = '12.1.0.2' ]; then 85 | cd dockerfiles/$DB_VERSION && curl --progress-bar -O file://$FILES_DIR/linuxamd64_12102_database_1of2.zip 86 | cd dockerfiles/$DB_VERSION && curl --progress-bar -O file://$FILES_DIR/linuxamd64_12102_database_2of2.zip 87 | DOCKER_FILE=Dockerfile.$DB_EDITION 88 | elif [ $DB_VERSION = '11.2.0.2' ]; then 89 | cd dockerfiles/$DB_VERSION && curl --progress-bar -O file://$FILES_DIR/oracle-xe-11.2.0-1.0.x86_64.rpm.zip 90 | DOCKER_FILE=Dockerfile.$DB_EDITION 91 | else 92 | echo "Unknown or unsupported database version and/or edition." 93 | fi 94 | 95 | # TODO: test OML4R support for 21.3.0 96 | if [[ $OML4R_SUPPORT =~ (Y|y) ]]; then 97 | if [[ 98 | ($DB_VERSION = '19.3.0') 99 | || ($DB_VERSION = '18.4.0' && $DB_EDITION = 'xe') 100 | || ($DB_VERSION = '18.3.0') 101 | # || ($DB_VERSION = '12.2.0.1') 102 | ]]; then 103 | setupR 104 | fi 105 | fi 106 | 107 | cd $BASE_DIR 108 | 109 | # RTU_ENABLED default 'N' 110 | # The following is used for preparing "ready to use" images for internal use only. 111 | if [[ $RTU_ENABLED =~ (Y|y) ]]; then 112 | echo "##### Modify target Dockerfile #####" 113 | REPLACEMENT_STRING=$'COPY scripts/setup/ \$ORACLE_BASE/scripts/setup/\\\nCOPY scripts/startup/ \$ORACLE_BASE/scripts/startup/\\\nCOPY files/ /tmp/files/\\\n' 114 | sed $SED_OPTS "s|^VOLUME.+$|${REPLACEMENT_STRING}|g" dockerfiles/${DB_VERSION}/${DOCKER_FILE:-Dockerfile} 115 | mkdir -p dockerfiles/${DB_VERSION}/files 116 | cp $FILES_DIR/$INSTALL_FILE_APEX $FILES_DIR/$INSTALL_FILE_ORDS $FILES_DIR/$INSTALL_FILE_JAVA dockerfiles/${DB_VERSION}/files/ 117 | cp -R scripts dockerfiles/${DB_VERSION}/scripts 118 | fi 119 | 120 | # Retain the DBUA to allow DB patching. See https://github.com/oracle/docker-images/issues/1187 121 | if [[ $ALLOW_DB_PATCHING =~ (Y|y) ]]; then 122 | echo "##### Preventing removal of DBUA #####" 123 | find dockerfiles -name installDBBinaries.sh -exec sed $SED_OPTS "s|^(\s*?rm.+ORACLE_HOME.+)$|#\1|g" {} \; 124 | fi 125 | 126 | echo "##### Building Docker Image for Oracle Database ${DB_VERSION} ${DB_EDITION} #####" 127 | cd dockerfiles && . buildContainerImage.sh -v ${DB_VERSION} ${DB_EDITION_FLAG} 128 | 129 | cd $BASE_DIR 130 | echo "##### Done #####" 131 | -------------------------------------------------------------------------------- /02-run.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | CONTAINER_NAME=${1:-axer} 4 | ENV_FILE=${2:-.env} 5 | 6 | . $ENV_FILE 7 | 8 | BASE_DIR=$(pwd -P) 9 | DB_VERSION=${DB_VERSION:-18.4.0} 10 | DB_EDITION=$(echo ${DB_EDITION:-xe} | tr '[:upper:]' '[:lower:]') 11 | HOST_DATA_DIR=${CONTAINER_NAME}-oradata 12 | DOCKER_NETWORK_NAME=${DOCKER_NETWORK_NAME:-bridge} 13 | FILES_DIR=${FILES_DIR:-$BASE_DIR/files} 14 | 15 | echo "##### Check if Docker network $DOCKER_NETWORK_NAME #####" 16 | docker network inspect -f {{.Name}} $DOCKER_NETWORK_NAME || \ 17 | echo "##### Create Docker network $DOCKER_NETWORK_NAME #####"; \ 18 | docker network create $DOCKER_NETWORK_NAME 19 | 20 | echo "##### Removing any previous containers #####" 21 | docker rm -vf $CONTAINER_NAME 22 | 23 | if [ ! -d "${HOST_DATA_DIR}" ] && ! [[ $RTU_ENABLED =~ ^(Y|y)$ ]]; then 24 | mkdir $HOST_DATA_DIR 25 | fi 26 | 27 | echo "##### Changing file ownership. May require password to continue. #####" 28 | if ! [[ $RTU_ENABLED =~ ^(Y|y)$ ]]; then 29 | sudo -n chown 54321:54321 ${HOST_DATA_DIR} || chmod 777 ${HOST_DATA_DIR} 30 | fi 31 | 32 | echo "##### Creating container $CONTAINER_NAME #####" 33 | if [[ $RTU_ENABLED =~ ^(Y|y)$ ]]; then 34 | docker run -d --name $CONTAINER_NAME \ 35 | --network ${DOCKER_NETWORK_NAME} \ 36 | -p ${DOCKER_ORDS_PORT:-50080}:8080 \ 37 | -p ${DOCKER_EM_PORT:-55500}:5500 \ 38 | -p ${DOCKER_DB_PORT:-51521}:1521 \ 39 | --env-file $ENV_FILE \ 40 | --tmpfs /dev/shm:rw,exec,size=2G \ 41 | oracle/database:${DB_VERSION}-${DB_EDITION} 42 | else 43 | docker run -d --name $CONTAINER_NAME \ 44 | --network ${DOCKER_NETWORK_NAME} \ 45 | -p ${DOCKER_ORDS_PORT:-50080}:8080 \ 46 | -p ${DOCKER_EM_PORT:-55500}:5500 \ 47 | -p ${DOCKER_DB_PORT:-51521}:1521 \ 48 | --env-file $ENV_FILE \ 49 | -v $PWD/$HOST_DATA_DIR:/opt/oracle/oradata \ 50 | -v $PWD/scripts/setup:/opt/oracle/scripts/setup \ 51 | -v $PWD/scripts/startup:/opt/oracle/scripts/startup \ 52 | -v $FILES_DIR:/tmp/files \ 53 | --tmpfs /dev/shm:rw,exec,size=2G \ 54 | oracle/database:${DB_VERSION}-${DB_EDITION} 55 | fi 56 | 57 | echo "##### Tailing logs. Ctrl-C to exit. #####" 58 | docker logs -f $CONTAINER_NAME 59 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Adrian Png 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Build an APEX Stack with Docker 2 | 3 | > For background information on this repository, please read this [blog post](https://fuzziebrain.com/content/id/1902/). 4 | 5 | ## Prerequisites 6 | 7 | * Installed the following: 8 | * Git 9 | * Curl 10 | * Docker (of course) 11 | 12 | > IMPORTANT 13 | > 14 | > Build and execution has been tested in Linux only. It should work in Mac OS and Windows with Windows Subsystem for Linux 2. 15 | 16 | ## Getting Started 17 | 18 | 1. Git clone this repository and set it as the working directory. 19 | 1. Download the installer files: 20 | * The required Oracle Database installation files from [OTN](https://www.oracle.com/technetwork/database/) (supports versions up to 21.3.0 including Express Edition, as of September 22, 2021). **Note:** For [Oracle Database 21c XE](https://oracle.com/xe), you are no longer required to download the binaries (see issue #39). 21 | * [Oracle Application Express](https://apex.oracle.com/download) (supports versions up 22.2 as of January 01, 2023) 22 | * [Oracle REST Data Services](https://www.oracle.com/technetwork/developer-tools/rest-data-services/downloads/index.html) (supports versions up to 23.1 as of April 01, 2023) 23 | 1. For releases after [0.6.0](https://github.com/fuzziebrain/docker-apex-stack/releases/tag/0.6.0), either choose to use the binaries from [OpenJDK](https://openjdk.java.net/), download a licensed Java runtime, or the [free to use](https://blogs.oracle.com/java/post/free-java-license) Java 17 from Oracle. Please refer to the additonal notes section [below](#Additional-Notes-About-the-Settings-File) for details about the `INSTALL_FILE_JAVA` parameter. 24 | 1. Place all installer files in the sub-directory `files`. 25 | 1. Create a file that contains the required environment variables for your build. Please refer to the additonal notes [below](#Additional-Notes-About-the-Settings-File) for more information about the various parameters that can be set. Included in this repository are two examples or templates that you can use: 26 | * [`settings.env.sample`](./settings.env.sample). 27 | * [`settings_db19c.env.sample`](./settings_db19c.env.sample). 28 | 1. Run the first script to grab the latest Docker [images](https://github.com/oracle/docker-images) from Oracle and build the Oracle Database image. The script takes one parameter, the environment filename (`mysettings.env`): 29 | ```bash 30 | $ bash 01-build.sh mysettings.env 31 | ``` 32 | 1. Run the final script to create and run the container, where the container name is `das`: 33 | ```bash 34 | $ bash 02-run.sh das mysettings.env 35 | ``` 36 | 37 | ## Quick Start 38 | 39 | [Martin](https://github.com/martindsouza) [suggested](https://twitter.com/martindsouza/status/1412799632053211141), so here it is! Now included is the the [`quickstart.sh`](./quickstart.sh) script. Simply: 40 | 1. Execute the script. 41 | 1. Enter your email address for the APEX instance administrator. 42 | 1. Optionally, enter a preferred container name. 43 | 1. If all's good, note down your container name and password. 44 | 1. Enter `Y` to continue. 45 | 1. Wait till there is minimal or no activity in the script then go to http://localhost:8080/ords/apex. 46 | 47 | If you are new to APEX, then I highly recommend checking out some of the learning resources [here](https://apex.oracle.com/en/learn/). 48 | 49 | ``` 50 | $ ./quickstart.sh 51 | Enter an email address for your APEX administrator (required): apexdev@example.com 52 | Container name (leave empty to have one generated for you): apexiscool 53 | ##### Important Information ##### 54 | Your Docker container name is: apexiscool 55 | Your password for the database and APEX internal workspace is: donotcommit 56 | 57 | We are now ready to build the Docker image and deploy your container. 58 | Type "Y" to continue or CTRL-C to exit: y 59 | ``` 60 | 61 | > **Note** 62 | > 63 | > Should you forget to save your password, you can find it in the generated settings file along with any other details about the container. It is named after your container, e.g. `apexiscool.env`. 64 | 65 | ## Additional Notes About the Settings File 66 | 67 | * Specify the Docker network to attach to using the parameter `DOCKER_NETWORK_NAME`. The run script will check if the network exists, and if not, create it. 68 | * The parameter `RTU_ENABLED` has been introduced. **It is experimental and may not work**. It allows users to create containers that can be used to create an image from using Docker [commit](https://docs.docker.com/engine/reference/commandline/commit/). Set the value to "Y" if this ability is required. 69 | * Use the `FILES_DIR` parameter to specify the local path to all the required installation files, e.g. `/path/to/my/downloads`. 70 | * Set the value of `ALLOW_DB_PATCHING` to `Y` to preserve files needed to successfully patch the database software with *OPatch*. 71 | * [As of December 5, 2019](https://blogs.oracle.com/database/machine-learning%2c-spatial-and-graph-no-license-required-v2), Oracle Machine Learning (previously known as Oracle Advanced Analytics) option is now included with all editions of Oracle Database 12c R2 and later, including 18c Express Edition (XE). Use the `OML4R_SUPPORT` parameter to install database support for running embedded R scripts. At the moment, this option is only valid for 18c or later. 72 | * SQL Developer Web is now availablel with ORDS version 19.4. This feature is enabled by default. To turn it off, set the environment variable `SQLDEVWEB` to `N`. The REST-enabled SQL feature can be managed by the variable `REST_ENABLED_SQL`, but note that this value is ignored if SQL Developer Web is activated. For builds with earlier ORDS versions, the added configuration properties are safely ignored. 73 | * `DATABASEAPI` parameter added to enable Database API support for ORDS 19.x and later. 74 | * The variable `INSTALL_FILE_JAVA` accepts the following values: 75 | * `java17` (default) 76 | * `openjdk11` 77 | * The filename of Java runtime tarball that you can download from [here](https://www.oracle.com/technetwork/java/javase/downloads/). 78 | * Using the sample settings, the following are accessible: 79 | | Port | Application | URL | 80 | |-|-|-| 81 | | 8080 | APEX | http://localhost:8080 | 82 | | 1521 | Database | N/A | 83 | -------------------------------------------------------------------------------- /files/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fuzziebrain/docker-apex-stack/ccfd46a3697b852455917b22777ef2179df7b207/files/.gitkeep -------------------------------------------------------------------------------- /oml-kit/installR.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Run as root 4 | 5 | CRAN_MIRROR_URL=${CRAN_MIRROR_URL:-https://cran.r-project.org} 6 | R_HOME=/usr/lib64/R 7 | 8 | yum-config-manager --enable ol7_optional_latest ol7_addons 9 | 10 | yum install -y \ 11 | make \ 12 | automake \ 13 | gcc \ 14 | gcc-c++ \ 15 | pango-devel \ 16 | libXt-devel \ 17 | libpng12 \ 18 | unzip \ 19 | R-3.3.0-2.el7 20 | 21 | rm -rf /var/cache/yum 22 | 23 | mkdir /usr/share/doc/R-$(rpm -q R.x86_64 --queryformat '%{VERSION}')/html 24 | 25 | cat << EOF > $R_HOME/etc/Rprofile.site 26 | local({ 27 | r <- getOption("repos") 28 | r["CRAN"] <- "${CRAN_MIRROR_URL}" 29 | options(repos = r) 30 | }) 31 | EOF 32 | 33 | rm -rf /tmp/hsperfdata_root -------------------------------------------------------------------------------- /quickstart.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | 4 | ##### Functions ##### 5 | function generate_password() { 6 | # SC => special characters allowed 7 | SC="_" 8 | while 9 | _password=$(openssl rand -base64 $(($RANDOM % 6 + 15)) | tr '[:punct:]' $SC) 10 | [[ 11 | $(echo $_password | grep -o '['$SC']' | wc -l) -lt 2 12 | || $(echo $_password | grep -o '[0-9]' | wc -l) -lt 2 13 | || $(echo $_password | grep -o '[A-Z]' | wc -l) -lt 2 14 | || $(echo $_password | grep -o '[a-z]' | wc -l) -lt 2 15 | ]] 16 | do true; done 17 | 18 | echo $_password 19 | } 20 | 21 | ##### Prompt for required variables ##### 22 | while 23 | echo -n "Enter an email address for your APEX administrator (required): " 24 | read APEX_ADMIN_EMAIL 25 | [[ -z $APEX_ADMIN_EMAIL ]] 26 | do true; done 27 | 28 | echo -n "Container name (leave empty to have one generated for you): " 29 | read CONTAINER_NAME 30 | 31 | ##### Create environment variables file. ##### 32 | ORACLE_PWD=$(generate_password) 33 | [[ -z $CONTAINER_NAME ]] && CONTAINER_NAME=das-qs-$(date +%s) 34 | ENV_FILE_NAME=$CONTAINER_NAME.env 35 | 36 | ##### Print out Oracle password ##### 37 | echo "##### Important Information #####" 38 | echo "Your Docker container name is: $CONTAINER_NAME" 39 | echo "Your password for the database and APEX internal workspace is: $ORACLE_PWD" 40 | echo "" 41 | 42 | while 43 | echo "We are now ready to build the Docker image and deploy your container." 44 | echo -n "Type \"Y\" to continue or CTRL-C to exit: " 45 | read CONTINUE 46 | [[ ! $CONTINUE =~ (Y|y) ]] 47 | do true; done 48 | 49 | cat << EOF > $ENV_FILE_NAME 50 | ORACLE_SID=XE 51 | ORACLE_PDB=XEPDB1 52 | ORACLE_PWD=$ORACLE_PWD 53 | APEX_ADMIN_PWD=$ORACLE_PWD 54 | APEX_PUBLIC_USER_PWD=$ORACLE_PWD 55 | APEX_LISTENER_PWD=$ORACLE_PWD 56 | APEX_REST_PUBLIC_USER_PWD=$ORACLE_PWD 57 | ORDS_PUBLIC_USER_PWD=$ORACLE_PWD 58 | INSTALL_FILE_APEX=apex-latest.zip 59 | INSTALL_FILE_ORDS=ords-latest.zip 60 | INSTALL_FILE_JAVA=java17 61 | DOCKER_ORDS_PORT=8080 62 | DOCKER_EM_PORT=5500 63 | DOCKER_DB_PORT=1521 64 | DB_VERSION=21.3.0 65 | DB_EDITION=xe 66 | DOCKER_NETWORK_NAME=das_network 67 | ALLOW_DB_PATCHING=N 68 | OML4R_SUPPORT=N 69 | REST_ENABLED_SQL=Y 70 | RTU_ENABLED=N 71 | SQLDEVWEB=Y 72 | DATABASEAPI=Y 73 | XE_USE_LOCAL_COPY=N 74 | EOF 75 | 76 | ##### Download files ##### 77 | echo "##### Downloading latest binaries for APEX and ORDS #####" 78 | curl https://download.oracle.com/otn_software/apex/apex-latest.zip --output files/apex-latest.zip 79 | curl https://download.oracle.com/otn_software/java/ords/ords-latest.zip --output files/ords-latest.zip 80 | 81 | echo "##### Running the build #####" 82 | bash ./01-build.sh $ENV_FILE_NAME 2>&1 | tee 01-build.log 83 | 84 | echo "##### Deploying the container #####" 85 | bash ./02-run.sh ${CONTAINER_NAME} $ENV_FILE_NAME 2>&1 | tee 02-run.log 86 | -------------------------------------------------------------------------------- /scripts/setup/01-install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export APEX_HOME=$ORACLE_BASE/product/apex 4 | export ORDS_HOME=$ORACLE_BASE/product/ords 5 | export SCRIPT_DIR=$SCRIPTS_ROOT 6 | export FILES_DIR=/tmp/files 7 | export JAVA_HOME=$ORACLE_BASE/product/java/latest 8 | export PATH=$JAVA_HOME/bin:$PATH 9 | 10 | case "${INSTALL_FILE_JAVA}" in 11 | openjdk11) DOWNLOAD_URL=https://download.java.net/java/ga/jdk11/openjdk-11_linux-x64_bin.tar.gz;; 12 | *.tar.gz) ;; 13 | *) DOWNLOAD_URL=https://download.oracle.com/java/17/latest/jdk-17_linux-x64_bin.tar.gz;; 14 | esac 15 | 16 | if [ ! -z "${DOWNLOAD_URL}" ]; then 17 | export INSTALL_FILE_JAVA="${DOWNLOAD_URL##*/}" 18 | fi 19 | 20 | echo "##### Install dependencies if required #####" 21 | if [ ! -d $JAVA_HOME ]; then 22 | if [ ! -f "$FILES_DIR/$INSTALL_FILE_JAVA" ]; then 23 | curl --output $FILES_DIR/$INSTALL_FILE_JAVA ${DOWNLOAD_URL} 24 | fi 25 | JAVA_DIR_NAME=`tar -tzf $FILES_DIR/$INSTALL_FILE_JAVA | head -1 | cut -f1 -d"/"` 26 | mkdir -p $ORACLE_BASE/product/java 27 | tar zxf $FILES_DIR/$INSTALL_FILE_JAVA --directory $ORACLE_BASE/product/java 28 | ln -s $ORACLE_BASE/product/java/$JAVA_DIR_NAME $JAVA_HOME 29 | 30 | echo -e 'export JAVA_HOME=$ORACLE_BASE/product/java/latest' >> $HOME/.bashrc 31 | echo -e 'export PATH=$JAVA_HOME/bin:$PATH' >> $HOME/.bashrc 32 | fi 33 | 34 | if [[ $OML4R_SUPPORT =~ (Y|y) ]]; then 35 | if [[ 36 | ($DB_VERSION = '19.3.0') 37 | || ($DB_VERSION = '18.4.0' && $DB_EDITION = 'xe') 38 | || ($DB_VERSION = '18.3.0') 39 | # || ($DB_VERSION = '12.2.0.1') 40 | ]]; then 41 | echo "##### Install ORE dependencies and configure ORE DB support #####" 42 | if [ $UID = "0" ]; then 43 | runuser oracle -m -s /bin/bash -c ". $SCRIPT_DIR/package/enableORE.sh" 44 | else 45 | . $SCRIPT_DIR/package/enableORE.sh 46 | fi 47 | fi 48 | fi 49 | 50 | # Extract files 51 | echo "##### Extracting files ####" 52 | mkdir -p $ORDS_HOME 53 | unzip -q $FILES_DIR/$INSTALL_FILE_APEX -d $ORACLE_BASE/product 54 | unzip -q $FILES_DIR/$INSTALL_FILE_ORDS -d $ORDS_HOME 55 | chown -R oracle:oinstall $APEX_HOME $ORDS_HOME 56 | 57 | # Set apex_rest_config prefix if required 58 | APEX_VERSION=$(echo $INSTALL_FILE_APEX | sed -r 's/^apex_(.+)\.zip$/\1/') 59 | case "$APEX_VERSION" in 60 | 4.*|5.*|18.1) 61 | # DO NOT add prefix for apex_rest_config 62 | ;; 63 | *) 64 | export PREFIX=@ 65 | ;; 66 | esac 67 | 68 | # Install APEX 69 | echo "##### Installing APEX #####" 70 | if [ $UID = "0" ]; then 71 | runuser oracle -m -s /bin/bash -c ". $SCRIPT_DIR/package/installApex.sh" 72 | else 73 | . $SCRIPT_DIR/package/installApex.sh 74 | fi 75 | 76 | # Install ORDS 77 | echo "##### Installing ORDS #####" 78 | if [ $UID = "0" ]; then 79 | runuser oracle -m -s /bin/bash -c ". $SCRIPT_DIR/package/installOrds.sh" 80 | else 81 | . $SCRIPT_DIR/package/installOrds.sh 82 | fi 83 | 84 | # Post-installation Tasks for APEX and ORDS 85 | if [ $UID = "0" ]; then 86 | runuser oracle -m -s /bin/bash -c ". $SCRIPT_DIR/package/postInstallApexOrds.sh" 87 | else 88 | . $SCRIPT_DIR/package/postInstallApexOrds.sh 89 | fi 90 | 91 | # Setup Oracle Wallet for APEX 92 | if [ $UID = "0" ]; then 93 | runuser oracle -m -s /bin/bash -c ". $SCRIPT_DIR/package/setupBaseWallet.sh" 94 | else 95 | . $SCRIPT_DIR/package/setupBaseWallet.sh 96 | fi -------------------------------------------------------------------------------- /scripts/setup/02-emaccess.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export SCRIPT_DIR=$SCRIPTS_ROOT 4 | 5 | if [ "$DB_VERSION" = "18.4.0" ] && [ "$DB_EDITION" = "xe" ]; then 6 | echo "##### Enable EM Access for ${DB_VERSION} ${DB_EDITION} #####" 7 | runuser oracle -m -s /bin/bash -c ". $SCRIPT_DIR/package/enableEmAccess.sh" 8 | fi 9 | -------------------------------------------------------------------------------- /scripts/setup/package/enableEmAccess.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Run as oracle user 4 | 5 | ORAENV_ASK=NO 6 | ORACLE_SID=${ORACLE_SID:-XE} 7 | 8 | . oraenv 9 | 10 | GLOBAL_ACCESS=${GLOBAL_ACCESS:-Y} 11 | 12 | if [ $GLOBAL_ACCESS = "Y" ]; then 13 | GLOBAL_ACCESS="true" 14 | else 15 | GLOBAL_ACCESS="false" 16 | fi; 17 | 18 | echo "##### Enabling XDB for external access #####" 19 | sqlplus / as sysdba << EOF 20 | exec dbms_xdb_config.setlistenerlocalaccess(false); 21 | exec dbms_xdb_config.setglobalportenabled($GLOBAL_ACCESS); 22 | EOF -------------------------------------------------------------------------------- /scripts/setup/package/enableORE.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Run as oracle 4 | 5 | ORAENV_ASK=NO 6 | ORACLE_SID=${ORACLE_SID:-XE} 7 | ORACLE_PDB=${ORACLE_PDB:-XEPDB1} 8 | R_HOME=/usr/lib64/R 9 | 10 | . oraenv 11 | 12 | chmod a+x ${ORACLE_HOME}/bin/ORE 13 | 14 | ${ORACLE_HOME}/bin/ORE -e "install.packages(c('png','DBI','ROracle','randomForest','statmod','Cairo'))" 15 | ${ORACLE_HOME}/bin/ORE -e "install.packages('https://cran.r-project.org/src/contrib/Archive/arules/arules_1.1-9.tar.gz',repos=NULL,type='source')" 16 | 17 | cd $ORACLE_HOME/R/server 18 | 19 | sqlplus -s / as sysdba << EOF 20 | alter session set container = $ORACLE_PDB; 21 | @rqcfg SYSAUX TEMP $ORACLE_HOME $R_HOME 22 | EOF -------------------------------------------------------------------------------- /scripts/setup/package/installApex.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Run as oracle user 4 | 5 | ORAENV_ASK=NO 6 | ORACLE_SID=${ORACLE_SID:-XE} 7 | 8 | . oraenv 9 | 10 | cd $APEX_HOME 11 | 12 | echo "Installing APEX" 13 | sqlplus / as sysdba << EOF 14 | alter session set container = ${ORACLE_PDB:-XEPDB1}; 15 | 16 | -- Install APEX 17 | @apexins.sql SYSAUX SYSAUX TEMP /i/ 18 | 19 | -- APEX REST configuration 20 | @apex_rest_config_core.sql $PREFIX "${APEX_LISTENER_PWD:-$ORACLE_PWD}" "${APEX_REST_PUBLIC_USER_PWD:-$ORACLE_PWD}" 21 | 22 | -- Required for ORDS install 23 | alter user apex_public_user identified by "${APEX_PUBLIC_USER_PWD:-$ORACLE_PWD}" account unlock; 24 | 25 | -- Network ACL 26 | prompt Setup Network ACL 27 | begin 28 | for c1 in ( 29 | select schema 30 | from sys.dba_registry 31 | where comp_id = 'APEX' 32 | ) loop 33 | sys.dbms_network_acl_admin.append_host_ace( 34 | host => '*' 35 | , ace => xs\$ace_type( 36 | privilege_list => xs\$name_list('connect') 37 | , principal_name => c1.schema 38 | , principal_type => xs_acl.ptype_db 39 | ) 40 | ); 41 | end loop; 42 | commit; 43 | end; 44 | / 45 | 46 | -- Setup APEX Admin account 47 | prompt Setup APEX Admin account 48 | begin 49 | apex_util.set_workspace(p_workspace => 'internal'); 50 | apex_util.create_user( 51 | p_user_name => 'ADMIN' 52 | , p_email_address => '${APEX_ADMIN_EMAIL}' 53 | , p_web_password => '${APEX_ADMIN_PWD}' 54 | , p_developer_privs => 'ADMIN:CREATE:DATA_LOADER:EDIT:HELP:MONITOR:SQL' 55 | , p_change_password_on_first_use => 'N' 56 | ); 57 | commit; 58 | end; 59 | / 60 | EOF 61 | -------------------------------------------------------------------------------- /scripts/setup/package/installOrds.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Run as oracle user 4 | 5 | ORAENV_ASK=NO 6 | ORACLE_SID=${ORACLE_SID:-XE} 7 | 8 | . oraenv 9 | 10 | ORDS_CONFIG_DIR=$ORACLE_BASE/oradata/ordsconfig/$ORACLE_PDB 11 | 12 | mkdir -p $ORDS_CONFIG_DIR 13 | 14 | cd $ORDS_HOME 15 | 16 | if [ -f "$ORDS_HOME/bin/ords" ]; then 17 | echo -e 'export PATH="$PATH:/opt/oracle/product/ords/bin"' >> $HOME/.bashrc 18 | . $HOME/.bashrc 19 | 20 | ords --config ${ORDS_CONFIG_DIR} install \ 21 | --admin-user SYS \ 22 | --proxy-user \ 23 | --db-hostname localhost \ 24 | --db-port 1521 \ 25 | --db-servicename ${ORACLE_PDB:-XEPDB1} \ 26 | --proxy-user-tablespace SYSAUX \ 27 | --proxy-user-temp-tablespace TEMP \ 28 | --schema-tablespace SYSAUX \ 29 | --schema-temp-tablespace TEMP \ 30 | --feature-rest-enabled-sql $([[ $SQLDEVWEB =~ (Y|y) || $REST_ENABLED_SQL =~ (Y|y) ]] && echo true || echo false) \ 31 | --feature-db-api $([[ $SQLDEVWEB =~ (Y|y) || $DATABASEAPI =~ (Y|y) ]] && echo true || echo false) \ 32 | --feature-sdw $([[ $SQLDEVWEB =~ (Y|y) ]] && echo true || echo false) \ 33 | --password-stdin << EOF 34 | ${ORACLE_PWD} 35 | ${ORDS_PUBLIC_USER_PWD:-$ORACLE_PWD} 36 | EOF 37 | else 38 | PARAM_FILE=$ORDS_HOME/params/custom_params.properties 39 | 40 | cat << EOF > $PARAM_FILE 41 | db.hostname=localhost 42 | db.password=${APEX_PUBLIC_USER_PWD:-$ORACLE_PWD} 43 | db.port=1521 44 | db.servicename=${ORACLE_PDB:-XEPDB1} 45 | db.username=APEX_PUBLIC_USER 46 | plsql.gateway.add=true 47 | rest.services.apex.add=true 48 | rest.services.ords.add=true 49 | schema.tablespace.default=SYSAUX 50 | schema.tablespace.temp=TEMP 51 | user.apex.listener.password=${APEX_LISTENER_PWD:-$ORACLE_PWD} 52 | user.apex.restpublic.password=${APEX_REST_PUBLIC_USER_PWD:-$ORACLE_PWD} 53 | user.public.password=${ORDS_PUBLIC_USER_PWD:-$ORACLE_PWD} 54 | user.tablespace.default=SYSAUX 55 | user.tablespace.temp=TEMP 56 | sys.user=sys 57 | sys.password=${ORACLE_PWD} 58 | standalone.mode=false 59 | EOF 60 | 61 | # If SQLDEVWEB = Y, then REST_ENABLED_SQL must be Y 62 | if [[ $SQLDEVWEB =~ (Y|y) || $REST_ENABLED_SQL =~ (Y|y) ]]; then 63 | echo "restEnabledSql.active=true" >> $PARAM_FILE 64 | fi 65 | 66 | if [[ $SQLDEVWEB =~ (Y|y) || $DATABASEAPI =~ (Y|y) ]]; then 67 | echo "database.api.enabled=true" >> $PARAM_FILE 68 | fi 69 | 70 | if [[ $SQLDEVWEB =~ (Y|y) ]]; then 71 | echo "feature.sdw=true" >> $PARAM_FILE 72 | fi 73 | 74 | java -jar ords.war configdir $ORDS_CONFIG_DIR 75 | 76 | java -jar ords.war install simple --parameterFile $ORDS_HOME/params/custom_params.properties 77 | fi -------------------------------------------------------------------------------- /scripts/setup/package/postInstallApexOrds.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Run as oracle user 4 | 5 | ORAENV_ASK=NO 6 | ORACLE_SID=${ORACLE_SID:-XE} 7 | 8 | . oraenv 9 | 10 | cd $APEX_HOME 11 | 12 | echo "Post-Installation Task for APEX and ORDS" 13 | sqlplus / as sysdba << EOF 14 | alter session set container = ${ORACLE_PDB:-XEPDB1}; 15 | 16 | -- Create profile APPLICATION_AGENT 17 | create profile application_agent limit 18 | cpu_per_session unlimited 19 | cpu_per_call unlimited 20 | connect_time unlimited 21 | idle_time unlimited 22 | sessions_per_user unlimited 23 | logical_reads_per_session unlimited 24 | logical_reads_per_call unlimited 25 | private_sga unlimited 26 | composite_limit unlimited 27 | password_life_time unlimited 28 | password_grace_time 7 29 | password_reuse_max unlimited 30 | password_reuse_time unlimited 31 | password_verify_function null 32 | failed_login_attempts 10 33 | password_lock_time 1 34 | ; 35 | -- Assign relevant users so that their passwords do not expire 36 | alter user apex_public_user profile application_agent; 37 | alter user apex_rest_public_user profile application_agent; 38 | alter user apex_listener profile application_agent; 39 | alter user ords_public_user profile application_agent; 40 | EOF 41 | -------------------------------------------------------------------------------- /scripts/setup/package/setupBaseWallet.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Run as oracle user 4 | 5 | ORAENV_ASK=NO 6 | ORACLE_SID=${ORACLE_SID:-XE} 7 | 8 | . oraenv 9 | 10 | export WALLET_BASE_PATH=$ORACLE_BASE/oradata/dbconfig/$ORACLE_SID/wallets 11 | export BUNDLE_FILE=/etc/pki/tls/cert.pem 12 | export WALLET_PATH=$WALLET_BASE_PATH/tls_wallet 13 | export WALLET_PWD=$ORACLE_PWD 14 | export WALLET_PWD_CONFIRM=$WALLET_PWD 15 | 16 | if [ ! -d $WALLET_BASE_PATH ]; then 17 | mkdir -p $WALLET_BASE_PATH 18 | fi 19 | 20 | sh -c "$(curl -fsSL https://gist.githubusercontent.com/fuzziebrain/202f902d8fc6d8de586da5097a501047/raw/78dba192f4c15f59d14ac17491734897fc440e40/createBaseWallet.sh)" 21 | 22 | echo "Setup APEX Wallet" 23 | sqlplus / as sysdba << EOF 24 | alter session set container = ${ORACLE_PDB:-XEPDB1}; 25 | 26 | begin 27 | apex_instance_admin.set_parameter( 28 | p_parameter => 'WALLET_PATH' 29 | , p_value => 'file:$WALLET_PATH' 30 | ); 31 | 32 | apex_instance_admin.set_parameter( 33 | p_parameter => 'WALLET_PWD' 34 | , p_value => '$WALLET_PWD' 35 | ); 36 | 37 | commit; 38 | end; 39 | / 40 | EOF 41 | -------------------------------------------------------------------------------- /scripts/startup/01-run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export APEX_HOME=$ORACLE_BASE/product/apex 4 | export ORDS_HOME=$ORACLE_BASE/product/ords 5 | export SCRIPT_DIR=$SCRIPTS_ROOT 6 | export FILES_DIR=/tmp/files 7 | 8 | case "${INSTALL_FILE_JAVA}" in 9 | openjdk11) DOWNLOAD_URL=https://download.java.net/java/ga/jdk11/openjdk-11_linux-x64_bin.tar.gz;; 10 | *.tar.gz) ;; 11 | *) DOWNLOAD_URL=https://download.oracle.com/java/17/latest/jdk-17_linux-x64_bin.tar.gz;; 12 | esac 13 | 14 | if [ ! -z "${DOWNLOAD_URL}" ]; then 15 | export INSTALL_FILE_JAVA="${DOWNLOAD_URL##*/}" 16 | fi 17 | 18 | echo "##### Install dependencies if required #####" 19 | if [ ! -d $JAVA_HOME ]; then 20 | if [ ! -f "$FILES_DIR/$INSTALL_FILE_JAVA" ]; then 21 | curl --output $FILES_DIR/$INSTALL_FILE_JAVA ${DOWNLOAD_URL} 22 | fi 23 | JAVA_DIR_NAME=`tar -tzf $FILES_DIR/$INSTALL_FILE_JAVA | head -1 | cut -f1 -d"/"` 24 | mkdir -p $ORACLE_BASE/product/java 25 | tar zxf $FILES_DIR/$INSTALL_FILE_JAVA --directory $ORACLE_BASE/product/java 26 | ln -s $ORACLE_BASE/product/java/$JAVA_DIR_NAME $JAVA_HOME 27 | 28 | echo -e 'export JAVA_HOME=$ORACLE_BASE/product/java/latest' >> $HOME/.bashrc 29 | echo -e 'export PATH=$JAVA_HOME/bin:$PATH' >> $HOME/.bashrc 30 | fi 31 | 32 | if [[ $OML4R_SUPPORT =~ (Y|y) ]]; then 33 | if [[ 34 | ($DB_VERSION = '19.3.0') 35 | || ($DB_VERSION = '18.4.0' && $DB_EDITION = 'xe') 36 | || ($DB_VERSION = '18.3.0') 37 | # || ($DB_VERSION = '12.2.0.1') 38 | ]]; then 39 | echo "##### Install ORE dependencies if necessary #####" 40 | if [ $UID = "0" ]; then 41 | runuser oracle -m -s /bin/bash -c ". $SCRIPT_DIR/package/installOreDeps.sh" 42 | else 43 | . $SCRIPT_DIR/package/installOreDeps.sh 44 | fi 45 | fi 46 | fi 47 | 48 | # Extract files 49 | echo "##### Extracting files if required ####" 50 | 51 | if [ ! -d $APEX_HOME ]; then 52 | echo "##### Unpacking APEX files #####" 53 | unzip -q $FILES_DIR/$INSTALL_FILE_APEX -d $ORACLE_BASE/product 54 | chown -R oracle:oinstall $APEX_HOME 55 | fi 56 | 57 | if [ ! -d $ORDS_HOME ]; then 58 | echo "##### Unpacking ORDS files #####" 59 | mkdir -p $ORDS_HOME 60 | unzip -q $FILES_DIR/$INSTALL_FILE_ORDS -d $ORDS_HOME 61 | chown -R oracle:oinstall $ORDS_HOME 62 | fi 63 | 64 | # Run ORDS 65 | echo "##### Starting ORDS #####" 66 | if [ $UID = "0" ]; then 67 | runuser oracle -m -s /bin/bash -c ". $SCRIPT_DIR/package/runOrds.sh" 68 | else 69 | . $SCRIPT_DIR/package/runOrds.sh 70 | fi -------------------------------------------------------------------------------- /scripts/startup/package/installOreDeps.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Run as oracle 4 | 5 | ORAENV_ASK=NO 6 | ORACLE_SID=${ORACLE_SID:-XE} 7 | 8 | . oraenv 9 | 10 | ${ORACLE_HOME}/bin/ORE -e "source('$SCRIPT_DIR/package/installRequiredPackages.R')" 11 | -------------------------------------------------------------------------------- /scripts/startup/package/installRequiredPackages.R: -------------------------------------------------------------------------------- 1 | for(p in list('png','DBI','ROracle','randomForest','statmod','Cairo','arules')) { 2 | if(!require(p, character.only=TRUE, quietly=TRUE)) { 3 | if(p == 'arules') { 4 | install.packages('https://cran.r-project.org/src/contrib/Archive/arules/arules_1.1-9.tar.gz', repos=NULL, type='source'); 5 | } else { 6 | install.packages(p); 7 | } 8 | } 9 | } -------------------------------------------------------------------------------- /scripts/startup/package/runOrds.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Run as oracle user 4 | 5 | ORAENV_ASK=NO 6 | ORACLE_SID=${ORACLE_SID:-XE} 7 | 8 | . oraenv 9 | 10 | ORDS_CONFIG_DIR=$ORACLE_BASE/oradata/ordsconfig/$ORACLE_PDB 11 | APEX_IMAGE_PATH=$APEX_HOME/images 12 | 13 | if [ -f "$ORDS_HOME/bin/ords" ]; then 14 | if [ -z $(command -v ords) ]; then 15 | echo -e 'export PATH="$PATH:/opt/oracle/product/ords/bin"' >> $HOME/.bashrc 16 | . $HOME/.bashrc 17 | fi 18 | 19 | ords --config ${ORDS_CONFIG_DIR} serve \ 20 | --port 8080 \ 21 | --apex-images ${APEX_IMAGE_PATH} 22 | else 23 | cd $ORDS_HOME 24 | 25 | java -jar ords.war configdir $ORDS_CONFIG_DIR 26 | 27 | java -jar ords.war standalone \ 28 | --port 8080 \ 29 | --apex-images ${APEX_IMAGE_PATH} 30 | fi -------------------------------------------------------------------------------- /settings.env.sample: -------------------------------------------------------------------------------- 1 | # Description 2 | # =========== 3 | # * Oracle Database 21c Express Edition 4 | # * Database features: 5 | # * Patching allowed? No 6 | # * OML4R supported? No 7 | # * ORDS features: 8 | # * REST-enabled? Yes 9 | # * SQL Developer Web? Yes 10 | # * Database API? Yes 11 | # * Java installed using OpenJDK version 11 binaries available through the Oracle Yum repositories. 12 | 13 | ORACLE_SID=XE 14 | ORACLE_PDB=XEPDB1 15 | ORACLE_PWD=Oracle21 16 | APEX_ADMIN_EMAIL=myemail@domain.com 17 | APEX_ADMIN_PWD=Oracle__21 18 | APEX_PUBLIC_USER_PWD=Oracle21_1 19 | APEX_LISTENER_PWD=Oracle21_2 20 | APEX_REST_PUBLIC_USER_PWD=Oracle21_3 21 | ORDS_PUBLIC_USER_PWD=Oracle21_4 22 | INSTALL_FILE_APEX=apex_21.2.zip 23 | INSTALL_FILE_ORDS=ords-21.4.2.062.1806.zip 24 | INSTALL_FILE_JAVA=openjdk11 25 | DOCKER_ORDS_PORT=8080 26 | DOCKER_EM_PORT=5500 27 | DOCKER_DB_PORT=1521 28 | DB_VERSION=21.3.0 29 | DB_EDITION=xe 30 | DOCKER_NETWORK_NAME=das_network 31 | ALLOW_DB_PATCHING=N 32 | OML4R_SUPPORT=N 33 | REST_ENABLED_SQL=Y 34 | RTU_ENABLED=N 35 | SQLDEVWEB=Y 36 | DATABASEAPI=Y 37 | XE_USE_LOCAL_COPY=N -------------------------------------------------------------------------------- /settings_db19c.env.sample: -------------------------------------------------------------------------------- 1 | # Description 2 | # =========== 3 | # * Oracle Database 19c Enterprise Edition 4 | # * Database features: 5 | # * Patching allowed? Yes 6 | # * OML4R supported? Yes 7 | # * ORDS features: 8 | # * REST-enabled? Yes 9 | # * SQL Developer Web? No 10 | # * Database API? No 11 | # * Java 8 server runtime engine downloaded from Oracle 12 | 13 | ORACLE_SID=ORCL 14 | ORACLE_PDB=PDB01 15 | ORACLE_PWD=Oracle19 16 | APEX_ADMIN_EMAIL=myemail@domain.com 17 | APEX_ADMIN_PWD=Oracle__19 18 | APEX_PUBLIC_USER_PWD=Oracle19_1 19 | APEX_LISTENER_PWD=Oracle19_2 20 | APEX_REST_PUBLIC_USER_PWD=Oracle19_3 21 | ORDS_PUBLIC_USER_PWD=Oracle19_4 22 | INSTALL_FILE_APEX=apex_21.2.zip 23 | INSTALL_FILE_ORDS=ords-21.4.2.062.1806.zip 24 | INSTALL_FILE_JAVA=server-jre-8u301-linux-x64.tar.gz 25 | DOCKER_ORDS_PORT=8080 26 | DOCKER_EM_PORT=5500 27 | DOCKER_DB_PORT=1521 28 | DB_VERSION=19.3.0 29 | DB_EDITION=ee 30 | DOCKER_NETWORK_NAME=das_network 31 | ALLOW_DB_PATCHING=Y 32 | OML4R_SUPPORT=Y 33 | REST_ENABLED_SQL=Y 34 | RTU_ENABLED=N 35 | SQLDEVWEB=N 36 | DATABASEAPI=N 37 | FILES_DIR=/software/oracle -------------------------------------------------------------------------------- /settings_db21c.env.sample: -------------------------------------------------------------------------------- 1 | # Description 2 | # =========== 3 | # * Oracle Database 21c Enterprise Edition 4 | # * Database features: 5 | # * Patching allowed? No 6 | # * OML4R supported? No 7 | # * ORDS features: 8 | # * REST-enabled? Yes 9 | # * SQL Developer Web? Yes 10 | # * Database API? Yes 11 | # * Java 8 server runtime engine downloaded from Oracle 12 | 13 | ORACLE_SID=ORCL 14 | ORACLE_PDB=PDB01 15 | ORACLE_PWD=Oracle21 16 | APEX_ADMIN_EMAIL=myemail@domain.com 17 | APEX_ADMIN_PWD=Oracle__21 18 | APEX_PUBLIC_USER_PWD=Oracle21_1 19 | APEX_LISTENER_PWD=Oracle21_2 20 | APEX_REST_PUBLIC_USER_PWD=Oracle21_3 21 | ORDS_PUBLIC_USER_PWD=Oracle21_4 22 | INSTALL_FILE_APEX=apex_21.2.zip 23 | INSTALL_FILE_ORDS=ords-21.4.2.062.1806.zip 24 | INSTALL_FILE_JAVA=server-jre-8u301-linux-x64.tar.gz 25 | DOCKER_ORDS_PORT=8080 26 | DOCKER_EM_PORT=5500 27 | DOCKER_DB_PORT=1521 28 | DB_VERSION=21.3.0 29 | DB_EDITION=ee 30 | DOCKER_NETWORK_NAME=das_network 31 | ALLOW_DB_PATCHING=N 32 | OML4R_SUPPORT=N 33 | REST_ENABLED_SQL=Y 34 | RTU_ENABLED=N 35 | SQLDEVWEB=Y 36 | DATABASEAPI=Y 37 | FILES_DIR=/software/oracle --------------------------------------------------------------------------------