Skip to content
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

fix ORDS versionb #119

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 44 additions & 17 deletions ords/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,34 +1,63 @@
#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 22.2
#
## Copyright (c) 2022 Oracle and/or its affiliates.
##
## The Universal Permissive License (UPL), Version 1.0
##
## Subject to the condition set forth below, permission is hereby granted to any
## person obtaining a copy of this software, associated documentation and/or data
## (collectively the "Software"), free of charge and under any and all copyright
## rights in the Software, and any and all patent rights owned or freely
## licensable by each licensor hereunder covering either (i) the unmodified
## Software as contributed to or provided by such licensor, or (ii) the Larger
## Works (as defined below), to deal in both
##
## (a) the Software, and
## (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if
## one is included with the Software (each a "Larger Work" to which the Software
## is contributed by such licensors),
##
## without restriction, including without limitation the rights to copy, create
## derivative works of, display, perform, and distribute the Software and make,
## use, sell, offer for sale, import, export, have made, and have sold the
## Software and the Larger Work(s), and to sublicense the foregoing rights on
## either these or other terms.
##
## This license is subject to the following condition:
## The above copyright notice and either this complete permission notice or at
## a minimum a reference to the UPL must be included in all copies or
## substantial portions of the Software.
##
## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
## IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
## AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
## LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
## OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
## SOFTWARE.

FROM container-registry.oracle.com/java/jdk:latest

# Environment variables required for this build (do NOT change)
# -------------------------------------------------------------
ENV ORDS_HOME=/opt/oracle/ords/ \
RUN_FILE="runOrdsSSL.sh"

#RUN_FILE_NOSSL="runOrdsNOSSL.sh"
RUN_FILE="runOrdsSSL.sh" \
ORDSVERSION=23.4.0-8

# Copy binaries
# -------------
COPY $RUN_FILE $ORDS_HOME
#COPY $RUN_FILE_NOSSL $ORDS_HOME

RUN yum -y install yum-utils bind-utils tree hostname openssl net-tools zip unzip tar wget vim-minimal which sudo expect procps && \
RUN yum -y install yum-utils bind-utils tree hostname openssl net-tools zip unzip tar wget vim-minimal which sudo expect procps curl lsof && \
yum-config-manager --add-repo=http://yum.oracle.com/repo/OracleLinux/OL8/oracle/software/x86_64 && \
yum -y install java-11-openjdk-devel && \
yum -y install ords && \
yum -y install iproute && \
yum clean all

RUN curl -o /tmp/ords-$ORDSVERSION.el8.noarch.rpm https://yum.oracle.com/repo/OracleLinux/OL8/oracle/software/x86_64/getPackage/ords-$ORDSVERSION.el8.noarch.rpm

RUN rpm -ivh /tmp/ords-$ORDSVERSION.el8.noarch.rpm

# Setup filesystem and oracle user
# ------------------------------------------------------------
# --------------------------------
RUN mkdir -p $ORDS_HOME/doc_root && \
mkdir -p $ORDS_HOME/error && \
mkdir -p $ORDS_HOME/secrets && \
Expand All @@ -49,5 +78,3 @@ EXPOSE 8888
# Define default command to start Ords Services
CMD $ORDS_HOME/$RUN_FILE

## ONLY FOR DEVELOPMENT STAGE
#CMD ["/usr/sbin/init"]
121 changes: 50 additions & 71 deletions ords/runOrdsSSL.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,44 @@
#!/bin/bash
#
# Since: June, 2022
# Author: [email protected]
# Description: Setup and runs Oracle Rest Data Services 22.2.
#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
#
# Copyright (c) 2014-2017 Oracle and/or its affiliates. All rights reserved.
#
# MODIFIED (DD-Mon-YY)
# mmalvezz 25-Jun-22 - Initial version
# mmalvezz 17-Oct-22 - db.customURL utilization

