The Oracle Policy Automation Cloud, version 12, offers lot of features when compared to the on-premise version of OPA. Switching from the on premise version to the cloud was really easy and I felt the rule writing is much better on this version. One thing I missed, didn’t know — correctly put, was deployment of the rulebases into a local server and experience the interview screens in a browser. Purchasing the Oracle Hub license, for learning purpose, is not at all a good deal. Well, thanks to my colleague who shared this great information about the concept of ‘Private Cloud’ and helped me learning it super fast. Today, I am going to share my knowledge on setting up the OPA Private Cloud.
To set up the private cloud on your machine you must meet the following software requirements. You should have;
- Weblogic Application server version 11g or 12c,
- Unix/Linux or Windows OS,
- Oracle database 11 or later/MySQL Database 5.1 or later,
- Java 7 or Java 8.
- OPA Server components
If you ask what my system configuration is, I am using;
- Weblogic Application server 12c,
- Windows 10,
- Oracle database 11g Express Edition
- JDK 1.8
- OPM August 2016
- OPA Server Components
- Oracle Database – We install Oracle DB and create a user for handling OPA database. We also create a namespace for storing the database.
- OPA Server Components – The OPA Server components package which we download will help you with generating OPA web applications, the war files, which is deployed to server for creating the OPA website. This is nothing but the OPA-Hub website which maintains all the rule deployments.
- Orace Weblogic Server – Next we install the Oracle Weblogic server and create a domain for us to deploy the OPA web application war files. Domain is nothing but, technical term which means a logically related group of Weblogic server resources. It includes an Administrative Server and server instances called Managed Servers. The deployments are loaded into Managed Servers and Administrave Server is used to manage and configure purposes. We also configure a ‘Data Source‘ which maps the deployments to the database user we have created using the Oracle DB. Don’t worry, we have a friendly interface to do all this steps and its all just a matter of few clicks, fill few text fields and you are ready to go.
- Finally we deploy our OPA-hub application into web logic server and our OPA Private Cloud or OPA Hub set up is ready.
- Now using Policy Modeling tool we can link this private cloud to deploy our rulebase projects locally to the Private OPA Hub.
Setting Up Private Cloud — OPA Hub
First let’s start with Oracle Database installation. Why Database? Well, you need a database for the OPA Private cloud to install. This, you can either use the existing database or create new one which can hold the OPA schema. I have already covered one post which explains how to install Oracle Database and connect it with the SQL developer. This post covers steps about unlocking HR database in 11g. Anyway, let me quickly take you through the installation once more. The Oracle database is free to develop, deploy and distribute. You can download it from here for free.
Just click on ‘Accept Licence Agreement’ and select the version you want to install depending upon the type of OS you are using. You will be asked to login to Oracle account. Just create new one if you don’t have an account.
Once the download is finished, extract the zip file, double click setup.exe inside DISK1 folder.
Continue with the normal installation process. You will be asked to create/enter password for the default SYS and SYSTEM database. I am using root as the password, you can use anything you want. PS: Do Remember the Password.
Once the installation is completed you can either depend on the OPA private cloud installer to create a user, tablespace and schema for you or you can create on manually and assign it during the cloud installation, which we will cover later in this tutorial. I am going to create a user, tablespace and schema manually through the following step.
Go to Start -> Oracle Database 11g Express Edition -> Run SQL Command Line.
Enter the following commands as per the screenshot below.
This command is used to connect to the default database system. The ‘root’ is the password.
Next we are going to create a user for handling the database system. Create a user for exclusive use for an OPA connection.
CREATE USER opauser IDENTIFIED BY “<password>”;
My username is ‘opauser’ and password is ‘root’
Grant permissions to the user. You need to grant sufficient permissions for the user to create the schema, connect, and execute queries, updates, and so on.
GRANT CREATE SESSION TO opauser;
GRANT CREATE TABLE TO opauser;
GRANT CREATE VIEW TO opauser;
GRANT CREATE ANY TRIGGER TO opauser;
GRANT CREATE ANY PROCEDURE TO opauser;
GRANT CREATE SEQUENCE TO opauser;
GRANT CREATE SYNONYM TO opauser;
ALTER USER opauser quota unlimited on USERS;
You can create a tablespace for the OPA user. If you do not, the user will use the database default tablespace. For example:
CREATE TABLESPACE opa1 DATAFILE ‘C:/oraclexe/app/oracle/oradata/OPADB/opa1.dbf’
SIZE 500M AUTOEXTEND ON MAXSIZE UNLIMITED;
ALTER USER opauser DEFAULT TABLESPACE opa1;
Here, ‘C:/oraclexe/app/oracle/oradata’ this is the installation directory of the Oracle db. Once you run the above command it will create a tablespace with name ‘opa1.dbf’ in the directory specified. Mostly, ‘OPADB’ folder won’t be there and so you need to create one before running this command.
Download and Unzip OPA Server Components
OPA Server components is nothing but a zip file which has some jar files which is used for executing batch operations, sql query statements for carrying out db operations. It also has a windows command script which lets you to generate war files like determinations-server, document-generation-server, opa-hub, and web-determinations. Generating and deploying our war files is the main focus of this tutorial post. These war files are also called as OPA web applications war files since it is used to create the OPA site. The opa-hub.war file is the one which is used to create the OPA hub or the private cloud. I will explain how to generate war files as per our requirement later on this tutorial. Now, we need to install Weblogic server for deployment purposes.
Install and Setup Weblogic Server
Download the weblogic server installation files from the above mentioned link. The download file will have a name something like, “fmw_188.8.131.52.0_wls_Disk1_1of1.zip” and it may vary depending to the version and the time you download it. Once finished, just unzip the file and you will get a Executable Jar File/Jar file with name “fmw_184.108.40.206.0_wls.jar”. There is no straight forward installation method which comes along with the package. We will use the command prompt and since it is a jar file, we will be using the java command to execute it.
First open command prompt in administrator mode, right click and select Run as administrator, now type in
C:\…..\bin\ java -jar fmw_220.127.116.11.0_wls.jar.jar
(Substituting “….” with your path to the JDK.)
Here, you may end up with some errors and most of them will be the issue with the path you give. Or you haven’t open the command prompt in administrator mode. If everything is goes right then you will get the weblogic installation window.
Just select the basic installation options and keep on hitting Next. You will get a screen similar to this and you are almost done with the weblogic server installation.
Now, you need to configure our server. This is pretty simple and again, there is no coding required. The configuration window will pop up and ask you to create a new domain. Like explained in the beginning of this post, domain is nothing but, technical term which means a logically related group of Weblogic server resources. Select the option ‘Create a new domain’ and specify the path you want the components to be installed. I am using the default path since it is more organized and generic.
Now, create an administrator account. Give name as ‘weblogic’ and password ‘root’.
Keep on hitting Next button until you see the node manager session. Just leave it as it is or give the username and password of your choice.
Now you can see the Configuration Summary of your server structure. If you want to change anything, you can go back and change. I suggest you to stick to the default values. Once ready, hit Next.
Here you could see the configuration process where the system is working with the installation. Once finished, hit Next.
The ‘End of configuration’ part of the installation will show you the domain installation location and the URL to access the server. Take a note of it as you may need this to login to server using browser. Click finish and you are done with the installation. Check the box ‘Start Admin Server’ on the bottom of the screen if you want the server to start automatically when you close this window.
If you want to start the server manually, go to the server installation location. Open ‘startWebLogic.cmd’ file and you will see a screen similar to this.
When you see the last line which is similar to the above screenshot in the command prompt window, you can open any browser and start typing the address, showing in the cmd window, in the address bar or if you remember, use the URL from the weblogic configuration which I have asked to note down. You will get a message on the browser similar to this.
Once the deployment is completed you will be asked to login to the weblogic using the credentials that we gave during the installation. Upon successful login you can see the weblogic console as shown below.
We will come back to this later. Now let’s install OPA and generate the OPA application war files that we have to deploy to the weblogic server.
Go to the location where you have unzip the OPA server components. Inside bin folder -> select install.cmd. This will pop up the command prompt window which will help you install the runtime components. Now, this screen has 3 options. First, we are going to install OPA hub database.
Enter the deployment name as ‘opa’, this you can choose anything as per your requirement. To follow up with the rest of the settings in this tutorial I suggest you to use the same.
Choose the database type as Oracle.
Now it will ask you to ‘Enter the Database connection server and port (including identifier/SID/tnsname):’, well, this information you will get from database config file, tnsnames.ora. For this you need to go to C:\oraclexe\app\oracle\product\11.2.0\server\network\ADMIN and open the tnsnames.ora file using text editor.
Enter in the format: For Example: ABC.xyz.com:1521:XE (Hostname:port:SID)
Substitute as per in your tnsnames.ora file.
Now it will ask you to chose the admin password for the opa hub. Remember what you enter here as you require this for logging into opa hub. If you don’t enter anything, a default password will be generated and you can take a note of it. I recommend to choose one yourself and that way it is easier to remember.
The installer will show you a summary of details you have just entered. Just verify and hit enter to continue with the installation.
Create OPA Web Applications
Once the hub database is created we are now going to generate the web applications war file for OPA. This can also done very easily using the OPA server components package. Go to the place you have unzipped the OPA server components file -> bin ->install.cmd. Select the 3rd option ‘Create OPA web applications’ and hit enter.
Now it will ask you to provide a deployment name. Type ‘opa’ since we have used this name while creating database. Now choose the database type as Oracle.
Now the installer will ask for data source details. This is same as then one you gave in the previous installation.
For Example: ABC-IN.in.xyz.com:1521:XE (Hostname:port:SID). Now, the datasource username will be ‘opauser’ and the password is ‘root’.
Next step is to set up an encryption key. You can either leave it blank, in that case the system will generate one key for you, or else you can key in one by yourself. Either case you need to remember this as we require the key during redeployment time.
Next it will ask for configuring ‘Secure Session Cookie’ settings. You have two options to choose from;
- If you are accessing OPA through HTTPS over SSL/TLS (highly recommended for a secure production system), choose 1 for Leave secure session cookies on. You will not be able to use the OPA web applications through any method other than HTTPS over SSL/TLS if you choose this option.
- If you are running a test or internal OPA through HTTP (non-secure), choose 2 for Turn off secure session cookies. This will allow you access OPA through HTTP, but is inherently unsecure.
Since ours is a test or internal setup we will go with the option number 2. So, choose ‘Turn off secure session cookies’ for this step. Hit enter and your web application war files will be generated.
You can locate the files by going to the Server Components extraction location -> Server_Components -> OPA_Aug2016_v18.104.22.1688.1 -> opa -> deploy folder.
Configuring OPA Data Source in Weblogic Server
We are using weblogic server to deploy the OPA war files/web applications. The OPA Hub requires a database to work with which we have already created. Now, the server has to be configured in such a way that the war files and the database can be communicated. Technically, we need to tell the server about the data sources. For this, you need to first fire up the weblogic server by going to the installation directory which I have asked to note down during the time of server installation step. Don’t worry, the default path will be;
To start the server, just double click on startWebLogic.cmd file under this path.
Now go to the browser and using the Admin URL login to the weblogic console. Upon login in you will get a screen similar to this;
On the left navigation pane ‘Domain Structure‘ under Services select Data sources. Now click the New Option and select the first option Generic Data Source.
Enter the following;
- Name : opa
- Scope : Global
- JNDI Name : opaHub.ds.opa here, opa is the deployment name. Generic structure is opaHub.ds.<deployment name>
- Database Type : Oracle
Now select Next and select the Database driver as per the image given below.
This is to select the Transaction Options. Just leave the settings as such and click Next.
Here, you need to define the Connection Properties
- Database Name : XE
- Host Name : ABC.xyz.com:1521:XE
- Port : 1521
- Database user name : opauser
- Password : root
Test Database connection screen – here you can test the availability of the database and other the connection properties you have provided. Click on the Test Configuration button and if everything is correct then you will get a green message on the top of the screen saying ‘Connection test succeeded’.
Click Finish and you can see the opa datasource that you have created listed on the screen.
Deploying OPA Web Applications in Weblogic
On the left navigation pane locate Deployments option. Now select Install.
Click on Next until you see this screen. Now, choose the deployment archive or war file to upload.
You can upload the rest of the three war files like this.
Now, in browser, in new tab enter abc:7001/opa/opa-hub/manager.
abc – it changes as per your host name.
Now, you will be presented with the OPA Hub login screen. You can login using the credentials that you have given during the installation process. Once logged in you can use the console to manager the rule bases and more. You can use the same URL for connecting the private cloud to the Policy Modeling tool. I will be covering more about this on coming posts. Please follow the steps as per the tutorial and do let me know if you have any doubts or more clarification is needed at any point. Use the ‘Contact Me’ session on the blog or kindly leave comments. Please like OPAtutorials on Facebook and sign up for email subscription to get notification on latest posts. Thanks for reading.