Click here to Skip to main content
Click here to Skip to main content

Push2Linux - A Mass Unix Deploy Tool

, 11 Dec 2012 CPOL
Rate this:
Please Sign up or sign in to vote.
An Understanding of what it does and how it can help.....

Introduction   

Push2Linux is a deploy tool or rather a mass deploy tool. Consider attempting to deploy a piece of software across 500 Unix/Linux devices and the possible time involved doing it manually. This is where Push2Linux comes in – it tries to simplify the process by managing the deploy of the code for you. This is also a very handy tool for a developer especially in testing.

Features 

  1. Deploy software across a single or a large subset of hosts
  2. Execute commands remotely across multiple unixes devices from one location
  3. Execute a script remotely across multiple unix devices
  4. Customize installation to fit your needs with a bash shell script
  5. Restart Services of multiple hosts

How it works? 

Let’s try understand how we can leverage Push2Linux by looking at various scenarios:

Scenario 1: Execute Command Across A Host

Assume we have Web Server  and we need to restart the ‘Apache Web Service’ on it. In Diagram A below, you can just add in the host name, username and password and then the exact command you would like to execute. In this case we will issue a service restart for Apache.

  

[Diagram A]  

Scenario 2: Execute Command Across Multiple Hosts 

Firstly you going to need to create a CSV file to be used as the configuration file (input). The format is displayed below,

<ip/hostname>, <username>, <password>

 

 [Diagram B] 

Let’s say I wanted to get the log file for multiple devices and have the log emailed to my address, using this handy one-liner and Push2Linux, this is no problem.

echo "This is the message body" | mutt -a file.to.attach -s "subject of message" recipient@domain.com 

 

 [Diagram C]  

Just click - Deploy and you done! 

Scenario 3: Install and setup Software on Multiple Hosts 

In the third scenario, let us assume we have some custom software we have written in Java or Ruby and we would like to deploy it across a mass of hosts. We obviously create our CSV file, adding in the devices and their authentication details.

Following along with Diagram D, we tick the ‘Use Zipped Archive’ checkbox. That will provide you with the following options:

  1. Archive: a zip compressed file (no spaces in name) containing the files or software you would like to deploy. PS. This needs to include the setup script for your planned installation, in this case it’s called setup.sh.
  2. Copy to Archive: is the remote location to which the files will be copied on the remote host and from where you will commence to execute your setup script.
  3. Checkbox Unzip: This is used if the file you are attaching is Zip compressed
  4. Checkbox Script: This is important to take note off. If this is unticked that means the file attached is just a script (a bash script) which Push2Linux will SCP across, and then execute using the Command Option with full path. 

[Diagram D] 

Lastly the Command Option below is the full path the script file you would like to execute. 

Points of Interest  

This is the basics of Push2Linux, a mass deploy tool. I’ve also built in asynchronous call back to kill connections when they are taking too long. I noticed on some larger deployments that SCP/SSH on certain machines hang or never return. Though rare, the Push2Linux should take care of this. 

Attached is full source code with Project File, including Installer.  

Requirements for Remote Hosts:

  1. Dos2Unix  - used to convert scripts to unix format unless control characters from windows will break script execution
  2. Unzip/Zip 

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Dane Balia
Software Developer (Senior) Senwes
South Africa South Africa
Hacking at code.....
Follow on   Twitter   Google+

Comments and Discussions

 
-- There are no messages in this forum --
| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.141223.1 | Last Updated 11 Dec 2012
Article Copyright 2012 by Dane Balia
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid