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?
Let’s examine the common differences:
- 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.
- Software Packages. Missing packages, extra packages installed which cause conflict, wrong version is installed, etc.
- Libraries. Wrong JDK version, some jar libraries are missing, etc.
- 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.
For better user experience, we can wrap up it as a Jenkins job: CompareMachinesAuditReport
Notice: You can find a live demo here.
Blog URL: https://www.dennyzhang.com/compare_envs