Sunday, October 16, 2016

Oracle API Gateway: Docker image for OAG 11.1.2.4.0

I was working on the Docker which is used to create virtual machines based on container. As per docker documentation Docker is still maturing for the production type environment but it can be used for development and other non-prod environments.

you can get the docker file from github location :

https://github.com/CodeConfuse/docker.git

Build Docker Image

docker build -t oracle/oag:12.1.2.4.0 -f ./DockerFile .

Run OAG Docker Image

--run docker image
docker run -d -p 9090:8090 --user=oracle -e "DISPLAY=localhost:0.0" --name=OAG --shm-size=2g -t oracle/oag:12.1.2.4.0


--run oag nodemanager in docker container
docker exec -it OAG /u01/oracle/product/OAG-11.1.2.4.0/apigateway/posix/bin/nodemanager &


--run oag instance in docker container
docker exec -it OAG /u01/oracle/product/OAG-11.1.2.4.0/apigateway/posix/bin/startinstance -n "Gateway1" -g "Group1" &

Oracle API Gateway : File based KPS collection in OAG

KPS stands for Key Property Store is a collection of data stored in table structure referenced by policies running on Oracle API Gateway instance. KPS data can be stored in three different ways:

  • Embedded Apache Cassandra database
  • Relational SQL Database
  • JSON File System.

In this blog post I am going to discuss about configuring kps using json file system and how to access these kps collection in OAG policies.

Usecase

In my scenario, I have used kps as key-value pair to store the environment properties like hostname, port, URI etc. as shown below:

These values changes for different environments like prod or non-prod.

Steps to configure KPS 
  • Open oag policy studio -> right click on Key Property Stores and select Add KPS Collection
  • Create new kps collection with name "Settings"


  • Right click on Settings KPS collection and select Add Table
  • Create table with name "Properties" and create structure as below
  • deploy the configuration.

Edit the values of KPS
  • Open node manager console -> https://host:port/8090
  • Go to settings tab -> Key Property Stores as shown below
  • Select table and add new entry or you can edit the value of existing record. you can not edit the column marked as a primary key i.e. in this case you cannot edit the value of column key.
  • When you create the entry schema json file is automatically created at this location i.e. OAG-11.1.2.4.0/apigateway/groups/group-3/instance-1/conf/kps/file with file as settings_properties.json.
  • Now you can edit this file also to add or modify the values in kps.
  • you need to restart the oag instance to reflect the updated values.
Access kps collection in OAG policies

KPS data can be access in oag policies by using the selectors as below:

for example: to access value of OAMHOST the selector expression is as follows

${kps.Properties["OAMHOST"].Value}