From May 2019

Scheduling with Developer Cloud Service (DevCS) the Start/Stop Sequence of an Oracle Analytics Cloud (OAC) Instance


Oracle Developer Cloud Service (DevCS) is a CI/CD environment provided by Oracle for cloud customers. It is almost free, you only pay for the storage and the compute utilised when jobs are run.

Oracle Analytics Cloud (OAC) is a powerful and proactive reporting tool.

Builds

Builds are the well known tasks typical in Jenkins:

Start OAC Instance Job

Create a new build job, go to Configure->Steps, from the [Add Step] dropdown listbox select “PSMCli” and “Unix Shell”.

In the PSMCli step provide user, password, identity-domain id (the id, not the name), region and output format.

In the Unix Shell step put:

psm AUTOANALYTICSINST start-service -s [instancename]

Now click on the “Settings” icon (the gears), go to Triggers tab and configure the scheduling utilising cronjob format:

Stop OAC Instance Job

Do same steps than above, except for the command systax which is:

 psm AUTOANALYTICSINST start-service -s [instancename]

And if you need to execute jobs depending ones on the others, you can utilise pipelines!

CLUE

Create a build step, type one of the following and see the output (example):

psm help
psm [servicetype] help

Hope it helps! 🙂

Load Balancig, High Availability and Fail-Over of a Micro-Service Deployed in two Separated Kubernetes Clusters: one running in Oracle Kubernetes Engine (OKE) and the other in Google Kubernetes Engine (GKE)


Oracle Cloud Edge Services

Oracle Cloud Infrastructure provides Edge Services, is a group of services related with DNS, Health Checks, Traffic Management and WAF (Web Application Firewall).

In this episode we are utilising DNS Zone Management, Traffic Management Steering Policies and Health Checks for load balancing and fail-over of a micro-service running in two different Kubernetes clusters, in two different regions and distinct cloud providers, giving a robust solution that accomplishes a very powerful load balanced, active-active and disaster recovery topology.

Deploying the micro-service

Deploy the following to two different k8s clusters, such as OKE in two distinct regions or OKE and GKE. As OKE and GKE are petty much identical, we can use kubectl and Kubernetes Dashboard in both of them as we prefer:

k8s deployment in OKE visualised with Kubernetes kubectl
k8s deployment in OKE visualised with Kubernetes dashboard

It is a very simple service that greets you and says where is it running.

Greetings from OKE
Greetings from GKE

Configuring DNS

For this part of the setup we need a FQDN registered, we are using bigdatasport.org, a name registered by myself.

Let’s create domain entries in OCI. Create a DNS zone in OCI as follows:

Now, let’s grab the DNS servers and go to our Registrar and change the DNS’s configuration so that they point to Oracle DNS’s:

Verify the change:

Configuring Health Checks

Let’s create a Health Check that we’ll use later in the traffic management. Health checks are performed external to OCI from a list of vantage points executed in Azure, Google or AWS, select your preferred choice.

Configuring Traffic Management Steering Policies

Let’s create a traffic management policy as follows:

Testing it all

Ok, we have all the tasks already done, let’s test it!

Delete the deployment in OKE:

Go to the Traffic policy and verify that the OKE endpoint is unhealthy:

Go to your browser and request http://bigdatasport.org/greet, as you can see the service is retrieved from GKE:

Redeploy in OKE again:

As you can see, the OKE service is running well again:

Now let’s delete the deployment in GKE:

Now the greeting is retrieved again form OKE:

And that’s all folks, hope it helps! 🙂

Integrating DevCS Notifications with Slack Using WebHooks


One interesting thing regarding CI and DevOps is the ability to be notified when things happen without the need to log in a web app every hour and see what happened.

Oracle Developer Cloud Service (DevCS -a CI/DevOps tool from Oracle Cloud-) can be configured to send notifications to several channels, one of them is slack:

Let’s have a look how to configure it.

Slack Side Configuration

Ask our slack administrators to allow you install “Incoming Webhooks” app

Once you are allowed, install and configure “Incoming Webhooks”, selecting the slack channel you want the notifications to be sent to, name icon, attachments and the like. Finally, grab the Webhook URL for later.

DevCS Side Configuration

Go to DecCS, select a project and go to Administration/Webhooks

