From November 2018

Deploying an Oracle Database with Persistence in Oracle Kubernetes Engine


UPDATE: Follow this post for the deployment part, as it has been updated, the rest of the content is still valid, thanks.

Today we are deploying an Oracle database instance in a K8s cluster making them persistent so that data is not lost after container/pod restarts. Please follow this link to get the yaml file or simply execute the following:

kubectl apply -f https://raw.githubusercontent.com/javiermugueta/k8s-orcldb/master/orcldb.yaml
persistentvolumeclaim/data-pvc created
deployment.apps/orcldb created
service/oracledb created

After a while a new pod and service should be created, check it with:

kubectl get po
NAME READY STATUS RESTARTS AGE
orcldb-796ddfdd6f-tgfqf 1/1 Running 0 5m
kubectl get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
oracledb LoadBalancer 10.96.9.195 130.61.66.33 1521:31521/TCP 5m

Write down the external IP of the service created and set up a new connection to the database with your preferred tool as follows (password is Oradoc_db1):

Once connected, issue the following:

create table t (c varchar2(10));
insert into t (c) values ('aaaaaaaaaa');
insert into t select * from t;
commit;
select count(*) from t;

Table T created.
1 row inserted.
1 row inserted.
Commit complete.
COUNT(*)
----------
2

Now delete the pod:

kubectl delete po orcldb-796ddfdd6f-tgfqf

You’ll notice that the connection to the database is lost until the pod recreates again (you can’t have more than one replica for this particular use case):

But after a while, the pod gets created again and if you reconnect to the database you’ll find your data in there:

That’s all folks!

Enjoy 🙂

Pipelines in Oracle Developer Cloud Service (aka DevCS)


black metal frames
Photo by Genaro Servín on Pexels.com

Latest releases of DevCS now provides several new features, one of them is pipelines. In short, pipelines are graphs of steps that can be executed in a more controlled manner. In our use case, we are leveraging pipelines for starting and stopping cloud services that are dependent between them, such as JCS or SOACS that depends on DBCS. Of course, this is not the typical use case and, in other posts, we’ll cover more typical build workflows.

devcs1

The editor is graphical and lets you configure the logic of the flow:

devcs2

The procedure is basically creating classic build steps:

devcs3.png

Then you can put in the graph with drag&drop:

 

Enjoy 🙂

Install Oracle Data Integration Platform Cloud (aka ODIPC) ODI Agent in an Oracle Cloud DB System


Let’s go ahead:

  • From the ODICP portal download the agent:

odipc

  • ssh to the database node
  • sudo su – oracle
  • unzip agent-linux.64.bit.zip
  • Issue the following command (what we are doing now is downloading the SSL certificate of the ODIPC cloud service and importing in cacerts):
openssl s_client -showcerts -connect <odipcservernameurl>:443 </dev/null 2>/dev/null|openssl x509 -outform PEM > adipcocporaclecloudcom.crt

such as:

openssl s_client -showcerts -connect testadi-txlxfxnxcxclxxd2.adipc.ocp.oraclecloud.com:443 </dev/null 2>/dev/null|openssl x509 -outform PEM >mycertfile.pem
  • And now this command:
/u01/app/12.2.0.1/grid/jdk/bin/keytool -import -alias adipcocporaclecloudcom -keystore /u01/app/12.2.0.1/grid/jdk/jre/lib/security/cacerts -file adipcocporaclecloudcom.crt

[you’ll be prompted for a password, it is changeit]

  • Now go to the Cloud Dashboard and grab the url of the IDCS service, such as:

https://idcs-e6f40c2&#8230;..qtden….cd69ee.identity.oraclecloud.com

odipc6odipc5

So far, so good…

Now we need to create an IDCS application, so go to IDCS Console/Applications section:

odipc6

Add a new application of type Confidential Application, and give it a name:

odipc7

Now configure the following in the Client Configuration section:

odipc8

Then in Allowed Scopes click [Add] and select from the pop-up dialog the name of the ODIPC instance service you created:

odipc9

Grab the value of the Allowed Scope for later and finish the wizard:

odipc10

You’ll be shown a pop-up dialog with the clientid and secret of the Application. If you miss it don´t worry, you can get it again going to the General Information section, gain grab both values for later:

odip11.png

Now is time to execute the installer providing all the values gathered before, this is what we have so far:

