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

Tuesday 21 January 2020

Dandeli - an Experience not to miss

When we hear about the name Dandeli, the immediate thought we get will be the river rafting experience. In India the number of places we have the river rafting is very limited and in the Southern part of India, this is the most famous place for rafting.  The actual Dandeli is a small town in northern Karnataka and the real fun is in the mountain ranges and places near the Supa Dam reservoir.  

It is preferable to stay at least two nights as it will provide a pleasant stay in a jungle resort and will give time for water activities and sightseeing.  There are plenty of homestay, resorts, and hotels in all budgets. Most of the stay will quote including the water activities package as it is the main attracting there and they have tie-ups with the conducting agencies. In Dandeli, the water activities won't be there all over the year, it depends on the flow of water from the dam. If it is too huge then water activities are too dangerous and will be canceled, so it is advisable to check in advance and plan the trip.

The climate in Dandeli is modest, not too hot or too cold but at night it will be very cold. The mobile network is not so good, only in some places, we get the network and in some places, we will not. We stayed in a stay called 'Greenland Junglestay', it is run by Joshi, a friendly guy help to plan the itineraries well to cover most of the places. Also, speak to him and you will get a good deal for your stay. This stay is having its own farmland where they cultivate pepper, betel nuts. Near to that, we have water stream flows all through the day.

Greenland Junglestay

Betel nuts 

Sunrise in the jungle

Water stream near the stay

Apart from water activities, we have places like the honey park, Supa Dam viewpoint, Syntheri rock, nature walk etc.,





Video