Compare Difference Of Two Envs

Why it’s working in my server, but fails in yours? The question is quite common. After careful check and side-by-side test, we may or may not find out the difference. The root cause may be packages conflict, mismatched versions, corrupted files, or something magic.

How we can quickly detect the noticeable differences between two servers?

Compare Env Difference

Let’s examine the common differences:

  1. OS flavor. OS version may be different. Say the system may work on Ubuntu 14.04 64 bits, but fail on Ubuntu 12.04 32 bits. The server may have less memory than we expect, etc.
  2. Software Packages. Missing packages, extra packages installed which cause conflict, wrong version is installed, etc.
  3. Libraries. Wrong JDK version, some jar libraries are missing, etc.
  4. Config files. Incorrect setting in config files.

Luckily all those information can be achieved by multiple existing commands*. For example, we can get all OS details by probing /proc filesystem or commands like free/df/lscpu, etc. All softwares installed after OS installation can be found like this. Jar libraries usually are placed under the folder of $CLASSPATH, etc.

Apparently it demands a lot of learning and experience to get familiar with all these tools. Furthermore human is slow and error-prone.
What if we design a common line tool, to automate the check and compare process?*

  • Dump detail info into txt files
  • Different checks are categorized into typical scenario, like OS, Java, Python, etc.
  • Diff the generated list by category.

Here comes listospackages cli tool in Github. GitHub

Compare Env Difference

For better user experience, we can wrap up it as a Jenkins job: CompareMachinesAuditReport

Notice: You can find a live demo here.




PRs Welcome

Blog URL:

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.