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

Latest docker rac fixes #2686

Closed
wants to merge 10 commits into from
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ ENV SETUP_LINUX_FILE="setupLinuxEnv.sh" \
INSTALL_DB_BINARIES_FILE="installDBBinaries.sh" \
container="true"
# Use second ENV so that variable get substituted
# hadolint ignore=DL3044
ENV INSTALL_SCRIPTS=$INSTALL_DIR/install \
PATH=/bin:/usr/bin:/sbin:/usr/sbin:$PATH \
SCRIPT_DIR=$INSTALL_DIR/startup \
Expand All @@ -62,6 +63,7 @@ RUN chmod 755 $INSTALL_DIR/install/*.sh && \
$INSTALL_DIR/install/$SETUP_LINUX_FILE && \
$INSTALL_DIR/install/$DB_SETUP_FILE && \
sed -e '/hard *memlock/s/^/#/g' -i /etc/security/limits.d/oracle-database-preinstall-21c.conf && \
sed -e '/ *nofile /s/^/#/g' -i /etc/security/limits.d/oracle-database-preinstall-21c.conf && \
su oracle -c "$INSTALL_DIR/install/$INSTALL_DB_BINARIES_FILE EE" && \
$INVENTORY/orainstRoot.sh && \
$DB_HOME/root.sh && \
Expand All @@ -78,4 +80,5 @@ WORKDIR /home/oracle
EXPOSE 1521 5500

# Define default command to start Oracle Database.
# hadolint ignore=DL3025
CMD exec $SCRIPT_DIR/$RUN_FILE
14 changes: 7 additions & 7 deletions OracleDatabase/RAC/OracleDNSServer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,30 @@ The `buildContainerImage.sh` script can assist with building the images. See bel

The `buildContainerImage.sh` script is a utility shell script that performs MD5 checks and is an easy way to get started. Users can also use the docker build command to build an image with custom configuration parameters. To run the script, go into the `dockerfiles` folder and run the `buildContainerImage.sh` script:

```
```bash
./buildContainerImage.sh-v <Software Version>
./buildContainerImage.sh -v latest
```
NOTE: To build the DNS server image, pass the version latest to `buildContainerImage.sh`. The RAC DNS server image is not tied to any release of the RAC release, you can use `latest` version to build the image.

For detailed usage instructions, please execute the following command:

```
```bash
./buildContainerImage.sh -h
```

## Create bridge
Before you create the DNS server container, ensure you have created the required network bridges so you can attach the DNS server to the correct bridge.

```
```bash
docker network create --driver=bridge --subnet=172.16.1.0/24 rac_pub1_nw
```
**Note:** You can change the subnet according to your environment.

### Running RAC DNS server container
Execute following command to create the container:

```
```bash
docker run -d --name racdns \
--hostname rac-dns \
--dns-search="example.com" \
Expand All @@ -54,14 +54,14 @@ In the above example, we used **172.16.1.0/24** subnet for the DNS server. You c

To check the DNS server container/services creation logs, please tail the Docker logs. It may take up to 2 minutes for the racdns container to start completely.

```
```bash
docker logs -f racdns
```

you should see the following in docker logs output:

```
```bash
#################################################
runOracle.sh: RACDNSServer is up and running!
DNS Server IS READY TO USE!
#################################################
```
19 changes: 10 additions & 9 deletions OracleDatabase/RAC/OracleRealApplicationClusters/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ Complete each of the following prerequisites:

8. To resolve VIPs and SCAN IPs, we are using a DNS container in this guide. Before proceeding to the next step, create a [DNS server container](../OracleDNSServer/README.md).
- If you have a pre-configured DNS server in your environment, then you can replace `-e DNS_SERVERS=172.16.1.25`, `--dns=172.16.1.25`, `-e DOMAIN=example.com` and `--dns-search=example.com` parameters in **Section 2: Building Oracle RAC Database Podman Install Images** with the `DOMAIN_NAME` and `DNS_SERVER` based on your environment.
- You must ensure that you have the`Podman-docker` package installed on your OL8 Podman host to run the command using the `docker` utility.
- You must ensure that you have the`podman-docker` package installed on your OL8 Podman host to run the command using the `docker` utility.

9. If you are running RAC on Podman, you need to make sure you have installed the `podman-docker` rpm so that podman commands can be run using `docker` utility.
10. The Oracle RAC `Dockerfile` does not contain any Oracle software binaries. Download the following software from the [Oracle Technology Network](https://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html) and stage them under `<GITHUB_REPO_CLONED_PATH>/docker-images/OracleDatabase/RAC/OracleRealApplicationCluster/dockerfiles/<VERSION>` folder.
Expand Down Expand Up @@ -136,18 +136,19 @@ To assist in building the images, you can use the [`buildContainerImage.sh`](htt
If you are planing to deploy Oracle RAC container image on Podman, skip to the section [Oracle RAC Container Image for Podman](#oracle-rac-container-image-for-podman).

```bash
./buildContainerImage.sh -v <Software Version>
# for example ./buildContainerImage.sh -v 21.3.0
./buildContainerImage.sh -v <Software Version> -o '--build-arg BASE_OL_IMAGE=oraclelinux:7 --build-arg SLIMMING=true|false'

# for example ./buildContainerImage.sh -v 21.3.0 -o '--build-arg BASE_OL_IMAGE=oraclelinux:7 --build-arg SLIMMING=false'
```

### Oracle RAC Container Image for Podman

If you are planing to deploy Oracle RAC container image on Docker, skip to the section [Oracle RAC Container Image for Docker](#oracle-rac-container-image-for-docker).

```bash
./buildContainerImage.sh -v <Software Version> -o '--build-arg BASE_OL_IMAGE=oraclelinux:8 SLIMMING=true|false' -i
./buildContainerImage.sh -v <Software Version> -o '--build-arg BASE_OL_IMAGE=oraclelinux:8 --build-arg SLIMMING=true|false'

# for example ./buildContainerImage.sh -v 21.3.0 -o '--build-arg BASE_OL_IMAGE=oraclelinux:8 SLIMMING=false'
# for example ./buildContainerImage.sh -v 21.3.0 -o '--build-arg BASE_OL_IMAGE=oraclelinux:8 --build-arg SLIMMING=false'
```

- After the `21.3.0` Oracle RAC container image is built, start building a patched image with the download 21.7 RU and one-offs. To build the patch image, refer [Example of how to create a patched database image](https://github.com/oracle/docker-images/tree/main/OracleDatabase/RAC/OracleRealApplicationClusters/samples/applypatch).
Expand Down Expand Up @@ -180,9 +181,9 @@ If you are planing to deploy Oracle RAC container image on Docker, skip to the s

```bash
# mkdir /opt/.secrets/
# openssl rand -out /opt/.secrets/pwd.key -hex 64
```

- If your environment uses Docker, run `openssl rand -hex 64 -out /opt/.secrets/pwd.key`. For Podman, run `openssl rand -hex -out /opt/.secrets/pwd.key`
- Edit the `/opt/.secrets/common_os_pwdfile` and seed the password for the grid, oracle and database users. For this deployment scenario, it will be a common password for the grid, oracle, and database users. Run the command:

```bash
Expand Down Expand Up @@ -591,7 +592,7 @@ You must install and configure [Podman release 4.0.2](https://docs.oracle.com/en

**Notes**:

- You need to remove `"--cpu-rt-runtime=95000 \"` from container creation commands mentioned below in this document in following sections to create the containers if you are running Oracle 8 with URKR7:
- You need to remove `"--cpu-rt-runtime=95000 \"` from container creation commands mentioned below in this document in following sections to create the containers if you are running Oracle 8 with UEKR7:
- [Section 5.2: Setup RAC Containers on Podman](#section-52-setup-rac-containers-on-podman).
- [Section 5.3: Adding a Oracle RAC Node using a container on Podman](#section-53-adding-a-oracle-rac-node-using-a-container-on-podman).

Expand Down Expand Up @@ -779,7 +780,7 @@ Now create the Oracle RAC container using the image. You can use the following
You need to assign the Podman networks created in section 1 to containers. Execute the following commands:

```bash
# podman network disconnect bridge racnode1
# podman network disconnect podman racnode1
# podman network connect rac_pub1_nw --ip 172.16.1.150 racnode1
# podman network connect rac_priv1_nw --ip 192.168.17.150 racnode1
```
Expand Down Expand Up @@ -961,7 +962,7 @@ For example:
Connect the private and public networks you created earlier to the container:

```bash
# podman network disconnect bridge racnode2
# podman network disconnect podman racnode2
# podman network connect rac_pub1_nw --ip 172.16.1.151 racnode2
# podman network connect rac_priv1_nw --ip 192.168.17.151 racnode2
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ ARG WORKDIR="/rac-work-dir"
# Environment variables required for this build (do NOT change)
# -------------------------------------------------------------
# Linux Env Variable
# hadolint ignore=DL3044
ENV SETUP_LINUX_FILE="setupLinuxEnv.sh" \
INSTALL_DIR=/opt/scripts \
# Grid Env variables
Expand Down Expand Up @@ -160,7 +161,7 @@ RUN chmod 755 "$INSTALL_SCRIPTS"/*.sh && \
# -------------------------------------------
#############################################
# hadolint ignore=DL3006
FROM rac-image-slim-${SLIMMING} AS builder
FROM rac-image-slim-false AS builder
ARG SLIMMING

COPY $GRID_SW_INSTALL_RSP $INSTALL_GRID_PATCH $GRID_HOME_CLEANUP $ORACLE_HOME_CLEANUP $DB_INSTALL_RSP $INSTALL_DB_BINARIES_FILE $ENABLE_RAC_FILE $INSTALL_GRID_BINARIES_FILE $INSTALL_FILE_1* $INSTALL_FILE_2* $INSTALL_SCRIPTS/
Expand All @@ -186,14 +187,40 @@ RUN if [ "${SLIMMING}"x != "truex" ]; then \

RUN rm -f "${INSTALL_DIR}"/install/* && \
sync

#############################################
FROM rac-image-slim-true AS builder-slim
ARG SLIMMING

COPY $FIXUP_PREQ_FILE $GRID_SW_INSTALL_RSP $INSTALL_GRID_PATCH $GRID_HOME_CLEANUP $ORACLE_HOME_CLEANUP $DB_INSTALL_RSP $INSTALL_DB_BINARIES_FILE $ENABLE_RAC_FILE $INSTALL_GRID_BINARIES_FILE $INSTALL_FILE_1* $INSTALL_FILE_2* $INSTALL_SCRIPTS/

RUN chmod 755 "${INSTALL_SCRIPTS}"/*.sh

## Install software if SLIMMING is false
# hadolint ignore=SC2086
RUN if [ "${SLIMMING}x" != 'truex' ]; then \
sed -e '/hard *memlock/s/^/#/g' -i /etc/security/limits.d/oracle-database-preinstall-19c.conf && \
sed -e '/ *nofile /s/^/#/g' -i /etc/security/limits.d/oracle-database-preinstall-19c.conf && \
su $GRID_USER -c "$INSTALL_DIR/install/$INSTALL_GRID_BINARIES_FILE EE $PATCH_NUMBER" && \
$INVENTORY/orainstRoot.sh && \
$GRID_HOME/root.sh && \
su $DB_USER -c "$INSTALL_DIR/install/$INSTALL_DB_BINARIES_FILE EE" && \
su $DB_USER -c "$INSTALL_DIR/install/$ENABLE_RAC_FILE" && \
$INVENTORY/orainstRoot.sh && \
$DB_HOME/root.sh && \
su $GRID_USER -c "$INSTALL_SCRIPTS/$GRID_HOME_CLEANUP" && \
su $DB_USER -c "$INSTALL_SCRIPTS/$ORACLE_HOME_CLEANUP" && \
:; \
fi

RUN rm -f "$INSTALL_DIR"/install/* && \
sync
#############################################
# -------------------------------------------
# Start new image for grid & database runtime
# -------------------------------------------
#############################################
# hadolint ignore=DL3006
FROM rac-image-slim-${SLIMMING} AS final
FROM rac-image-slim-false AS final

# Setup Scripts
COPY $FIXUP_PREQ_FILE $INSTALL_SCRIPTS/
Expand Down Expand Up @@ -231,3 +258,42 @@ WORKDIR $WORKDIR
# Define default command to start Oracle Grid and RAC Database setup.
# hadolint ignore=DL3006,DL3025
ENTRYPOINT "/usr/bin/$INITSH"
##########################################
FROM rac-image-slim-true AS final-slim

# Setup Scripts
COPY $FIXUP_PREQ_FILE $INSTALL_SCRIPTS/

COPY $RUN_FILE $INITSH $ADDNODE $ADDNODE_RSP $SETUPSSH $FUNCTIONS $CONFIGGRID $GRID_INSTALL_RSP $DBCA_RSP $PWD_FILE $CHECK_DB_FILE $USER_SCRIPTS_FILE $STOP_FILE $CHECK_DB_FILE $REMOTE_LISTENER_FILE $SETUPGRIDENV $DELNODE $RESET_FAILED_UNITS $RESET_OS_PASSWORD $MULTI_NODE_INSTALL $SET_CRONTAB $SCRIPT_DIR/

COPY --from=builder /u01 /u01

# hadolint ignore=SC2086
RUN if [ "${SLIMMING}x" != 'truex' ]; then \
$INVENTORY/orainstRoot.sh && \
$GRID_HOME/root.sh && \
$DB_HOME/root.sh && \
:; \
fi && \
chmod 755 $INSTALL_DIR/install/$FIXUP_PREQ_FILE && \
$INSTALL_DIR/install/$FIXUP_PREQ_FILE && \
sync && \
chmod 755 $SCRIPT_DIR/*.sh && \
chmod 666 $SCRIPT_DIR/*.rsp && \
echo "nohup $SCRIPT_DIR/runOracle.sh &" >> /etc/rc.local && \
rm -f /etc/rc.d/init.d/oracle-database-preinstall-19c-firstboot && \
chmod +x /etc/rc.d/rc.local && \
cp $SCRIPT_DIR/$INITSH /usr/bin/$INITSH && \
chmod 755 /usr/bin/$INITSH && \
rm -f /etc/sysctl.d/99-oracle-database-preinstall-19c-sysctl.conf && \
rm -f /etc/sysctl.d/99-sysctl.conf && \
rm -f $INSTALL_DIR/install/* && \
sync

USER ${USER}
VOLUME ["/common_scripts"]
WORKDIR $WORKDIR

# Define default command to start Oracle Grid and RAC Database setup.
# hadolint ignore=DL3025
ENTRYPOINT /usr/bin/$INITSH
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#

EDITION=$1
# shellcheck disable=SC2034
PATCH_NUMBER=$2

# Check whether edition has been passed on
Expand Down Expand Up @@ -41,11 +42,12 @@ if [ "$GRID_HOME" == "" ]; then
exit 1;
fi;


# shellcheck disable=SC2006
temp_var1=`hostname`

# Replace place holders
# ---------------------
# shellcheck disable=SC2086,SC1101
sed -i -e "s|###HOSTNAME###|$temp_var1|g" $INSTALL_SCRIPTS/$GRID_SW_INSTALL_RSP && \
sed -i -e "s|###INSTALL_TYPE###|CRS_SWONLY|g" $INSTALL_SCRIPTS/$GRID_SW_INSTALL_RSP && \
sed -i -e "s|###GRID_BASE###|$GRID_BASE|g" $INSTALL_SCRIPTS/$GRID_SW_INSTALL_RSP && \
Expand All @@ -54,5 +56,6 @@ sed -i -e "s|###INVENTORY###|$INVENTORY|g" $INSTALL_SCRIPTS/$GRID_SW_INSTALL_RSP
# Install Oracle binaries
mkdir -p /home/grid/.ssh && \
chmod 700 /home/grid/.ssh && \
# shellcheck disable=SC2086,SC1101
unzip -q $INSTALL_SCRIPTS/$INSTALL_FILE_1 -d $GRID_HOME && \
$GRID_HOME/gridSetup.sh -silent -responseFile $INSTALL_SCRIPTS/$GRID_SW_INSTALL_RSP -ignorePrereqFailure || true
$GRID_HOME/gridSetup.sh -silent -responseFile $INSTALL_SCRIPTS/$GRID_SW_INSTALL_RSP -ignorePrereqFailure || true
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ ARG WORKDIR="/rac-work-dir"
# Environment variables required for this build (do NOT change)
# -------------------------------------------------------------
# Linux Env Variable
# hadolint ignore=DL3044
ENV SETUP_LINUX_FILE="setupLinuxEnv.sh" \
INSTALL_DIR=/opt/scripts \
# Grid Env variables
Expand Down Expand Up @@ -105,6 +106,7 @@ ENV SETUP_LINUX_FILE="setupLinuxEnv.sh" \
BIN="/usr/sbin" \
container="true"
# Use second ENV so that variable get substituted
# hadolint ignore=DL3044
ENV INSTALL_SCRIPTS=$INSTALL_DIR/install \
PATH=/bin:/usr/bin:/sbin:/usr/sbin \
SCRIPT_DIR=$INSTALL_DIR/startup \
Expand Down Expand Up @@ -160,7 +162,7 @@ RUN chmod 755 "$INSTALL_SCRIPTS"/*.sh && \
# -------------------------------------------
#############################################
# hadolint ignore=DL3006,DL3025
FROM rac-image-slim-${SLIMMING} AS builder
FROM rac-image-slim-false AS builder
ARG SLIMMING

COPY $FIXUP_PREQ_FILE $GRID_SW_INSTALL_RSP $INSTALL_GRID_PATCH $GRID_HOME_CLEANUP $ORACLE_HOME_CLEANUP $DB_INSTALL_RSP $INSTALL_DB_BINARIES_FILE $ENABLE_RAC_FILE $INSTALL_GRID_BINARIES_FILE $INSTALL_FILE_1* $INSTALL_FILE_2* $INSTALL_SCRIPTS/
Expand All @@ -186,14 +188,40 @@ RUN if [ "${SLIMMING}x" != 'truex' ]; then \

RUN rm -f "$INSTALL_DIR"/install/* && \
sync

#############################################
FROM rac-image-slim-true AS builder-slim
ARG SLIMMING

COPY $FIXUP_PREQ_FILE $GRID_SW_INSTALL_RSP $INSTALL_GRID_PATCH $GRID_HOME_CLEANUP $ORACLE_HOME_CLEANUP $DB_INSTALL_RSP $INSTALL_DB_BINARIES_FILE $ENABLE_RAC_FILE $INSTALL_GRID_BINARIES_FILE $INSTALL_FILE_1* $INSTALL_FILE_2* $INSTALL_SCRIPTS/

RUN chmod 755 "${INSTALL_SCRIPTS}"/*.sh

## Install software if SLIMMING is false
# hadolint ignore=SC2086
RUN if [ "${SLIMMING}x" != 'truex' ]; then \
sed -e '/hard *memlock/s/^/#/g' -i /etc/security/limits.d/oracle-database-preinstall-21c.conf && \
sed -e '/ *nofile /s/^/#/g' -i /etc/security/limits.d/oracle-database-preinstall-21c.conf && \
su $GRID_USER -c "$INSTALL_DIR/install/$INSTALL_GRID_BINARIES_FILE EE $PATCH_NUMBER" && \
$INVENTORY/orainstRoot.sh && \
$GRID_HOME/root.sh && \
su $DB_USER -c "$INSTALL_DIR/install/$INSTALL_DB_BINARIES_FILE EE" && \
su $DB_USER -c "$INSTALL_DIR/install/$ENABLE_RAC_FILE" && \
$INVENTORY/orainstRoot.sh && \
$DB_HOME/root.sh && \
su $GRID_USER -c "$INSTALL_SCRIPTS/$GRID_HOME_CLEANUP" && \
su $DB_USER -c "$INSTALL_SCRIPTS/$ORACLE_HOME_CLEANUP" && \
:; \
fi

RUN rm -f "$INSTALL_DIR"/install/* && \
sync
#############################################
# -------------------------------------------
# Start new image for grid & database runtime
# -------------------------------------------
#############################################
# hadolint ignore=DL3006,DL3025
FROM rac-image-slim-${SLIMMING} AS final
FROM rac-image-slim-false AS final

# Setup Scripts
COPY $FIXUP_PREQ_FILE $INSTALL_SCRIPTS/
Expand Down Expand Up @@ -228,6 +256,45 @@ USER ${USER}
VOLUME ["/common_scripts"]
WORKDIR $WORKDIR

# Define default command to start Oracle Grid and RAC Database setup.
# hadolint ignore=DL3025
ENTRYPOINT /usr/bin/$INITSH
#############################################
FROM rac-image-slim-true AS final-slim

# Setup Scripts
COPY $FIXUP_PREQ_FILE $INSTALL_SCRIPTS/

COPY $RUN_FILE $INITSH $ADDNODE $ADDNODE_RSP $SETUPSSH $FUNCTIONS $CONFIGGRID $GRID_INSTALL_RSP $DBCA_RSP $PWD_FILE $CHECK_DB_FILE $USER_SCRIPTS_FILE $STOP_FILE $CHECK_DB_FILE $REMOTE_LISTENER_FILE $SETUPGRIDENV $DELNODE $RESET_FAILED_UNITS $RESET_OS_PASSWORD $MULTI_NODE_INSTALL $SET_CRONTAB $SCRIPT_DIR/

COPY --from=builder /u01 /u01

# hadolint ignore=SC2086
RUN if [ "${SLIMMING}x" != 'truex' ]; then \
$INVENTORY/orainstRoot.sh && \
$GRID_HOME/root.sh && \
$DB_HOME/root.sh && \
:; \
fi && \
chmod 755 $INSTALL_DIR/install/$FIXUP_PREQ_FILE && \
$INSTALL_DIR/install/$FIXUP_PREQ_FILE && \
sync && \
chmod 755 $SCRIPT_DIR/*.sh && \
chmod 666 $SCRIPT_DIR/*.rsp && \
echo "nohup $SCRIPT_DIR/runOracle.sh &" >> /etc/rc.local && \
rm -f /etc/rc.d/init.d/oracle-database-preinstall-21c-firstboot && \
chmod +x /etc/rc.d/rc.local && \
cp $SCRIPT_DIR/$INITSH /usr/bin/$INITSH && \
chmod 755 /usr/bin/$INITSH && \
rm -f /etc/sysctl.d/99-oracle-database-preinstall-21c-sysctl.conf && \
rm -f /etc/sysctl.d/99-sysctl.conf && \
rm -f $INSTALL_DIR/install/* && \
sync

USER ${USER}
VOLUME ["/common_scripts"]
WORKDIR $WORKDIR

# Define default command to start Oracle Grid and RAC Database setup.
# hadolint ignore=DL3025
ENTRYPOINT /usr/bin/$INITSH
Loading