[oracle@db dicloud]$ pwd
/home/oracle/dicloud
[oracle@db dicloud]$ ll
total 16
-rw-r--r-- 1 oracle oinstall 2264 Nov 23 00:21 adipcocporaclecloudcom.crt
drwxr-xr-x 3 oracle oinstall 4096 Aug 31 00:56 agent
-rwxr-x--- 1 oracle oinstall 1001 Aug 31 00:45 dicloudConfigureAgent.sh
-rwxr-x--- 1 oracle oinstall  358 Aug 31 00:45 dicloudUpgradeAgent.sh
[oracle@db dicloud]$ export JAVA_HOME=/u01/app/12.2.0.1/grid/jdk
[oracle@db dicloud]$ 
[oracle@db dicloud]$ ./dicloudConfigureAgent.sh 
2018-11-23 01:04:07.066 INFO [oracle.dicloud.agent.core.GGCCAgentInstallation] (oracle.dicloud.agent.core.GGCCAgentInstallation handleCreateInstance) Creating agent instance home at :/home/oracle/dicloud/agent/dipcagent001 
2018-11-23 01:04:07.094 INFO [oracle.dicloud.agent.core.GGCCAgentInstallation] (oracle.dicloud.agent.core.GGCCAgentInstallation handleCreateInstance) Agent instance home created successfully at :/home/oracle/dicloud/agent/dipcagent001 
Enter DICLOUD Service Host :testadi-txlxfxnxcxcloxx2.adipc.ocp.oraclecloud.com
Enter DICLOUD Service Port :443
Enter IDCS server URL :https://idcs-e6f40c2d9qtden0cd69ee.identity.oraclecloud.com 
Enter agent IDCS Client scope :https://8123QTDEN5B4BF861.adipc.ocp.oraclecloud.com:443urn:opc:resource:consumer::all
2018-11-23 01:04:40.187 INFO [oracle.jps.common] (oracle.security.jps.JpsStartup start) Jps initializing. 
2018-11-23 01:04:44.212 INFO [oracle.jps.common] (oracle.security.jps.JpsStartup start) Jps started. 
Enter agent IDCS Client Id : 712e73eqtden6c4849004
Enter agent IDCS Client Secret : 
2018-11-23 01:05:05.790 INFO [global] (oracle.dicloud.agent.deployment.AgentDeployer buildAgentPropertiesFromTemplate) SSL is configured with default JDK Trust store here : /u01/app/12.2.0.1/grid/jdk/jre/lib/security/cacerts 
2018-11-23 01:05:05.794 INFO [global] (oracle.dicloud.agent.deployment.AgentDeployer buildAgentPropertiesFromTemplate) Default Trust-store was configured using default trust store unlock password. 
2018-11-23 01:05:05.797 INFO [global] (oracle.dicloud.agent.deployment.AgentDeployer buildAgentPropertiesFromTemplate) Need to change 'agentTrustStorePath' property in agent.properties for using a different Trust-store 
2018-11-23 01:05:05.799 INFO [global] (oracle.dicloud.agent.deployment.AgentDeployer buildAgentPropertiesFromTemplate) Use updateTrustStoreUnlockPassword.sh/bat utility to add the Trust-store unlock password to agent wallet. 
Enter Username:jvr.mgt@rcl.cm
Confirm Username:jvr.mgt@rcl.com
Enter password:
Confirm password:
2018-11-23 01:05:34.289 INFO [global] (oracle.dicloud.agent.deployment.AgentDeployer captureOdiCredentailsIfRequired) captureOdiCredentials ... Completed. 
2018-11-23 01:05:34.683 INFO [global] (oracle.dicloud.agent.deployment.AgentDeployer captureOdiCredentailsIfRequired) captureOdiCredentials ... Completed. 
2018-11-23 01:05:34.688 INFO [global] (oracle.dicloud.agent.deployment.DICloudAgentLifeCycleManager main) Agent Instance successfully created at : /home/oracle/dicloud/agent/dipcagent001 
2018-11-23 01:05:34.689 INFO [global] (oracle.dicloud.agent.deployment.DICloudAgentLifeCycleManager main) Start the agent using this startAgentInstance(.sh/.bat) script in : /home/oracle/dicloud/agent/dipcagent001/bin 
2018-11-23 01:05:34.690 INFO [global] (oracle.dicloud.agent.deployment.DICloudAgentLifeCycleManager main) Stop the agent using this stopAgentInstance (.sh/.bat) script in : /home/oracle/dicloud/agent/dipcagent001/bin 
2018-11-23 01:05:34.692 INFO [global] (oracle.dicloud.agent.deployment.DICloudAgentLifeCycleManager main) Agent configuration properties file is available at : /home/oracle/dicloud/agent/dipcagent001/conf/agent.properties 
2018-11-23 01:05:34.693 INFO [global] (oracle.dicloud.agent.deployment.DICloudAgentLifeCycleManager main) Refer the configuration file for more information on agent configuration. 
2018-11-23 01:05:34.694 INFO [global] (oracle.dicloud.agent.deployment.DICloudAgentLifeCycleManager main) If agent properties are edited then restart the agent for changes to take affect. 
checking if this is odiRemote setup or not...
Local DIPC agent setup mode. Hence, ignoring ODI set-up
[oracle@db dicloud]$ 


