The reason behind this issue is that if you are using git with ssh protocol it tries to use your private key to perform git operations over ssh protocol & the location it expects is the .ssh folder at home directory of user. To fix this issue you have to create a HOME environment variable and point to your home directory where your .ssh folder exists after that restart Jenkins & now it should work fine.
Category: DevOps
Linux Utility to manage login to systems
The usual approach for this problem is to maintain a reference file, from where you map machine name with the ip & find the ip of the box from this file, but again after some time this solution seems to be not that efficient. Another solution is to have a DNS server where you can store such mappings & then you can access these machines using their names only, this is the idle solution but what if you don’t have DNS server also still you have to execute the ssh command ‘ssh user@machine”.
I developed a simple solution for this problem, I created a utility script connect.sh, this script takes machine name as an argument & then we have multiple conditions statements which checks which ssh command to be executed for the machine name.
#!/bin/bash
if [ “mc1” == $1 ]; then
ssh user@
elif [ “mc2” == $1 ]; then
ssh user@
elif [ “mc3” == $1 ]; then
ssh user@
.
.
.
fi
This solution worked really well for me as now I’m saved from executing whole ssh command, also for machine name I’ve followed a convention i.e _ for example the entry for a machine for release environment that is hosting an application catalog the machine name would be release_catalog, similarly dev_catalog, staging_catalog, pt_catalog.. so you don’t have to remember machine names as well :).
Automated DB Updater Release First Release
With this blog I’m releasing the intial version of a python utility to provide automated db updates across various environments for different components.
The code for this utility is hosted on github
https://github.com/sandy724/ADU
You can clone the read only copy of this codebase by url given below
https://github.com/sandy724/ADU.git
To understand the basic idea about this utility go thorugh this blog
http://sandy4blogs.blogspot.in/2013/07/automated-db-updater.html
How to use this utility
Checkout the code at some directory, add the path of this directory in PYTHONPATH environment variable
Create a database with a script’s metadata table with given below ddl
CREATE TABLE `script_metadata` (
`name` varchar(100) DEFAULT NOT NULL,
`version` int(11) DEFAULT NOT NULL,
`executed` tinyint(1) NOT NULL DEFAULT ‘0’,
`env` varchar(30) DEFAULT NOT NULL,
`releas` varchar(30) DEFAULT NOT NULL,
`component` varchar(30) DEFAULT NOT NULL
)
Create a database.properties, containing connection properties of each environment database
Here common_db represents connection to database which will contain metadata of scripts for monitoring
Now execute the pythong utility
Copy the client(updateDB.py) to directory of your choice, make sure that property configration file should also be at this directory
python updateDB.py -f -r –env
Automated DB Updater
In continuation with my blog series I’m finally introducing a automated db updater tool. You can read about the idea in previous blogs by going .
The short form of my tool is ADU(Automated DB Updater). Now some details about this tool
Each application will have database_script folder at the root level, this folder will contain folders corresponding to each release i.e release1, release2, release3…
A database release folder will contain
- Meta file :sql_sequence.txt, this file will contain the sequence in which sql files will be executed, only files mentioned in this file will be entertained
- SQL Files : A sql file must have a naming convention like this __.sql/__.sql
Process of automatic execution of scripts on an environment
- Input
- release_name : to figure out the folder from where scripts will be executed
- environment : Environment on which scripts will be executed
- Execution
- sql_sequence.txt file will be read line by line having one sql file name in each line
- The sql file will be verified whether it has been already executed or not
- If the sql file is already executed then two conditions are verified
- A new version of sql should be available
- Undo version of last executed sql should be present
- After execution of undo file the latest version of the sql file will be executed and the info is stored accordingly that it has been executed so that it will not be picked again
- Validations & Boundary Conditions
- All the files mentioned in sql_sequence.txt should exist.
- Undo script should be present for all the versions of a sql file barring the latest version of sql file.
- Undo script will only be executed if next version of script is available.
Very soon I’ll share the github url of this project keep waiting 🙂
Ubuntu Rest Assurer
So what this utility does
1.) It runs after every half hour or configured amount of time
2.) Prompts a snoozer dialog box which will allow a person to snooze the screen locking for some amount of time
3.) After that a lunching video will run for 10 seconds
4.) Once a lunching video completes the screen gets locked for a configured amount of time
5.) If user try to unlock the system before configured amount of time the utility will lock the screen again
This complete utility is created using shell script only, we have used couple of command to do that
vlc : To run a launcher video
zenity : To prompt a snooze dialogue box
gnome-screensaver-command : To operate on screen lock
You can find the source code of this utility at my github account
https://github.com/sandy724/REAS