(English) How to setup Docker container Oracle Database 19c for Liferay Development Environment

How to setup Docker container Oracle Database 12c for Liferay Development Environment
How to setup Docker container Oracle Database 12c for Liferay Development Environment

Ci spiace, ma questo articolo è disponibile soltanto in Inglese Americano. Per ragioni di convenienza del visitatore, il contenuto è mostrato sotto nella lingua alternativa. Puoi cliccare sul link per cambiare la lingua attiva.

In the previous article How to setup Docker container Oracle Database 12c for Liferay Development Environment we saw how to create an Oracle 12c Docker container for our Liferay Development Environment. In this article we will see how to get an Oracle 19c Docker container that we could later use to host the Liferay database.

The following documents (see database section) provide details of the configurations that are certified by Liferay (pay attention to support for Oracle 19c). You can see the complete documents on Liferay Portal.

 

Liferay 7.2 Compatibility Matrix Database Section

Liferay 7.2 Compatibility Matrix Database Section

I also recommend reading the article How to build a Docker Liferay 7.2 image with the Oracle Database support.

 

1. What are the requirements

Before proceeding with the Docker container setup, let’s see what the requirements are.

  1. You need to install or update Docker on your PC. Refer to this article for how to install Docker on Windows;
  2. You must have configured Docker with at least 2 CPUs;
  3. You must have configured Docker with at least 6GByte of the memory;
  4. You must have configured Docker with at least 15GByte of free storage for Docker.

The docker versions on which I have successfully run the Oracle Docker container are: 17.x, 18.x and 19.x. The version of Docker Engine (Community Edition) that I will refer to in this article is 19.03.5 (you can check version with command docker version).

What is shown in this article can be performed on Windows, Unix-like operating systems. In my case I use macOS. However, always refer to the documentation of Docker and Oracle for what concerns the minimal requirements that the target system must have.

 

2. Oracle Database 19c Docker Image

For some years now, Oracle Database Enterprise Edition 12c is available as an image in Docker Store. Unfortunately Oracle 19c is not available on the Docker Store, but this is not a problem, you can build the Oracle 19c Docker image yourself.

The GitHub oracle/docker-images repository contains everything needed to build Docker images of some of the Oracle products and in particular the Oracle Database. This project on GitHub offers sample Dockerfiles for:

  • Oracle Database 19c (19.3.0) Enterprise Edition and Standard Edition 2
  • Oracle Database 18c (18.4.0) Express Edition (XE)
  • Oracle Database 18c (18.3.0) Enterprise Edition and Standard Edition 2
  • Oracle Database 12c Release 2 (12.2.0.2) Enterprise Edition and Standard Edition 2
  • Oracle Database 12c Release 1 (12.1.0.2) Enterprise Edition and Standard Edition 2
  • Oracle Database 11g Release 2 (11.2.0.2) Express Edition (XE)

The project README contains all the information necessary for building and running the Oracle Docker image. In case you would like to know more, I invite you to read the article Oracle Database 19c com Docker published by Alex Zaballa on the Oracle Technology Network (OTN) blog.

Very well! Once we get our Oracle 19c Docker image, we can go on: running the Docker image and configuring for Liferay.

Docker image built from the Oracle GitHub project.

Docker image built from the Oracle GitHub project.

3. How to starting an Oracle Database Server instance

This Oracle database server image uses Docker data volumes to store data files, redo logs, audit logs, alert logs and trace files. The data volume is mounted inside the container at /opt/oracle/oradata. To use a directory on the host system for the data volume and SQL Scripts, I created the ~/OracleData/19c/data and ~/OracleData/19c/scripts/setup directory.

 

 

The docker run command starts the database with the following features:

  1. Assign the container the name oracledb-19c
  2. Exposes the TCP/IP SQL Net port 1521
  3. Through the environment variables
    1. Set the SID to ORALFRDEV
    2. Set the PDB to ORALFRDEVPDB
    3. Set sysdba password to LwB_27i5Wi8=1
  4. Configure volume usage
    1. ~/OracleData/19c/data:/opt/oracle/oradata: The data volume to use for the database. Has to be writable by the Unix “oracle” (uid: 54321) user inside the container! If omitted the database will not be persisted over container recreation.
    2. ~/OracleData/19c/scripts/setup:/opt/oracle/scripts/setup: A volume with custom scripts to be run after database setup.

Obviously you can customize the values of the start parameters to your liking, these are the ones I usually use for my development environment.

Inside the ~/OracleData/19c/scripts/setup directory are the SQL Scripts (that be run after database setup) needed to create tablespaces, user and grants for Liferay. Following the contents of the file 01_liferay_tablespace.sql, 02_liferay_user.sql, 03_liferay_grant_user.sql.

 

 

 

In this case I created the tablespaces to host the schema for my Liferay Portal 7.2 CE GA2 development environment. I invite you to read the article Liferay Portal 7.2 CE GA2: Update Oracle Database Driver.

You can monitor the start of the container by viewing the logs or using the docker command below.

The first start of the Oracle 19c container will take a few minutes because the whole database setup process must be performed. Here you could see the Docker Container Oracle Database 19c Log of the first boot. The figure below shows the output of the docker ps command. You can see the status of the container indicating that it is ready (healthy) for use and port 1521 is exported.

 

Checking the Oracle Docker Container Status

Checking the Oracle Docker Container Status

 

The following figure shows the execution of the SQL scripts after the Oracle database setup. These scripts will not be executed on subsequent container starts.

 

Executing the SQL Scripts for Liferay

Executing the SQL Scripts for Liferay

 

Following is the structure of the OracleData directory after starting the Oracle container.

 

At this point we have our Oracle Database 19c ready to host the Liferay Portal database.

 

4. Connection Test

At this point we are in a position to perform a connection test to the new scheme using a tool such as Oracle SQLDeveloper. The following figures show the configuration of the database connection, the view of the Liferay tables and the status of the tablespaces created for Liferay.

The parameters to connect to the new Liferay scheme are:

  • Username/password: liferay_dev/liferay_dev
  • Hostname: localhost
  • Service Name: ORALFRDEVPDB

 

Configuring connection to the Oracle database via SQL Developer

Configuring connection to the Oracle database via SQL Developer

 

View Liferay Tables on Oracle Database 19c

View Liferay Tables on Oracle Database 19c

 

View of the Liferay Tablespace

View of the Liferay Tablespace

 

Conclusions

In this article I wanted to show you how I usually configure my development environment when I need to have an Oracle Database to be later connected to Liferay. As you have seen, using Docker makes this all very simple and fast. Other useful resources. Do not hesitate to contact me with any questions and I hope this article has been helpful.

  1. How to build a Docker Liferay 7.2 image with the Oracle Database support
  2. How to build a Docker Liferay 7.2 image with the SQL Server 2017 Database support
  3. Liferay 7.1: How to add support for Oracle DB
  4. Come installare Liferay 7 su JBOSS EAP con il supporto Oracle Database
  5. Liferay 7 Wildfly: How to add support for Oracle DB (video on Antonio Musarra’s Blog YouTube Channel)
  6. Liferay 7 Community Edition GA5 & Oracle 12c via Docker Composer (video on Antonio Musarra’s Blog YouTube Channel)
  7. Come installare Liferay 7 su JBoss EAP con il supporto per Oracle Database (video on Antonio Musarra’s Blog YouTube Channel)
2 Condivisioni

Antonio Musarra

I began my journey into the world of computing from an Olivetti M24 PC (http://it.wikipedia.org/wiki/Olivetti_M24) bought by my father for his work. Day after day, quickly taking control until … Now doing business consulting for projects in the enterprise application development using web-oriented technologies such as J2EE, Web Services, ESB, TIBCO, PHP.

Potrebbero interessarti anche...