Posts

Automatically Deploying to Google Appengine from Github using Cloud Build

Image
When it comes to CI/CD pipeline, Jenkins is one of the popular tools that a lot of software companies use. With google cloud build one can build and deploy their app right from source repository like GitHub to AppEngine. It's a pay as you go service. However the first 120 build-minutes per day is free, so one can very easily try for their side projects where the deployment frequency is not more than a few times a day. However its always a good idea to limit your billing account and have alerts on usage in case it goes over the free tier due to some build stuck and running indefinitely. Here we will take an example of a go based appengine standard project.

First, to have Cloud Build be able to deploy to appengine we need to give the service account it's going to use the roles that are required.

Find the project id

NUM=$(gcloud projects describe $PROJECT \ --format="value(projectNumber)") && echo ${NUM}
Derive the service account name from the project id and as…

Google Cloud Study Jams 2019, Hyderabad Week 3

Image
After successful week 1 and week 2, it was time for week 3 of the Cloud Study Jam Hyderabad 2019. It was a full day event where participants were supposed to do labs from the Qwiklabs quest Baseline: Data, ML, AI with a lot of labs starting from Big Data services from GCP like BigQuery, CloudSQL, Dataproc to NLP APIs and Dataprep to ML Engine. More time was dedicated to this session on purpose. To make a data-driven decision we (GDG Hyderabad) had recently posted a poll and asked the community about the topics they are interested in.

Which topic would you love to learn from @googlecloud study jams? #StudyJam19#CloudStudyJam19#GDG#GoogleCloud#GoogleCloudFacilitator#GoogleCloudStudyJam#Hyderabad — GDG Hyderabad (@gdg_hyd) February 13, 2019


And as expected there were more participants in this session than last time. After talking to few participants it seemed a lot of them are already doing machine learning but they were looking for running it cloud to take full advantage of its elastic…

Google Cloud Study Jams 2019, Hyderabad Week 2

Image
After the massive opening week of Cloud Study Jam last week. We had a great week 2 with follow up sessions on Google Cloud SDK, Appengine, CloudSQL, CloudFunction, Cloud Datastore etc. I was the primary instructor in this session, so I have been looking forward to this day for a while. Like last time the attendance again beat out expectation. The retention rate was beyond our imagination. It shows not only that the 1st week was really successful but also people are genuinely interested to learn about the cloud.

Kudos! Wonderful to witness great retention at @googlecloud Study Jam #Hyderabad 2019 - [Week 2 - Deploy & Develop] session. #CloudStudyJams#CloudStudyjams19@gcdc_hyd@GoogleDevsINpic.twitter.com/t1xTig45JW — GDG Hyderabad (@gdg_hyd) March 9, 2019 From the quick survey, it turned out most of them already completed the week 1's quest - GCP essentials or at least completed the parts which are pre-requisite for this session or just to get started with Google Cloud Platfor…

Google Cloud Study Jams 2019, Hyderabad Week 1

Image
Last Saturday we had the 1st session of Google Cloud Study Jams in Hyderabad.



Website
Week 1 Meetup
Slack

ThoughtWorks,, Hyderabad hosted us and they will be hosting the subsequent sessions lined up on next few Saturdays as well.
#Cloud#StudyJams kickstarted in style! Kudos to all those developers for taking their time out off a busy weekend to learn #GCP#CloudML#BigQuery and lot of interesting stuff over next few weeks.
Special thanks to @ThoughtWorks#Hyderabad team for being an amazing host for us!! pic.twitter.com/7ElukjGKCA — Uday Mannam (@UdayMannam) March 2, 2019
Thank you, everyone, for attending our first ever @googlecloud study jam in #Hyderabad in collaboration with @gcdc_hyd & @qwiklabs 😀. Looking forward to seeing you all for the Week 2 - #Deploy & #Develop#CloudStudyJams Photos: https://t.co/CyZ5FyAWsOpic.twitter.com/i73j9VhdVP — GDG Hyderabad (@gdg_hyd) March 2, 2019
This session was all about introducing Study Jams to the developers and get started with the GCP e…

Profiling Java application in Google Appengine Flex

Image
There are a lot of ways java applications can be profiled for memory and CPU to find memory leaks or any culprit block of code where the app spends most of the time. In Google AppEngine Flex the application code (jar or war) runs inside a docker container which in turn runs inside a VM dedicated a service/module. While Google Cloud Profile can be used for analysing live applications it only supports CPU profiling when it comes to Java in AppEngine flex. Memory profiling is supported for Java only in AppEngine standard and python and go in AppEngine flex. So as of now, one has to profile the memory in JVM manually.
SSH to the AppEngine instance If you have Editor role you can ssh to the specific appengine flex instance using gcloud utility. You can connect to the instance by clicking on the SSH button against the instance in the instances page in the appengine GCP console.
 SSH to the instance
$ gcloud --project "demoneil" app instances ssh "aef-default-20190225t133842-…

Container Registery and Minikube

In the previous post, we saw how to create a docker image out of a simple gradle/spring boot app and run it locally. In this post, we will push it to a container registry and use it to deploy it in a kubernetes cluster

Upload to Registry 

I created an account in Docker Hub and did a "docker login" in the command line with my credentials.

docker push neilghosh/gradle-spring-boot-app:latest
Note docker CLI bu default talks to Docker Hub, however one can log in to other container registries e.g. GCP's GCR or Azure's ACR by prefixing the image name with the fully qualified registry login URL.

Install and Setup Minikube
We can run Kubernetes locally using Minikube, this gives us the opportunity to develop/deploy/test quickly before we deploy into remote cluster available in GKE or AKS. Minikube uses a virtualization software like Virtual Box to deploy its containers

Download Virtual Box

Install Minikube
curl -Lo minikube https://storage.googleapis.com/minikube/releases/late…

Quick Microservice With Gradle Spring Boot Docker

A few years ago if you would have asked me to create a quick POC backend service with some rest APIs I would have just picked up NetBeans and created the REST APIs using jersey/glassfish (reference implementation of JSR 311 RESTful Web Services) from the UI itself. While the above is an example of creating REST APIs bottom-up from the Database layer, once can plug business logic by adding few more java classes or a service layer. Lately, I have been using Spring Boot a lot in production and it really makes the developer's life easy by not having to write a lot of boilerplate code. Annotations take care of Dependency injection, singleton, REST API mappings etc. It even has the embedded Jetty web server to run the service locally without really having to install a bulk of binary like Glassfish/Tomcat server and deploy them (comes integrated with Netbeans tough - one could right click…