Skip to content

Commit 8bf9a88

Browse files
authored
Compose (#2751)
* compose file changes * reorganised compose README files * Lint fixes * lint fixes * Add Storage Server for Podman * NFS compose file changes * working patch image with podman NFS * minor fix * minor fixes * lint fixes * minor fixes
1 parent e8c057d commit 8bf9a88

File tree

25 files changed

+880
-111
lines changed

25 files changed

+880
-111
lines changed

OracleDatabase/RAC/OracleRACStorageServer/README.md

Lines changed: 122 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,44 @@
11
# Oracle ASM on NFS Server for RAC testing
2-
Sample Docker build files to facilitate installation, configuration, and environment setup for DevOps users.
2+
Sample Docker and Podman build files to facilitate installation, configuration, and environment setup for DevOps users.
33

44
**IMPORTANT:** This image can be used to setup ASM on NFS for RAC. You can skip if you have physical block devices or NAS server for Oracle RAC and Grid. You need to make sure that NFS server container must be up and running for RAC functioning. This image is for only testing purpose.
55

6-
## How to build and run
6+
Refer below instructions for setup of NFS Container for RAC -
7+
8+
- [Oracle ASM on NFS Server for RAC testing](#oracle-asm-on-nfs-server-for-rac-testing)
9+
- [How to build NFS Storage Container Image](#how-to-build-nfs-storage-container-image)
10+
- [How to build NFS Storage Container Image on Podman Host](#how-to-build-nfs-storage-container-image-on-podman-host)
11+
- [How to build NFS Storage Container Image on Docker Host](#how-to-build-nfs-storage-container-image-on-docker-host)
12+
- [Create Bridge Network](#create-bridge-network)
13+
- [NFS Server installation on Host](#nfs-server-installation-on-host)
14+
- [Running RACStorageServer container](#running-racstorageserver-container)
15+
- [RAC Storage Container for Podman Host Machine](#rac-storage-container-for-podman-host-machine)
16+
- [RAC Storage container for Docker Host Machine](#rac-storage-container-for-docker-host-machine)
17+
- [Create NFS Volume](#create-nfs-volume)
18+
- [Copyright](#copyright)
19+
20+
## How to build NFS Storage Container Image
21+
### How to build NFS Storage Container Image on Podman Host
22+
23+
You need to make sure that you have atleast 60GB space available for container to create the files for RAC storage.
24+
25+
**IMPORTANT:** If you are behind the proxy, you need to set `http_proxy` and `https_proxy` env variable based on your enviornment before building the image.
26+
27+
To assist in building the images, you can use the [buildDockerImage.sh](dockerfiles/buildDockerImage.sh) script. See below for instructions and usage.
28+
29+
The `buildDockerImage.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 prefered set of parameters. Go into the **dockerfiles** folder and run the **buildDockerImage.sh** script:
30+
31+
```bash
32+
./buildDockerImage.sh -v latest
33+
```
34+
You would see successful build message similar like below-
35+
```bash
36+
Oracle RAC Storage Server Podman Image version latest is ready to be extended:
37+
38+
--> oracle/rac-storage-server:latest
39+
```
40+
41+
### How to build NFS Storage Container Image on Docker Host
742
You need to make sure that you have atleast 60GB space available for container to create the files for RAC storage.
843

944
**IMPORTANT:** If you are behind the proxy, you need to set http_proxy env variable based on your enviornment before building the image.
@@ -13,37 +48,90 @@ To assist in building the images, you can use the [buildDockerImage.sh](dockerfi
1348
The `buildDockerImage.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 prefered set of parameters. Go into the **dockerfiles** folder and run the **buildDockerImage.sh** script:
1449

1550
```bash
16-
./buildDockerImage.sh -v (Software Version)
1751
./buildDockerImage.sh -v 19.3.0
1852
```
1953

20-
**NOTE**: To build RACStorage Image for 18.3.0, pass the version 18.3.0 to buildDockerImage.sh
21-
2254
For detailed usage of command, please execute folowing command:
2355
```bash
2456
./buildDockerImage.sh -h
2557
```
2658

27-
### Create Bridge
28-
Before creating container, create the bridge for NFS storage container.
59+
## Create Bridge Network
60+
Before creating container, create the bridge private network for NFS storage container.
2961

62+
On Docker host-
3063
```bash
3164
docker network create --driver=bridge --subnet=192.168.17.0/24 rac_priv1_nw
3265
```
3366

67+
On Podman host-
68+
```bash
69+
podman network create --driver=bridge --subnet=192.168.17.0/24 rac_priv1_nw
70+
```
71+
3472
**Note:** You can change subnet according to your environment.
3573

36-
### Disable SELINUX
37-
SELINUX must be disabled or in permissive mode.
3874

39-
### NFS Server installation on Docker Host
40-
You must install NFS server rpms on docker host to utilize NFS volumes in containers.
75+
## NFS Server installation on Host
76+
You must install NFS server rpms on host to utilize NFS volumes in containers.
4177

4278
```bash
4379
yum -y install nfs-utils
4480
```
81+
## Running RACStorageServer container
82+
83+
### Running RACStorageServer Podman container
84+
85+
#### Prerequisites for RAC Storage Container for Podman Host
86+
87+
Create placeholder for NFS storage and make sure it is empty -
88+
```bash
89+
export ORACLE_DBNAME=ORCLCDB
90+
mkdir -p /scratch/stage/rac-storage/$ORACLE_DBNAME
91+
rm -rf /scratch/stage/rac-storage/ORCLCDB/asm_disk0*
92+
```
93+
94+
#### RAC Storage Container for Podman Host Machine
95+
96+
If you are building RAC storage container using Podman , you can use following command.
97+
98+
```bash
99+
export ORACLE_DBNAME=ORCLCDB
100+
podman run -d -t \
101+
--hostname racnode-storage \
102+
--dns-search=example.com \
103+
--cap-add SYS_ADMIN \
104+
--cap-add AUDIT_WRITE \
105+
--cap-add NET_ADMIN \
106+
--volume /scratch/stage/rac-storage/$ORACLE_DBNAME:/oradata \
107+
--network=rac_priv1_nw \
108+
--ip=192.168.17.80 \
109+
--systemd=always \
110+
--restart=always \
111+
--name racnode-storage \
112+
localhost/oracle/rac-storage-server:latest
113+
```
114+
115+
To check the racstorage container/services creation logs , please tail docker logs. It will take 10 minutes to create the racnode-storage container service.
116+
117+
```bash
118+
podman exec racnode-storage tail -f /tmp/storage_setup.log
119+
```
120+
You would see successful message like below -
121+
```bash
122+
#################################################
123+
Setup Completed
124+
#################################################
125+
```
126+
127+
**NOTE**: Expose directory to container which has atleast 60GB. In the above example, we are using `/scratch/stage/rac-storage/$ORACLE_DBNAME` and you need to change values according to your env. Inside container, it will be /oradata and do not change this.
128+
129+
In the above example, we used **192.168.17.0/24** subnet for NFS server. You can change the subnet values according to your environment.
130+
131+
**Note** : If SELINUX is enabled on the Podman host, then you must create an SELinux policy for Oracle RAC on Podman. For details about this procedure, see "How to Configure Podman for SELinux Mode" in the publication [Oracle Real Application Clusters Installation Guide for Podman Oracle Linux x86-64](https://docs.oracle.com/en/database/oracle/oracle-database/21/racpd/target-configuration-oracle-rac-podman.html#GUID-59138DF8-3781-4033-A38F-E0466884D008).
132+
45133

46-
### Running RACStorageServer Docker container
134+
#### RAC Storage container for Docker Host Machine
47135
Execute following command to create the container:
48136

49137
```bash
@@ -60,7 +148,7 @@ docker run -d -t --hostname racnode-storage \
60148

61149
**NOTE**: Expose directory to container which has atleast 60GB. In the above example, we are using `/docker_volumes/asm_vol/$ORACLE_DBNAME` and you need to change values according to your env. Inside container, it will be /oradata and do not change this.
62150

63-
In the above example, we used **192.168.17.0/24** subnet for NFS server. You can change the subnet values according to your environment.
151+
In the above example, we used **192.168.17.0/24** subnet for NFS server. You can change the subnet values according to your environment. Also, SELINUX must be disabled or in permissive mode in Docker Host Machine.
64152

65153
To check the racstorage container/services creation logs , please tail docker logs. It will take 10 minutes to create the racnode-storage container service.
66154

@@ -76,10 +164,21 @@ runOracle.sh: NFS Server is up and running
76164
Create NFS volume for /oradata
77165
#################################################
78166
```
79-
**IMPORTANT:** The NFS volume must be `/oradata` which you will export to RAC containers for ASM storage. It will take 10 minutes for setting up NFS server.
80167

81-
### NFS Volume
82-
Create NFS volume using following command:
168+
**IMPORTANT:** During the container startup 5 files named as `asm_disk0[1-5].img` will be created under /oradata.If the files are already present, they will not be recreated.These files can be used for ASM storage in RAC containers.
169+
170+
### Create NFS Volume
171+
Create NFS volume using following command on Podman Host:
172+
173+
```bash
174+
podman volume create --driver local \
175+
--opt type=nfs \
176+
--opt o=addr=192.168.17.80,rw,bg,hard,tcp,vers=3,timeo=600,rsize=32768,wsize=32768,actimeo=0 \
177+
--opt device=192.168.17.80:/oradata \
178+
racstorage
179+
```
180+
181+
Create NFS volume using following command on Docker Host:
83182

84183
```bash
85184
docker volume create --driver local \
@@ -89,4 +188,10 @@ docker volume create --driver local \
89188
racstorage
90189
```
91190

92-
**IMPORTANT:** If you are not using 192.168.17.0/24 subnet then you need to change **addr=192.168.17.25** based on your environment.
191+
**IMPORTANT:** If you are not using 192.168.17.0/24 subnet then you need to change **addr=192.168.17.80** based on your environment.
192+
193+
**IMPORTANT:** The NFS volume must be `/oradata` which you will export to RAC containers for ASM storage. It will take 10 minutes for setting up NFS server.
194+
195+
## Copyright
196+
197+
Copyright (c) 2014-2024 Oracle and/or its affiliates. All rights reserved.

OracleDatabase/RAC/OracleRACStorageServer/dockerfiles/19.3.0/Dockerfile

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# LICENSE UPL 1.0
22
#
3-
# Copyright (c) 1982-2018 Oracle and/or its affiliates. All rights reserved.
3+
# Copyright (c) 2014-2024 Oracle and/or its affiliates. All rights reserved.
44
#
55
# ORACLE DOCKERFILES PROJECT
66
# --------------------------
@@ -16,10 +16,6 @@
1616
# ---------------
1717
FROM oraclelinux:7-slim
1818

19-
# Maintainer
20-
# ----------
21-
MAINTAINER Paramdeep saini <[email protected]>, Sanjay Singh <[email protected]>
22-
2319
# Environment variables required for this build (do NOT change)
2420
# -------------------------------------------------------------
2521
# Linux Env Variable
@@ -57,5 +53,5 @@ VOLUME ["/oradata"]
5753
WORKDIR /home/oracle
5854

5955
# Define default command to start Oracle Database.
60-
56+
# hadolint ignore=DL3025
6157
CMD exec $SCRIPT_DIR/$RUN_FILE

OracleDatabase/RAC/OracleRACStorageServer/dockerfiles/buildDockerImage.sh

Lines changed: 31 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#
88
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
99
#
10-
# Copyright (c) 2014-2018 Oracle and/or its affiliates. All rights reserved.
10+
# Copyright (c) 2014-2024 Oracle and/or its affiliates. All rights reserved.
1111
#
1212

1313
usage() {
@@ -18,12 +18,12 @@ Builds a Docker Image for Oracle Database.
1818
1919
Parameters:
2020
-v: version to build
21-
Choose one of: $(for i in $(ls -d */); do echo -n "${i%%/} "; done)
21+
Choose one of: $(for i in */; do echo -n "${i%/} "; done)
2222
-o: passes on Docker build option
2323
2424
LICENSE UPL 1.0
2525
26-
Copyright (c) 2014-2017 Oracle and/or its affiliates. All rights reserved.
26+
Copyright (c) 2014-2024 Oracle and/or its affiliates. All rights reserved.
2727
2828
EOF
2929
exit 0
@@ -34,9 +34,9 @@ EOF
3434
##############
3535

3636
# Parameters
37-
VERSION="12.2.0.1"
38-
SKIPMD5=0
39-
DOCKEROPS=""
37+
VERSION="latest"
38+
DOCKEROPS=("${DOCKEROPS[@]}")
39+
PROXY_SETTINGS=("${PROXY_SETTINGS[@]}")
4040

4141
while getopts "hiv:o:" optname; do
4242
case "$optname" in
@@ -47,79 +47,76 @@ while getopts "hiv:o:" optname; do
4747
VERSION="$OPTARG"
4848
;;
4949
"o")
50-
DOCKEROPS="$OPTARG"
50+
DOCKEROPS=("$OPTARG")
5151
;;
5252
"?")
53-
usage;
54-
exit 1;
53+
usage
54+
# shellcheck disable=SC2317
55+
exit 1
5556
;;
5657
*)
57-
# Should not occur
58+
# Should not occur
5859
echo "Unknown error while processing options inside buildDockerImage.sh"
5960
;;
6061
esac
6162
done
6263

64+
6365
# Oracle Database Image Name
6466
IMAGE_NAME="oracle/rac-storage-server:$VERSION"
6567

6668
# Go into version folder
67-
cd $VERSION
69+
cd "$VERSION" || { echo "Error: Unable to change to directory $VERSION"; exit 1; }
70+
6871

6972
echo "=========================="
7073
echo "DOCKER info:"
7174
docker info
7275
echo "=========================="
7376

7477
# Proxy settings
75-
PROXY_SETTINGS=""
76-
if [ "${http_proxy}" != "" ]; then
77-
PROXY_SETTINGS="$PROXY_SETTINGS --build-arg http_proxy=${http_proxy}"
78+
if [ -n "${http_proxy-}" ]; then
79+
PROXY_SETTINGS+=("--build-arg http_proxy=${http_proxy}")
7880
fi
7981

80-
if [ "${https_proxy}" != "" ]; then
81-
PROXY_SETTINGS="$PROXY_SETTINGS --build-arg https_proxy=${https_proxy}"
82+
if [ -n "${https_proxy-}" ]; then
83+
PROXY_SETTINGS+=("--build-arg https_proxy=${https_proxy}")
8284
fi
8385

84-
if [ "${ftp_proxy}" != "" ]; then
85-
PROXY_SETTINGS="$PROXY_SETTINGS --build-arg ftp_proxy=${ftp_proxy}"
86+
if [ -n "${ftp_proxy-}" ]; then
87+
PROXY_SETTINGS+=("--build-arg ftp_proxy=${ftp_proxy}")
8688
fi
8789

88-
if [ "${no_proxy}" != "" ]; then
89-
PROXY_SETTINGS="$PROXY_SETTINGS --build-arg no_proxy=${no_proxy}"
90+
if [ -n "${no_proxy-}" ]; then
91+
PROXY_SETTINGS+=("--build-arg no_proxy=${no_proxy}")
9092
fi
91-
92-
if [ "$PROXY_SETTINGS" != "" ]; then
93+
# shellcheck disable=SC2128
94+
if [ -n "$PROXY_SETTINGS" ]; then
9395
echo "Proxy settings were found and will be used during the build."
9496
fi
9597

98+
9699
# ################## #
97100
# BUILDING THE IMAGE #
98101
# ################## #
99102
echo "Building image '$IMAGE_NAME' ..."
100103

101104
# BUILD THE IMAGE (replace all environment variables)
102105
BUILD_START=$(date '+%s')
103-
docker build --force-rm=true --no-cache=true $DOCKEROPS $PROXY_SETTINGS -t $IMAGE_NAME -f Dockerfile . || {
104-
echo "There was an error building the image."
105-
exit 1
106-
}
107-
BUILD_END=$(date '+%s')
108-
BUILD_ELAPSED=`expr $BUILD_END - $BUILD_START`
109-
110-
echo ""
106+
if docker build --force-rm=true --no-cache=true "${DOCKEROPS[@]}" "${PROXY_SETTINGS[@]}" -t "$IMAGE_NAME" -f Dockerfile .; then
107+
BUILD_END=$(date '+%s')
108+
BUILD_ELAPSED=$((BUILD_END - BUILD_START))
111109

112-
if [ $? -eq 0 ]; then
113-
cat << EOF
110+
echo ""
111+
cat << EOF
114112
Oracle RAC Storage Server Docker Image version $VERSION is ready to be extended:
115113
116114
--> $IMAGE_NAME
117115
118116
Build completed in $BUILD_ELAPSED seconds.
119117
120118
EOF
121-
122119
else
123120
echo "Oracle RAC Storage Server Docker Image was NOT successfully created. Check the output and correct any reported problems with the docker build operation."
121+
exit 1
124122
fi
125-

0 commit comments

Comments
 (0)