Let's start the agen for the first time:


[oracle@db dicloud]$ agent/dipcagent001/bin/startAgentInstance.sh 
AGENT_HOME : /home/oracle/dicloud/agent/dipcagent001/bin/../../oracle
2018-11-23 01:09:05.650:INFO::main: Logging initialized @1773ms
2018-11-23 01:09:06.078:INFO:oejs.Server:main: jetty-9.3.12.v20160915
2018-11-23 01:09:06.272:INFO:oejsh.ContextHandler:main: Started o.e.j.s.ServletContextHandler@6ca8564a{/dicloud,null,AVAILABLE}
2018-11-23 01:09:06.317:INFO:oejs.AbstractConnector:main: Started ServerConnector@718b8b0e{HTTP/1.1,[http/1.1]}{localhost:7005}
2018-11-23 01:09:06.321:INFO:oejs.Server:main: Started @2447ms
log4j:WARN No appenders could be found for logger (org.apache.http.client.protocol.RequestAddCookies).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
2018-11-23 01:09:16.190 NOTIFICATION GGCC-20071: Successfully verified basic connectivity to server.
2018-11-23 01:09:16.197 NOTIFICATION ID file NOT found in : /home/oracle/dicloud/agent/dipcagent001/conf/diaid Registering the agent...
2018-11-23 01:09:16.197 NOTIFICATION Building agent registration data ... 
2018-11-23 01:09:16.206 NOTIFICATION Building agent registration data ... ... AgentRegData [hostname=db.sub11130848550.atnetwork.oraclevcn.com, port=7005, agentVersion=18.3.5-SNAPSHOT, instanceName=dipcagent001, agentId=null, properties={goldenGateHost=localhost, goldenGatePort=7809, serverConnCheckIntervalSecs=10, ggCoreVersion=V_12_3_0, agentManagedBy=ONPREMISE, agentPlatform=Linux, agentUseSSL=true, agentTrustStorePath=/u01/app/12.2.0.1/grid/jdk/jre/lib/security/cacerts, agentInstanceInstallLocation=/home/oracle/dicloud/agent/dipcagent001, agentUserName=javier.mugueta@oracle.com, agentConnectors=CONN,ODI}]
2018-11-23 01:09:17.079 NOTIFICATION Registration post response : InboundJaxrsResponse{context=ClientResponse{method=POST, uri=https://testadi-telefonicacloud2.adipc.ocp.oraclecloud.com:443/dicloud/api/v1/registered/agents, status=200, reason=OK}}
2018-11-23 01:09:17.120 NOTIFICATION Agent Registration status : REGISTERED
2018-11-23 01:09:17.122 NOTIFICATION AgentIdentification ... Done. agentID: ec55e634-4ac1-4556-a877-7186a1c78149
2018-11-23 01:09:17.256 NOTIFICATION Successfully registered this agent for message subscription
ODIPlugin was not started as it was not configured
If this is Remote/On-Prem agent requires ODI, Run config script first

odipc13

Yes, there it is!

Enjoy:-)

 

 

 

 

 

 

 

 

Configuring backup storage in Oracle Database Cloud Service


analog audio backup broken
Photo by Anthony on Pexels.com

Latest releases of the DBCS service have changes in the way the backup configuration should be set.

Prior to creating the DBS instance prepare the following:

  • Log in OCI (gen2) user interface with a <user>, create a bucket in the object storage section and write down the name you gave as <bucketname>
  • obtain the name of the storage namespace bucket with the following command(you need OCI CLI installed but note that it is the same as identity domain name) as <namespace>:
    $ oci os ns get
    {
    "data": "txlxfxnxcxclxxd2"
    }
  • Construct an URL this way as <url>:
  • https://swiftobjectstorage.<region>.oraclecloud.com/v1/<namespace>/<bucketname>
    such as
    https://swiftobjectstorage.eu-frankfurt-1.oraclecloud.com/v1/txlxfxnxcxclxxd2/ATtestdb
  • Go to the Identity>Users section of the OCU user interface and, in the Auth Tokens section, create a token giving it a name and then copy the value generated as <password> [Note: user must belong to Administrators group]

Configure the backup with the values obtained previously and that’s it!

Enjoy 🙂

Installing Jenkins X on Oracle Kubernetes Engine (aka OKE)


architecture barge bay beach
Photo by Pixabay on Pexels.com

First, install this tool in local:

brew tap jenkins-x/jx 
brew install jx

Check here for installing the tool in other OS’s than MAC. And now issue this command to deploy on the k8s cluster of the oracle provider (oke):

jx install --provider=oke

Follow instructions and  command prompts and you’ll get them’all stuff installed if a few minutes:

MacBook-Pro-de-javi:~ javiermugueta$ jx install --provider=oke
Error loading team settings. Unable to locate dev environment resource definition in namespace default, No Environment called: dev or with selector: env=dev found 0 entries: []
...
If you don't have a wildcard DNS setup then setup a new CNAME and point it at: 46.66.16.31.nip.io then use the DNS domain in the next input...
? Domain 46.66.16.31.nip.io
nginx ingress controller installed and configured
Lets set up a Git username and API token to be able to perform CI/CD
? GitHub user name: javiermugueta
To be able to create a repository on GitHub we need an API Token
Please click this URL https://github.com/settings/tokens/new?scopes=repo,read:user,read:org,user:email,write:repo_hook,delete_repo
Then COPY the token and enter in into the form below:
? API Token: ****************************************
Updated the team settings in namespace jx
...
Error: creating the chrome client: timeout waiting for initial target
Please go to http://jenkins.jx.46.66.16.31.nip.io/me/configure and click Show API Token to get your API Token
Then COPY the token and enter in into the form below:
? API Token: **********************************
Created user admin API Token for Jenkins server jenkins.jx.46.66.16.31.nip.io at http://jenkins.jx.46.66.16.31.nip.io
...
Your Kubernetes context is now set to the namespace: jx 
To switch back to your original namespace use: jx ns default
For help on switching contexts see: https://jenkins-x.io/developing/kube-context/
To import existing projects into Jenkins:       jx import
To create a new Spring Boot microservice:       jx create spring -d web -d actuator
To create a new microservice from a quickstart: jx create quickstart

And here it is! Now you can even deep dive into the new Blue Ocean UI

jenkinsx.png

Enjoy 🙂

 

 

Install Zookeeper in Oracle Kubernetes Engine aka OKE ;-) in 20 minutes


