Wednesday, 27 January 2021

IAM - Oracle Cloud Infrastructure - Architect Associate(1Z0-1072-20)

 Oracle Cloud Infrastructure Architect Associate exam tests varieties of topics like

  1. Identity and Access Management
  2. Networking
  3. Compute 
  4. Storage
  5. Database
A good place to learn about the topics are


And there is a book specifically written for the exam and is available in Oreilly

In this blog, I am sharing the notes I have taken for the topic 



Identity and Access Management (IAM)

Tuesday, 26 January 2021

Installing Ubuntu in Lenovo ideapad 130 laptop

Ubuntu is one of the most popular free Operating System and it contains lots of packages which makes it ideal for day to day operation.

If we want to have ubuntu alongside the windows OS then we can follow these steps

  • Ensure we have a separate partition in HDD other than the one where Windows is installed for installing Ubuntu OS. If there is only one partition available in the system follow the steps in the link to create a separate partition

https://www.businessinsider.com/how-to-partition-a-hard-drive-in-windows-10

  • The next steps are to prepare a USB stick with Ubuntu OS

https://ubuntu.com/tutorials/create-a-usb-stick-on-windows#1-overview

  • Now we need to insert the USB and reboot the machine and follow the onscreen instruction

https://ubuntu.com/tutorials/install-ubuntu-desktop#1-overview

Saturday, 3 October 2020

Trip to Tharangambadi during unlock 4.0

 It is the time where the whole world is facing a challenge against the Covid-19 virus and almost all countries went into the lockdown period from the beginning of 2020 and gradually unlock started. As we all know that unlock is for the economy to boost and not that we are free of Covid-19. As a citizen, we all have followed the lockdown restriction imposed by the government by staying at the home and avoiding any unnecessary travel including travel to a destination, exploration, visiting public places etc., 

 Humans are a social animal and it is very difficult to lock ourselves from the outside world for a very long time without any recreation. At the same time, we should behave responsibly during the unlock period by following the social distancing, wearing a mask, cleaning the hands often etc. With this in mind, we planned for a very short day trip to Tharangambadi as we heard this beach will be less crowded than its counterpart Karaikal beach. 

About Tharangambadi

The history dates back to 17th century when Danish came to India for trading, they built a fort for housing governers, merchants etc. To date, the fort is maintained very well and today it contains lots of old artifacts. It has a good beach with a park, restaurants nearby. 

Reaching Tharandambadi

We started from Kumbakonam and we wanted to enjoy the journey itself and not just the beach in Tharangambadi.  There are multiple different directions to reach the place from Kumbakonam but we chose the direction via Aduthurai - Porayar Rd https://goo.gl/maps/d3pcog4kqX5PxdEw9 . The nice thing about the road is that 45 km out of 58 km will be road next to the riverbank making the journey more pleasant and joyful. To our advantage this year the Cauvery catchment had huge rainfall and all the dams were overflowing and all through our journey we were seeing the full flow of water and kids were playing in the group along the side of steps in the riverbank.

Museum in the fort complex


Behind is the river

Baniyan tree on the river bank


In the beach

Fort



Tuesday, 29 September 2020

Docker tagging using REST API

Adding additional tags to the image will be a common process in the CICD world, the additional tags would be something like the build number, test result, etc.,

When adding multiple tags it will be very heavy if we are doing the tagging locally and then pushing the tagged image to the server. So instead of doing like that, we can use the docker HTTP REST API which will be lighting fast tagging and will add the tag to the remote docker repository

Below is the example of tagging an image in a remote repository using python

def addAssociatedTag(imageName, tag, associatedTag, bearerToken):
    header = {'Authorization': ''}
    header['Authorization'] = 'Bearer ' + bearerToken
    header['Accept'] = 'application/vnd.docker.distribution.manifest.v2+json'
    res = requests.get(
            url="https://docker.io/v2/" + imageName + "/manifests/" + tag,
            headers=header)
    print('Retrieved the metifests status is ' + str(res.status_code))   
    # Add the associated tag by passing the same manifests
    header['Accept'] = '*'
    res = requests.request(
            "PUT",
            url="https://docker.io/v2/" + imageName + "/manifests/" + associatedTag,
            headers=header,
            data=res.content)      
    response_status = res.status_code
    print('Adding associated tag for ' + imageName + ':' + tag + ' with ' + imageName + ':' + associatedTag + ' is = ' + str(response_status))
    return response_status