Create a new Webhook. Put in the field URL the url created in the slack configuration side and subscribe to the kind notifications you are interested in and clink on [Save]:

Click on [Test] button and verify a test message reaches the slack channel:

Now launch a build, create/edit an announcement or do whatever task that generates notifications and verify the notification reaches the channel:

That’s all, hope it helps! 🙂

Implementing Deploy Steps in DevCS Builds


Classic approach for deploying artefacts to Oracle Cloud Java and Application Container instances was utilising “Deployments”:

a3.png

There is a new option, now you can made deploys in build steps.

For doing that you must first create an “Environment”, watch this video to see how:

a4

After that, go to one of your builds and add an “Oracle Deployment” step:

a5.png

Now put the correct values the same way you did in the “classic” deployment, for example this is a setup for an ACCS deployment:

a6.png

And that’s all, you are done!

Last but not least, remember that you can get benefit of the PIPELINES feature and create visual workflows of steps of any king (compile, test, deploy,..)

a7.png

Hope it helps! 🙂

 

Moving Git Repo from DevCS “classic”to DevCS OCI (in fact you can import whatever git repository you have access to)


I recommend moving to the DevCS OCI “flavour”, it has many advantages. Fortunately is easy to import the repos.

First, click on [+Create Repository]

a1

Second, provide the information coming from the old repo, and click [Create] and in a better of seconds it is imported and you are done!

a2

Hope it helps! 🙂

 

 

Oracle Kubernetes (OKE): Deploying a Custom Node.js Web Application Integrated with Identity Cloud Service for Unique Single Sign On (SSO) User Experience


In this post we are deploying a custom Node.js web application in Oracle Kubernetes Engine (OKE).

What we want to show is how to configure the custom web application in order to have a unique Single Sing On experience.

First part

Follow this tutorial here explaining how to enable SSO to the web app running locally

Second part

Now we are making small changes to deploy on kubernetes

Create a Dockerfile in the nodejs folder of the cloned project with the following:
FROM oraclelinux:7-slim
WORKDIR /app
ADD . /app
RUN curl --silent --location https://rpm.nodesource.com/setup_11.x | bash -
RUN yum -y install nodejs npm --skip-broken
EXPOSE 3000
CMD ["npm","start"]
Create K8s deployment file as follows:
apiVersion: v1
kind: Service
metadata:
name: idcsnodeapp
spec:
type: LoadBalancer
selector:
app: idcsnodeapp
ports:
- name: client
protocol: TCP
port: 3000
Deploy to k8s:
kubectl apply -f service.yaml
Grab the url of the new external load-balancer service created in k8s and modify the file auth.js with the appropriate values in your cloud environment
var ids = {
oracle: {
"ClientId": "client id of the IdCS app",
"ClientSecret": "client secret of the IdCS app",
"ClientTenant": "tenant id (idcs-xxxxxxxxxxxx)",
"IDCSHost": "https://tenantid.identity.oraclecloud.com",
"AudienceServiceUrl" : "https://tenantid.identity.oraclecloud.com",
"TokenIssuer": "https://identity.oraclecloud.com/",
"scope": "urn:opc:idm:t.user.me openid",
"logoutSufix": "/oauth2/v1/userlogout",
"redirectURL": "http://k8sloadbalancerip:3000/callback",
"LogLevel":"warn",
"ConsoleLog":"True"
}
};
Build the container and push to a repo you have write access to, such as:
docker build -t javiermugueta/idcsnodeapp .
docker push javiermugueta/idcsnodeapp
Modify the IdCS application with the public IP of the k8s load-balancer service
a
Create k8s deployment file as follows:
apiVersion: apps/v1
kind: Deployment
metadata:
name: idcsnodeapp
labels:
app: idcsnodeapp
spec:
replicas: 1
selector:
matchLabels:
app: idcsnodeapp
strategy:
type: Recreate
template:
metadata:
labels:
app: idcsnodeapp
spec:
containers:
- image: javiermugueta/idcsnodeapp
name: idcsnodeapp
ports:
- containerPort: 3000
name: idcsnodeapp


Deploy to k8s
kubectl apply -f  deployment.yaml
Test the app and verify SSO is working:

This slideshow requires JavaScript.

Hope it helps! 🙂