Home

Awesome

Hari Sekhon - DevOps Perl Tools

GitHub stars GitHub forks Lines of Code License My LinkedIn GitHub Last Commit

Codacy CodeFactor Quality Gate Status Maintainability Rating Reliability Rating Security Rating Vulnerabilities

Linux Mac Docker Dockerfile DockerHub Pulls DockerHub Build Automated StarTrack StarCharts

<!-- these badges don't work any more [![Docker Build Status](https://img.shields.io/docker/cloud/build/harisekhon/perl-tools?logo=docker&logoColor=white)](https://hub.docker.com/r/harisekhon/perl-tools/builds) [![MicroBadger](https://images.microbadger.com/badges/image/harisekhon/perl-tools.svg)](http://microbadger.com/#/images/harisekhon/perl-tools) -->

CI Builds Overview Jenkins Concourse GoCD TeamCity

CircleCI BuildKite AppVeyor Drone Codefresh Cirrus CI Semaphore Buddy Shippable Travis CI

Azure DevOps Pipeline GitLab Pipeline BitBucket Pipeline AWS CodeBuild GCP Cloud Build

Repo on GitHub Repo on GitLab Repo on Azure DevOps Repo on BitBucket

ShellCheck JSON YAML XML Validation Kics Grype Semgrep Semgrep Cloud Trivy

Docker Build (Alpine) Docker Build (Debian) Docker Build (Fedora) Docker Build (Ubuntu)

GitHub Actions Ubuntu Mac Mac 11 Mac 12 Ubuntu Ubuntu 20.04 Ubuntu 22.04 Debian Debian 10 Debian 11 Debian 12 Fedora Alpine Alpine 3

Perl versions Perl

git.io/perl-tools

Linux, Web, Anonymizer, SQL ReCaser, Hadoop, Hive, Solr, Big Data & NoSQL Tools

DevOps, Linux, SQL, Web, Big Data, NoSQL, templates for various programming languages and Kubernetes. All programs have --help.

Hari Sekhon

Cloud & Big Data Contractor, United Kingdom