In the above, the setting the 'Accept' header is very important while getting the manifests. If we do not set it to 'application/vnd.docker.distribution.manifest.v2+json'then we will have the default 'application/json' which will not be correct when we use the content for adding the associated tags and we will get below error

{
    "errors": [
        {
            "code": "MANIFEST_LAYER_UNKNOWN",
            "message": "blob unknown to registry",
            "detail": {
                "digest": "sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4"
            }
        }
    ]
}


Details about other docker REST APIs are in https://github.com/venkatesh-mohanram/continuous-learning/blob/master/docker/httpapiv2.md

Friday, 25 September 2020

To know a Docker image exists with REST API

 Most of the time when it comes to docker, we play with using the CLI with 'docker' command. If we want to pull an image, tag an image, push an image we do all that with CLI only. However, apart from CLI, the docker repository supports varieties of REST API to do plenty of things and here I am planning to cover a few things like below

Manifest resource

The manifest rest resource can be used in a way how we want, for eg: if we want to know whether the image exists with a given tag then we can use the GET method of it

def checkAlreadyPresent(imageName, tag, bearerToken):
    auth_header = {'Authorization': ''}
    auth_header['Authorization'] = 'Bearer ' + bearerToken
    res = requests.get(
            url="https://docker.io/v2/" + imageName + "/manifests/" + tag,
            headers=auth_header)
    return res.status_code


You can also refer to

https://github.com/venkatesh-mohanram/continuous-learning/blob/master/docker/httpapiv2.md




Friday, 4 September 2020

mvn dependency:tree - rescuer during build issues

Maven is one of the very good build tools and is still popular among many users. Even though we use it for a long time, we use to remember or use only a limited number of its commands like 'mvn clean install', 'mvn package', mvn test' etc

we get to know many of its commands only when we face issues, one of the nice command is the 'mvn dependency:tree' to get all the dependencies including the transitive dependencies we have. In this blog, I am going to talk about this particular command

We should execute the below command from the folder where we have the pom.xml file

$ mvn dependency:tree

This will print all the dependencies from the root till the last jar, this will help to identify what are the transitive dependencies that we have.

We have varieties of options to fix the transitive deps error, 

1. Add the transitive dependency into <exclusions> list

If you have control over the dependency then you can do one of the following

2.  make the transitive deps in the provided scope https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Scope

Sunday, 15 March 2020

03 Kubernetes Secret for storing Oracle ATP wallet

Kubernetes Secret are used to store secrets during the setup of the cluster and then we can mount the same inside the docker containers. In this example, I am using it to store the Oracle ATP wallet which is used to talk to the ATP instance


kubectl create secret generic db-user-pass 
        --from-file=./cwallet.sso 
        --from-file=./ewallet.p12 
        --from-file=./keystore.jks 
        --from-file=./ojdbc.properties 
        --from-file=./sqlnet.ora 
        --from-file=./tnsnames.ora 
        --from-file=./truststore.jks


This is using the command line, apart from that even we can have a Secret Kind file similar to Deployment Kind and set it up using the 'kubectl apply'.

After this, we need to mount the secret as a volume and use it inside the container

apiVersion: v1
kind: Deployment
metadata:
  name: addition-svc-deployment
  labels:
    name: addition-svc
spec:
  volumes:
  - name: secret-volume
    secret:
      secretName: db-user-pass
  containers:
  - name: addition-svc-container
    image: addition-svc:latest
    volumeMounts:
    - name: secret-volume
      readOnly: true
      mountPath: "/etc/secret/atp-wallet"

Other links:
http://venkateshbook.blogspot.com/2019/05/kubernetes-commands.html
http://venkateshbook.blogspot.com/2019/05/kubernetes-yaml-definitions.html
http://venkateshbook.blogspot.com/2019/05/02-kubernetes-service-definition.html