Skip to content

Commit

Permalink
Publishing OracleWebCenterPortal DockerScripts (oracle#1777)
Browse files Browse the repository at this point in the history
* Publishing OracleWebCenterPortal DockerScripts

Signed-off-by: Anand Sirasagi <[email protected]>
Reviewed-by: Avi Miller <[email protected]>
  • Loading branch information
anandsirasagi authored Nov 12, 2020
1 parent 096dc60 commit d58e9a0
Show file tree
Hide file tree
Showing 30 changed files with 2,208 additions and 1 deletion.
3 changes: 2 additions & 1 deletion CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@
/OracleWebCenterSites/ @prshshuk
/OracleWebLogic/ @mriccell
/OracleUnifiedDirectory/ @kuldeepbshah @surya902
/OracleUnifiedDirectorySM/ @kuldeepbshah @surya902
/OracleUnifiedDirectorySM/ @kuldeepbshah @surya902
/OracleWebCenterPortal/ @dgothe
22 changes: 22 additions & 0 deletions OracleWebCenterPortal/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Oracle WebCenter Portal on Docker
==============================

This project offers scripts to build an Oracle WebCenter Portal docker image based on 12.2.1.4.0 release. Use this Docker configuration to facilitate installation, configuration, and environment setup for DevOps users. For more information about Oracle WebCenter Portal, see the Oracle WebCenter Portal 12.2.1.4.0 Online Documentation [Oracle Fusion Middleware](http://www.oracle.com/technetwork/middleware/fusion-middleware/overview/index.html) specifically the sections on
- Oracle WebCenter Portal

## What is included
- Sample docker file to build an image containing a pre-configured WCP domain

## How to build
[Please review this README file](dockerfiles/README.md)

## How to run
[Please review this README file](dockerfiles/12.2.1.4/README.md)

## License
To download and run Oracle Fusion Middleware, regardless whether inside or outside a Docker container, you must download the binaries from the Oracle website and accept the license indicated at that page.

All scripts and files hosted in this project and GitHub [docker-images/OracleWebCenterPortal](./) repository required to build the Docker images are, unless otherwise noted, released under [UPL 1.0](https://oss.oracle.com/licenses/upl/) license.

## Copyright
Copyright (c) 2014-2017 Oracle and/or its affiliates. All rights reserved.
1 change: 1 addition & 0 deletions OracleWebCenterPortal/dockerfiles/12.2.1.4/Checksum
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
f337b0f50260dbdc293a665b2527e23a fmw_12.2.1.4.0_wcportal_generic.jar
98 changes: 98 additions & 0 deletions OracleWebCenterPortal/dockerfiles/12.2.1.4/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
#
# ORACLE DOCKERFILES PROJECT
# --------------------------
# This is the Dockerfile for Oracle WebCenter Portal 12.2.1.4
#
# Base image of this dockerfile is Oracle FMW Infrastructure 12.2.1.4.0
# Pull base image from the Oracle Container Registry or Docker Store and tag the name as 'oracle/fmw-infrastructure:12.2.1.4.0'
#
# REQUIRED FILES TO BUILD THIS IMAGE
# ----------------------------------
# (1) fmw_12.2.1.4.0_wcportal.jar
#
# Download all dependent binaries from : http://changeiq.oraclecorp.com/fmw-stage/?release=FMW12.2.1.4.0
#
# HOW TO BUILD THIS IMAGE
# -----------------------
# Put all downloaded files in the same directory as this Dockerfile
# Run:
# $ docker build -t oracle/wcportal:12.2.1.4.0 .
#
# -------------------------------------------------------------
FROM oracle/fmw-infrastructure:12.2.1.4.0 as builder

LABEL "provider"="Oracle" \
"maintainer"="Anand Sirasagi <[email protected]>" \
"issues"="https://github.com/oracle/docker-images/issues"

# -------------------------------------------------------------
# Environment variables required for this build (do NOT change)
# -------------------------------------------------------------
USER root
ENV FMW_PORTAL_JAR=fmw_12.2.1.4.0_wcportal.jar \
ORACLE_HOME=/u01/oracle \
USER_MEM_ARGS="-Djava.security.egd=file:/dev/./urandom" \
PATH=$PATH:/usr/java/default/bin:/u01/oracle/oracle_common/common/bin:/u01/oracle/wlserver/common/bin:/u01/oracle/container-scripts
# -------------------------------------------------------------
# Setup filesystem and oracle user
# Unzip WCPORTAL installer
# Go to /u01 as user 'oracle' to proceed with WCPORTAL installation
#
# Note : Proxy needs to be set before running yum in /etc/yum.conf
# -------------------------------------------------------------

RUN mkdir -p /u01 && \
chmod a+xr /u01 && \
mkdir -p /u01/oracle/container-scripts && \
mkdir -p /u01/oracle/logs && \
mkdir -p /u01/esHome/esNode

# copy container scripts
# -------------------------------------------------------------
COPY container-scripts/*.sh container-scripts/*.py /u01/oracle/container-scripts/
COPY $FMW_PORTAL_JAR install.file oraInst.loc /u01/

# Adjust file permissions, go to /u01 as user 'oracle' to proceed with WLS installation
# -------------------------------------------------------------
RUN chown oracle:oracle -R /u01 && \
chmod a+xr /u01/oracle/*.*

# Install as user
# -------------------------------------------------------------
USER oracle

# Install WebCenter Portal binary
# -------------------------------------------------------------
RUN $JAVA_HOME/bin/java -jar /u01/$FMW_PORTAL_JAR -silent -responseFile /u01/install.file -invPtrLoc /u01/oraInst.loc -jreLoc $JAVA_HOME -ignoreSysPrereqs -force -novalidation ORACLE_HOME=$ORACLE_HOME INSTALL_TYPE="WebCenter Portal" && \
rm /u01/$FMW_PORTAL_JAR /u01/oraInst.loc /u01/install.file /u01/oracle/oracle_common/lib/ons.jar /u01/oracle/oracle_common/modules/oracle.jdbc/simplefan.jar

#Rebuilding Base image
FROM oracle/fmw-infrastructure:12.2.1.4.0
#
# Install the required packages
# -----------------------------
USER root

ENV PATH=$PATH:/usr/java/default/bin:/u01/oracle/oracle_common/common/bin:/u01/oracle/wlserver/common/bin:/u01/oracle/container-scripts

RUN yum install -y sudo hostname zip unzip tar procpcs &&\
rm -rf /var/cache/yum

COPY --from=builder --chown=oracle:oracle /u01 /u01


# Expose all Ports
# -------------------------------------------------------------
EXPOSE $WCPORTAL_PORT $ADMIN_PORT

USER oracle
# Set work directory

# -------------------------------------------------------------
WORKDIR $ORACLE_HOME

# -------------------------------------------------------------
# Define default script
CMD ["/u01/oracle/container-scripts/configureOrStartAdminServer.sh"]
255 changes: 255 additions & 0 deletions OracleWebCenterPortal/dockerfiles/12.2.1.4/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,255 @@
# Oracle WebCenter Portal 12.2.1.4.0 on Docker
## Preparing to Run Oracle WebCenter Portal Docker Container
Configure an environment before running the Oracle WebCenter Portal Docker container. You need to set up a communication network between containers on the same host and a WebCenter Content Server instance.

##### A. Creating a user-defined network
##### B. WebCenter Content Server (Optional)

### A. Creating a user-defined network
Create a user-defined network to enable containers to communicate by running the following command:

```
$ docker network create -d bridge WCPortalNET
```

### B. WebCenter Content Server (Optional)
You need to have a running WebCenter Content Server on any machine. The Content server connection details are required for configuring WebCenter Portal during configuration process.

**Note :** This step is required only when the WebCenter Portal uses Content Server as content repository.

## Running Oracle WebCenter Portal Docker Container
To run the Oracle WebCenter Portal Docker container, you need to create:
* Container to manage the Admin Server.
* Container to manage the Managed Server.

### 1. Creating containers for WebCenter Portal Server

#### 1.1. Update the environment file

Create an environment file `webcenter.env.list` file, to define the parameters.

Update the parameters inside `webcenter.env.list` as per your local setup.

```
#Database Configuration
DB_DROP_AND_CREATE=<true or false>
DB_CONNECTION_STRING=<Hostname/ContainerName>:<Database Port>/<DB_PDB>.<DB_DOMAIN>
DB_RCUPREFIX=<RCU Prefix>
DB_PASSWORD=<Database Password>
DB_SCHEMA_PASSWORD=<Schema Password>
#configure container
ADMIN_SERVER_CONTAINER_NAME=<Admin Server Container Name>
ADMIN_PORT=<Admin Server Port>
ADMIN_PASSWORD=<Admin Server Password>
ADMIN_USERNAME=<Admin Server User Name>
MANAGED_SERVER_PORT=<Managed Server Port>
# Configure Content Server
CONFIGURE_UCM_CONNECTION=<true or false>
#Valid option for socket type are socket,jaxws
UCM_SOCKET_TYPE=<UCM Socket Type >
#Required if UCM_SOCKET_TYPE is jaxws
UCM_URL=<Configure UCM URL If Socket type is jaxws>
UCM_HOST=<UCM Host>
UCM_PORT=<UCM Port>
UCM_ADMIN_USER=<UCM Admin User>
# Configure Elasticsearch Server
SEARCH_APP_USERNAME=<Search User Name>
SEARCH_APP_USER_PASSWORD=<Search User Password>
```

### 1.2. Admin Container (WCPAdminContainer)
#### A. Creating and Running Admin Container

Run the following command to create the Admin Server container:

```
$ docker run -i -t --name $ADMIN_SERVER_CONTAINER_NAME --network=WCPortalNET -p <Any Free Port>:$ADMIN_PORT -v $DATA_VOLUME:/u01/oracle/user_projects --env-file <directory>/webcenter.env.list $WCPortalImageName
```
**Note:** Replace variables with values configured in webcenter.env.list
The above command deletes any previous RCU with the same prefix if **DB_DROP_AND_CREATE=true**

The docker run command creates the container as well as starts the Admin Server in sequence given below:

* Node Manager
* Admin Server

When the command is run for the first time, we need to create the domain and configure the portal server, so following are done in sequence:

* Loading WebCenter Portal schemas into the database
* Creating WebCenter Portal domain
* Configuring Node Manager
* Starting Node Manager
* Starting Admin Server

#### B. Stopping Admin Container
```
$ docker container stop WCPAdminContainer
```

#### C. Starting Admin Container
```
$ docker container start -i WCPAdminContainer
```

### 1.3. Portal Container (WCPortalContainer)

#### A. Creating and Running Portal Container
Run the following command to create the Portal Managed Server container:

```
$ docker run -i -t --name WCPortalContainer --network=WCPortalNET -p <Any Free Port>:$MANAGED_SERVER_PORT -v $DATA_VOLUME:/u01/oracle/user_projects --env-file <directory>/webcenter.env.list $WCPortalImageName configureOrStartWebCenterPortal.sh
```
**Note:** Replace variables with values configured in webcenter.env.list

The docker run command creates the container as well as starts the WebCenter Portal managed server.

When the command is run for the first time, WebCenter Content Server connection creation is also done if **CONFIGURE_UCM_CONNECTION=true**.

#### B. Stopping Portal Container
```
$ docker container stop WCPortalContainer
```

#### C. Starting Portal Container
```
$ docker container start -i WCPortalContainer
```

#### D. Getting Shell in Portal Container
```
$ docker exec -it WCPortalContainer /bin/bash
```

### 1.4. Elasticsearch Container (ESContainer)
To create an Elasticsearch container, we can reuse the environment file `webcenter.env.list` from the above example.

#### A. Data on a volume for Elasticsearch Container
We need to mount data volume to store crawled data outside the Elasticsearch container.

To mount a host directory `/scratch/wcpdocker/volumes/es` ($ES_DATA_VOLUME) as a data volume, execute the below command.

```
$ sudo mkdir -p /scratch/wcpdocker/volumes/es
$ sudo chown 1000:1000 /scratch/wcpdocker/volumes/es
```

#### B. Creating and Running Elasticsearch Container

```
$ docker run -i -t --name ESContainer --network=WCPortalNET -p 9200:9200 --volumes-from WCPortalContainer -v $ES_DATA_VOLUME:/u01/esHome/esNode/data --env-file <directory>/webcenter.env.list $WCPortalImageName configureOrStartElasticsearch.sh
```

#### C. Stopping Elasticsearch Container
```
$ docker container stop ESContainer
```

#### D. Starting Elasticsearch Container
```
$ docker container start -i ESContainer
```

# FAQs


##### 1. How do I reuse existing domain?
To reuse a existing domain we need to comply with existing domain configuration given in `webcenter.env.list` and container names.

Follow below instruction to recreate a container in such a way that they continue using existing domain on data volume.

*Delete existing container (ESContainer,WCPortalContainer and WCPAdminContainer)*

```
$ docker container stop ESContainer
$ docker container stop WCPortalContainer
$ docker container stop WCPAdminContainer
$ docker container rm ESContainer
$ docker container rm WCPortalContainer
$ docker container rm WCPAdminContainer
```

*Reuse the WebCenter Portal database schema*

Update the following parameter inside `webcenter.env.list` :

```
DB_DROP_AND_CREATE=false
```

*Create container pointing to existing domain*
*Run the command to create Container in given Sequence (run as non root user)*
```
# create Admin Container
$ docker run -i -t --name WCPAdminContainer --network=WCPortalNET -p 7001:7001 -v /scratch/wcpdocker/volumes/wcpportal:/u01/oracle/user_projects --env-file /scratch/<userid>/docker/webcenter.env.list oracle/wcportal:12.2.1.4.0
# create Portal Container
$ docker run -i -t --name WCPortalContainer --network=WCPortalNET -p 8888:8888 -v /scratch/wcpdocker/volumes/wcpportal:/u01/oracle/user_projects --env-file /scratch/<userid>/docker/webcenter.env.list oracle/wcportal:12.2.1.4.0 configureOrStartWebCenterPortal.sh
# create Elasticsearch Container
$ docker run -i -t --name ESContainer --network=WCPortalNET -p 9200:9200 --volumes-from WCPortalContainer -v /scratch/wcpdocker/volumes/es:/u01/esHome/esNode/data --env-file /scratch/<userid>/docker/webcenter.env.list oracle/wcportal:12.2.1.4.0 configureOrStartElasticsearch.sh
```



##### 2 How do I create containers with new domain?
In case of any error or want a new fresh instance then you need to follow given instruction in sequence:

*Delete existing container (WCPAdminContainer, WCPortalContainer and ESContainer)*


*Delete data from shared data volume*

```
# below command should be run as root user
$ rm -rf $ES_DATA_VOLUME/*
$ rm -rf $DATA_VOLUME/*
```

*Drop and recreate the WebCenter Portal database schema*

```
$ docker container stop ESContainer
$ docker container stop WCPortalContainer
$ docker container stop WCPAdminContainer
$ docker container rm ESContainer
$ docker container rm WCPortalContainer
$ docker container rm WCPAdminContainer
```

Update the following parameter inside `webcenter.env.list` :

```
DB_DROP_AND_CREATE=true
```

*Create containers*

*Run the command to create Container in given Sequence (run as non root user)*

```
# create Admin Container
$ docker run -i -t --name WCPAdminContainer --network=WCPortalNET -p 7001:7001 -v /scratch/wcpdocker/volumes/wcpportal:/u01/oracle/user_projects --env-file /scratch/<userid>/docker/webcenter.env.list oracle/wcportal:12.2.1.4.0
# create Portal Container
$ docker run -i -t --name WCPortalContainer --network=WCPortalNET -p 8888:8888 -v /scratch/wcpdocker/volumes/wcpportal:/u01/oracle/user_projects --env-file /scratch/<userid>/docker/webcenter.env.list oracle/wcportal:12.2.1.4.0 configureOrStartWebCenterPortal.sh
# create Elasticsearch Container
$ docker run -i -t --name ESContainer --network=WCPortalNET -p 9200:9200 --volumes-from WCPortalContainer -v /scratch/wcpdocker/volumes/es:/u01/esHome/esNode/data --env-file /scratch/<userid>/docker/webcenter.env.list oracle/wcportal:12.2.1.4.0 configureOrStartElasticsearch.sh
```

# Copyright
Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
Loading

0 comments on commit d58e9a0

Please sign in to comment.