Friday, November 23, 2018

Simple shell script to check whether a process is running or not, if not it will start it

I need a simple shell script to check whether a process is running or not, if not it will start it.

Here in this example, i am checking my node process.

if ! pgrep -x "node" > /dev/null
   nohup start.js &


Tuesday, November 20, 2018

Project Helidon - microservice framework for Java

Project Helidon, an open source, lightweight microservices framework for Java. It supports the MicroProfile technology and is intended to make it easier to develop microservices. Helidon has a collection of Java libraries for writing microservices that will run on a web core powered by the Netty framework. Helidon supports cloud application developments along with health checks, metrics, tracing, and fault tolerance.  Helidon has what you need to write cloud ready applications that integrate with Prometheus, Zipkin and Kubernetes. It is also compatible with all IDEs with no special plugins required. Developers need JDK9 or JDK8, Maven 3.5 and any IDE they prefer to start with Helidon.

Java EE is a stable technology but it has a lot of legacy code. Instead of building microservices on top of Java EE, a new framework which is designed to build microservices from the scratch. That's how Helidon was born. Helidon provides configuration and security for the development of microservices.

What are the most common use cases for Helidon?
Helidon is designed for creating Java microservices. So if you’re a Java developer and you’re writing microservices, then Helidon is a great choice. It’s unique in that provide a way for Java EE developers to use familiar APIs (with our MicroProfile support), but also have the option to explore or use the leaner set of APIs provided by Helidon SE. This helps to improve developers productivity.

Helidon development team is working to integrate on GraalVM support, as it saves money for customers. It will make application start and run faster. Running faster means servicing more requests per instance. Servicing more requests means you need fewer instances. Fewer instances means less money. 

Helidon is packaged in two versions:

- Helidon SE, a lightweight microframework developed in a reactive way. JDK (Java SE Development Kit) serves as the runtime.
- Helidon MP, a MicroProfile implementation providing a development experience familiar to Java EE and Jakarta EE developers. It serves as a runtime for microservices.

What’s next for Helidon?
As part of the Helidon 1.0 release, there will be Oracle Cloud integration with CDI extension, also team have some plan to add a Reactive HTTP client. Inspide of this team is looking at adding support for NoSQL, Eventing and OpenAPI.

Documentation :

Tuesday, October 23, 2018

When delete a pod in kubernetes, it respawn the same again


When we delete a pod using kubectl command, it get respawn automatically. This is one of the feature of Kubernetes.

[root@compute-instance1 ~]# kubectl get pods | grep ImagePullBackOff
quickstart-se-68d7ffb868-l7pvk                    0/1       ImagePullBackOff   0          12m

[root@compute-instance1 ~]#

How to solve this?

[root@compute-instance1 ~]# kubectl get all
This command will list down all the details.

[root@compute-instance1 ~]# kubectl delete deploy/quickstart-se svc/quickstart-se
deployment "quickstart-se" deleted
service "quickstart-se" deleted
[root@compute-instance1 ~]#

This helps to delete that particular pod from K8s.

Thursday, October 18, 2018

Error starting host: Error getting state for host: machine does not exist

Error when starting minikube after a delete

C:\Windows\System32>minikube start
Starting local Kubernetes v1.10.0 cluster...
Starting VM...
E1018 10:37:54.731596    8556 start.go:174] Error starting host: Error getting state for host: machine does not exist.

E1018 10:37:54.750682    8556 start.go:180] Error starting host:  Error getting state for host: machine does not exist


Solution to fix this error:

1. Change the folder to your .minikube (for me its C:\Users\shvijai\.minikube\cache\iso)
2. Delete the minikube iso file
3. Try minikube start

It works.

Wednesday, October 17, 2018

No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?

Error when i do "mvn package"

No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?

I am not using any IDE, i am using my cmd prompt. My java version is 1.8 and maven version is 3.5

1. Got to your project folder and find the pom.xml file
2. Find the line having "<artifactId>maven-compiler-plugin</artifactId>"
3. Add the following line (based on your java location path)

<executable>C:\Program Files\Java\jre1.8.0_181\bin\javacpl.exe</executable>


4. Save the pom.xml
5. Run "mvn package", it will work.

Wednesday, September 26, 2018

Compare Wercker and Jenkins

Here, I am trying to explore the features of Wercker and Jenkins. Its clear that the Jenkins has a good end-user count, and it can install in your local networks.

Here is a high level comparison

  • Wercker’s Open Source CLI tool enables developers to do much of the rapid iteration in a build/test/deploy model without leaving their local development environment, the Wercker CLI runs the same core tech of our online SaaS product so developers can move toward achieving dev/prod parity. Jenkins is a do-anything box. You have to spend time setting it up to do Docker runs, including keeping your build environment clean.
  • Wercker Pipelines enables full build, test and deployment pipelines to be executed, with Docker as a first class citizen, everything runs in a docker container and artifacts can be docker containers. In Jenkins we need to add slave node pools. The jobs will run on these nodes.
  • Wercker Releases is a private Docker registry that allows you to store your Docker container images on Oracle Cloud Infrastructure for fast, scalable retrieval and deployment. Wercker container registry is fully Integrated with Wercker pipelines and clusters. In Jenkins, we need to add and configure the registry.
  • Wercker clusters is a fully managed Kubernetes engine running on high performance Oracle Cloud Infrastructure. Tightly coupled to Wercker Releases and Pipelines. Clusters is dynamically scalable from one dashboard on the Wercker interface. For Jenkins, we need to manually configure to scale automatically.
  • Wercker is extensible and can be more deeply integrated in to other parts of the application development process. In the case of Jenkins, we need to depend on plugins and these plugins may not be the exact use case for us.

  • Wercker is based on simple yml instructions using our community of public steps (that don't need to be downloaded, installed). In Jenkins we need to learn groovy scripting

  • In Wercker your configuration is stored in your application repo rather than in a dedicated Jenkins repo which makes the project more portable and easier to on board new devs.