blue white orange and brown container van
Photo by Pixabay on Pexels.com

If you don’t have one, first create a cluster. In the last version of the dashboard, you can find a new “QUICK CREATE” option that creates all the stuff from scratch easily.

oke2

oke1

Install helm following this link or in mac issue the following command:

brew install helm

Configure access to the cluster

 

Goto this page and follow instructions explained in there (helm chart), in short:

helm repo add bitnami https://charts.bitnami.com/bitnami 

helm install bitnami/zookeeper

Follow instructions for port forwardingInstall zkCli:, such as:

kubectl port-forward --namespace default svc/tufted-sheep-zookeeper 2181:2181

Install a client such as zkCli:

brew tap let-us-go/zkcli
brew install zkcli

Test it:

MacBook-Pro-de-javi:~ javiermugueta$ zkcli 

2018/11/08 00:03:40 Connected to 127.0.0.1:2181

>> create /FirstZnode “Myfirstzookeeper-app”
Created /FirstZnode
>>> get /FirstZnode 1
“Myfirstzookeeper-app”
cZxid = 0x6
ctime = Wed Nov 07 23:12:52 GMT 2018
mZxid = 0x6
mtime = Wed Nov 07 23:12:52 GMT 2018
pZxid = 0x6
cversion = 0
dataVersion = 0
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 26
numChildren = 0
>>> 

That’s it!

Enjoy 😉