My LinkedIn <br>(you're welcome to connect with me on LinkedIn)

Make sure you run make update if updating and not just git pull as you will often need the latest library submodule and possibly new upstream libraries

Quick Start

Ready to run Docker image

All programs and their pre-compiled dependencies can be found ready to run on DockerHub.

List all programs:

docker run harisekhon/perl-tools

Run any given program:

docker run harisekhon/perl-tools <program> <args>

Automated Build from source

installs git, make, pulls the repo and build the dependencies:

curl -L https://git.io/perl-bootstrap | sh

or manually

git clone https://github.com/HariSekhon/DevOps-Perl-tools perl-tools
cd perl-tools
make

Make sure to read Detailed Build Instructions further down for more information.

Optional: Generate self-contained Perl scripts with all dependencies built in to each file for easy distribution

After the make build has finished, if you want to make self-contained versions of all the perl scripts with all dependencies included for copying around, run:

make fatpacks

The self-contained scripts will be available in the fatpacks/ directory which is also tarred to fatpacks.tar.gz.

Usage

All programs come with a --help switch which includes a program description and the list of command line options.

Environment variables are supported for convenience and also to hide credentials from being exposed in the process list eg. $PASSWORD. These are indicated in the --help descriptions in brackets next to each option and often have more specific overrides with higher precedence eg. $SOLR_HOST takes priority over $HOST.

DevOps Perl Tools - Inventory

NOTE: Hadoop HDFS API Tools, Pig => Elasticsearch/Solr, Pig Jython UDFs and authenticated PySpark IPython Notebook have moved to my DevOps Python Tools repo

Linux

SQL

Written to help clean up docs and SQL scripts.

I don't even bother writing capitalised SQL code any more I just run it through this via a vim shortcut (.vimrc).

Web

Solr

Hadoop Ecosystem

Detailed Build Instructions

The make command will initialize my library submodule and use sudo to install the required system packages and CPAN modules. If you want more control over what is installed you must follow the Manual Setup section instead.

Perlbrew localized installs

The automated build will use 'sudo' to install required Perl CPAN libraries to the system unless running as root or it detects being inside Perlbrew. If you want to install some of the common Perl libraries such as Net::DNS and LWP::* using your OS packages instead of installing from CPAN then follow the Manual Build section below.

Manual Setup

Enter the tools directory and run git submodule init and git submodule update to fetch my library repo and then install the CPAN modules as mentioned further down:

git clone https://github.com/HariSekhon/DevOps-Perl-tools perl-tools
cd tools
git submodule update --init

Then proceed to install the CPAN modules below by hand.

CPAN Modules

Install the following CPAN modules using the cpan command, using sudo if you're not root:

sudo cpan JSON LWP::Simple LWP::UserAgent Term::ReadKey Text::Unidecode Time::HiRes XML::LibXML XML::Validate ...

The full list of CPAN modules is in setup/cpan-requirements.txt.

You can install the entire list of cpan requirements like so:

sudo cpan $(sed 's/#.*//' < setup/cpan-requirements.txt)

You're now ready to use these programs.

Offline Setup

Download the Tools and Lib git repos as zip files:

https://github.com/HariSekhon/DevOps-Perl-tools/archive/master.zip

https://github.com/HariSekhon/lib/archive/master.zip

Unzip both and move Lib to the lib folder under Tools.

unzip devops-perl-tools-master.zip
unzip lib-master.zip

mv -v devops-perl-tools-master perl-tools
mv -v lib-master lib
mv -vf lib perl-tools/

Proceed to install CPAN modules for whichever programs you want to use using your standard procedure - usually an internal mirror or proxy server to CPAN, or rpms / debs (some libraries are packaged by Linux distributions).

All CPAN modules are listed in the setup/cpan-requirements.txt file.

Configuration for Strict Domain / FQDN validation

Strict validations include host/domain/FQDNs using TLDs which are populated from the official IANA list. This is done via my Lib submodule - see there for details on configuring to permit custom TLDs like .local, .intranet, .vm, .cloud etc. (all already included in there because they're common across companies internal environments).

Updating

Run make update. This will git pull and then git submodule update which is necessary to pick up corresponding library updates.

If you update often and want to just quickly git pull + submodule update but skip rebuilding all those dependencies each time then run make update-no-recompile (will miss new library dependencies - do full make update if you encounter issues).

Testing

Continuous Integration is run on this repo with tests for success and failure scenarios:

To trigger all tests run:

make test

which will start with the underlying libraries, then move on to top level integration tests and functional tests using docker containers if docker is available.

Contributions

Patches, improvements and even general feedback are welcome in the form of GitHub pull requests and issue tickets.

You might also be interested in the following really nice Jupyter notebook for HDFS space analysis created by another Hortonworks guy Jonas Straub:

https://github.com/mr-jstraub/HDFSQuota/blob/master/HDFSQuota.ipynb

Star History

Star History Chart

git.io/perl-tools

More Core Repos

<!-- OTHER_REPOS_START -->

Knowledge

Readme Card Readme Card

<!-- Not support on GitHub Markdown: <iframe src="https://raw.githubusercontent.com/HariSekhon/HariSekhon/main/knowledge.md" width="100%" height="500px"></iframe> Does nothing: <embed src="https://raw.githubusercontent.com/HariSekhon/HariSekhon/main/knowledge.md" width="100%" height="500px" /> -->

DevOps Code

Readme Card Readme Card Readme Card Readme Card

<!-- [![Gist Card](https://github-readme-stats.vercel.app/api/gist?id=f8f551332440f1ca8897ff010e363e03)](https://gist.github.com/HariSekhon/f8f551332440f1ca8897ff010e363e03) -->

Containerization

Readme Card Readme Card

CI/CD

Readme Card Readme Card

DBA - SQL

Readme Card

DevOps Reloaded

Readme Card Readme Card Readme Card Readme Card Readme Card

Templates

Readme Card Readme Card

Misc

Readme Card Readme Card

The rest of my original source repos are here.

Pre-built Docker images are available on my DockerHub.

<!-- 1x1 pixel counter to record hits -->

<!-- OTHER_REPOS_END -->