DevOps

Managing database connections per browser sessions

Our servlet code creates a new database connection when a new session is created. This database connection is part of our DMSession object as a private variable m_conn. The DMSession object is stored against the session as follows: public static DMSession getInstance(HttpServletRequest request) { DMSession session = null; if ((session=(DMSession)request.getSession().getAttribute("session")) == null) { m_conn = DriverManager.getConnection(ConnectionString,dUserName,dPassword); m_conn.setAutoCommit(false); session = new DMSession(request.getSession().getServletContext()); request.getSession().setAttribute("session",session); } return session; } Using the getInstance we ensure that we only create Read more...

Microservices

docker shortcuts

I need to cleanup my containers frequently as part of developing and testing the code that is running inside them. I got tired of doing cut and paste of container and image ids. So I created a couple of shortcuts. First I created bash aliases to save some typing. alias dcrun="docker ps -a -q --filter="status=running"" alias dcall="docker ps -a -q" dcrun will print out the running container ids in a single column list dcall will Read more...

Microservices

Microservice Design and Management

Whats is a microservice? The way I think of a microservice is the same way I think of a Java or C++ object. The microservice is tries to hide all the gory details that make it up. All of the programming logic is in the microservice just like with object oriented (OO) programming. The objects expose just what the end user needs to know about. So thinking of a microservice as an object does make Read more...

Java Coding

Postgresql LISTEN NOTIFY events example

I have a need to get notified when a table has a row inserted into it. Once notified I can then go read additional data to complete my processing. The initial idea was to poll the database every 10 seconds to see if a new row was inserted. This polling would work but too much overhead. Looking around I found that Postgresql has LISTEN and NOTIFY statements that support the event handling I am looking Read more...

DevOps

Debugging Microservices

I am in the process of moving DeployHub Pro to microservices for our SaS offering and I ran into an interesting dilemma. Microservices are great for having small contained pieces of functionality for scalability and reuse. But the problem that I ran into is how to have a debug environment in Eclipse that is easy to use. Running microservices locally on my single machine requires that each microservice run in its own Tomcat instance. Each Read more...

Scripting

Production Quality Shell Scripting

Introduction Shell Scripts are often used on Linux and Unix machines to automate tasks. For stand-alone or one-off operations, it is not usually necessary to build production quality code. Who cares if it fails if the file system is full or temporary files are left lying around? The problem is that this devil-may-care attitude pervades a lot of shell script designs and these scripts can sometimes end up either in production code or delivering production Read more...

DevOps

Which one is better, Kubernetes or Netflix Eureka?

I have been doing some research on the differences between Netflix’s Eureka and Kubernetes. The main difference that I have found is that Eureka is focused on micro-services from the coding level. You write your code to work with Eureka and the other Netflix solutions in order to have a high available distributed application to micro-service solution. Kubernetes on the other hand focuses on Docker container orchestration. It worries about the number of containers running, Read more...

DevOps

Are micro-services and applications independent of each other?

Typically, micro-services are used for the back-end database interactions. For example, user profile micro-service would handle the Create, Retrieval, Update and Deletion of the user profile data. In theory, there should be one micro-service for each CRUD action. I find that this is to fine grained. Putting a functional box around the data makes it easier to handle in the long run. I approach micro-services as I do with Object Oriented (OO), encapsulating methods needed Read more...

Java Coding

Getting members of an LDAP Group using ldapsearch and Java

For this example we will be using the LDAP server provided by Forum Systems Online LDAP Test Server. Here is the ldapsearch command line: ldapsearch -W -h ldap.forumsys.com -D "cn=read-only-admin,dc=example,dc=com" -b "dc=example,dc=com" "ou=mathematicians" -W : Prompt for password -h : ldap server to use -D : is the binddn (userid to login to the ldap server with) -b : is the base search root and the last parameter is the search filter Results from the Read more...

DevOps

Salesforce Deployments for the Continuous Delivery Pipeline

Salesforce provides an Ant Toolkit that enables you to automate the deployment process. The Salesforce Ant Jar should be copied into the Ant Library directory so the salesforce task is picked up. The following properties are required: User Name, Password, Server URL and Test Level. <project name="DeployHub Salesforce Deploy" default="deployCode" basedir="." xmlns:sf="antlib:com.salesforce"> <property="sf.username" value="myusername" /> <property="sf.password" value="mypassword" /> <property="sf.serverurl" value="https://test.salesforce.com" /> <property="sf.testlevel" value="RunLocalTests" /> <taskdef resource="com/salesforce/antlib.xml" classPath="${ant.library.dir}/ant-salesforce.jar" uri="antlib:com.salesforce" /> <!-- Shows deploying code, running all Read more...