cat <<EOF
** Copyright (c) 2022 Oracle and/or its affiliates.
**
** The Universal Permissive License (UPL), Version 1.0
**
** Subject to the condition set forth below, permission is hereby granted to any
** person obtaining a copy of this software, associated documentation and/or data
** (collectively the "Software"), free of charge and under any and all copyright
** rights in the Software, and any and all patent rights owned or freely
** licensable by each licensor hereunder covering either (i) the unmodified
** Software as contributed to or provided by such licensor, or (ii) the Larger
** Works (as defined below), to deal in both
**
** (a) the Software, and
** (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if
** one is included with the Software (each a "Larger Work" to which the Software
** is contributed by such licensors),
**
** without restriction, including without limitation the rights to copy, create
** derivative works of, display, perform, and distribute the Software and make,
** use, sell, offer for sale, import, export, have made, and have sold the
** Software and the Larger Work(s), and to sublicense the foregoing rights on
** either these or other terms.
**
** This license is subject to the following condition:
** The above copyright notice and either this complete permission notice or at
** a minimum a reference to the UPL must be included in all copies or
** substantial portions of the Software.
**
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
** SOFTWARE.
EOF

echo "ORDSVERSIN:$ORDSVERSION"

export ORDS=/usr/local/bin/ords
export ETCFILE=/etc/ords.conf
Expand All @@ -21,8 +49,6 @@ export KEYSTORE=~/keystore
export OPENSSL=/usr/bin/openssl
export PASSFILE=${KEYSTORE}/PASSWORD
export HN=`hostname`
#export KEY=${KEYSTORE}/${HN}-key.der
#export CERTIFICATE=${KEYSTORE}/${HN}.der
export KEY=$ORDS_HOME/secrets/$TLSKEY
export CERTIFICATE=$ORDS_HOME/secrets/$TLSCRT
export TNS_ADMIN=/opt/oracle/ords/
Expand All @@ -31,8 +57,6 @@ export TNSALIAS=ordstns
echo "${TNSALIAS}=${DBTNSURL}" >$TNSNAME




function SetParameter() {
##ords config info <--- Use this command to get the list

Expand Down Expand Up @@ -67,65 +91,16 @@ function SetParameter() {
$ORDS --config ${CONFIG} config set misc.pagination.maxRows 1000
$ORDS --config ${CONFIG} config set db.cdb.adminUser "${CDBADMIN_USER:-C##DBAPI_CDB_ADMIN} AS SYSDBA"
$ORDS --config ${CONFIG} config secret --password-stdin db.cdb.adminUser.password << EOF
${CDBADMIN_PWD:-WElcome_12##}
${CDBADMIN_PWD:-PROVIDE_A_PASSWORD}
EOF

## $ORDS --config ${CONFIG} config set db.username "SYS AS SYSDBA"
## $ORDS --config ${CONFIG} config secret --password-stdin db.password <<EOF
## WElcome_12##
## EOF

$ORDS --config ${CONFIG} config user add --password-stdin ${WEBSERVER_USER:-ordspdbadmin} "SQL Administrator, System Administrator" <<EOF
$ORDS --config ${CONFIG} config user add --password-stdin ${WEBSERVER_USER:-ordspdbadmin} "SQL Administrator, System Administrator" <<EOF
${WEBSERVER_PASSWORD:-welcome1}
EOF

}


function setupHTTPS() {

rm -rf ${KEYSTORE}


[ ! -d ${KEYSTORE} ] && {
mkdir ${KEYSTORE}
}

cd $KEYSTORE

cat <<EOF >$PASSFILE
welcome1
EOF

## $JAVA_HOME/bin/keytool -genkey -keyalg RSA -alias selfsigned -keystore keystore.jks \
## -dname "CN=${HN}, OU=Example Department, O=Example Company, L=Birmingham, ST=West Midlands, C=GB" \
## -storepass welcome1 -validity 3600 -keysize 2048 -keypass welcome1
##
##
## $JAVA_HOME/bin/keytool -importkeystore -srckeystore keystore.jks -srcalias selfsigned -srcstorepass welcome1 \
## -destkeystore keystore.p12 -deststoretype PKCS12 -deststorepass welcome1 -destkeypass welcome1
##
##
## ${OPENSSL} pkcs12 -in ${KEYSTORE}/keystore.p12 -nodes -nocerts -out ${KEYSTORE}/${HN}-key.pem -passin file:${PASSFILE}
## ${OPENSSL} pkcs12 -in ${KEYSTORE}/keystore.p12 -nokeys -out ${KEYSTORE}/${HN}.pem -passin file:${PASSFILE}
## ${OPENSSL} pkcs8 -topk8 -inform PEM -outform DER -in ${HN}-key.pem -out ${HN}-key.der -nocrypt
## ${OPENSSL} x509 -inform PEM -outform DER -in ${HN}.pem -out ${HN}.der








rm $PASSFILE
ls -ltr $KEYSTORE



}


function setupOrds() {

echo "===================================================="
Expand Down Expand Up @@ -163,7 +138,6 @@ export ORDS_LOGS=/tmp
ORDS_PASSWORD=`cat $ORDS_HOME/secrets/$ORDS_PWD_KEY`
}

setupHTTPS;

SetParameter;
$ORDS --config ${CONFIG} install \
Expand All @@ -173,8 +147,8 @@ $ORDS --config ${CONFIG} install \
--log-folder ${ORDS_LOGS} \
--proxy-user \
--password-stdin <<EOF
${SYSDBA_PASSWORD:-WElcome_12##}
${ORDS_PASSWORD:-WElcome_12##}
${SYSDBA_PASSWORD:-PROVIDE_A_PASSWORD}
${ORDS_PASSWORD:-PROVIDE_A_PASSWORD}
EOF


Expand All @@ -187,9 +161,14 @@ fi

}

NOT_INSTALLED=`$ORDS --config $CONFIG config list | grep "INFO: The" |wc -l `
export CKF=/tmp/checkfile

$ORDS --config $CONFIG config list 1>${CKF} 2>&1
echo "checkfile" >> ${CKF}
NOT_INSTALLED=`cat ${CKF} | grep "INFO: The" |wc -l `
echo NOT_INSTALLED=$NOT_INSTALLED


function StartUp () {
$ORDS --config $CONFIG serve --port 8888 --secure
}
Expand Down