Archive for the tutorial Category

[just.few.tuts] golang ~ get local changes into GOPATH without pushing them upstream

Posted in AbhishekKr, Blogroll, tutorial with tags , , , , on March 4, 2014 by abhishekkr

justfewtuts.blogspot.in [3/Feb/2014]

http://justfewtuts.blogspot.in/2014/02/golang-get-local-changes-into-gopath.html

To get your local Golang repo’s sym-linked at your GOPATH and local changes available…

goenv_link(){
  if [ $# -ne 2 ]; then
    echo "Links up current dir to it's go-get location in GOPATH"
    echo "SYNTAX: goenv_linkme  "
    return 1
  fi
  _REPO_DIR=$1
  _REPO_URL=$2

  _TMP_PWD=$PWD
  cd $_REPO_DIR

  if [ -d "${GOPATH}/src/${_REPO_URL}" ]; then
    echo "$_REPO_URL already exists at GOPATH $GOPATH"
    go get "${_REPO_URL}"
    return 1
  fi
  _REPO_BASEDIR=$(dirname "${GOPATH}/src/${_REPO_URL}")
  if [ ! -d "${_REPO_BASEDIR}" ]; then
    mkdir -p "${_REPO_BASEDIR}/src"
  fi

  ln -sf "${PWD}" "${GOPATH}/src/${_REPO_URL}"
  go get "${_REPO_URL}"

  cd $_TMP_PWD
}

alias goenv_linkme="goenv_link $PWD"

…read full blogpost here

[just.few.tuts] go get pkg ~ easy made easier for project dependency management

Posted in AbhishekKr, Blogroll, tutorial with tags , , , , , , on March 4, 2014 by abhishekkr

justfewtuts.blogspot.in [5/Dec/2013]

http://justfewtuts.blogspot.in/2013/12/go-get-pkg-easy-made-easier-for-project.html

For past sometime I’ve been trying out ways to improve practices upon awesome capabilities from GoLang. One of the things have been having a ‘bundle install’ (for ruby folks) or ‘pip require -e’ (for python folks)  style capability… something that just refers to an text file part of source code and plainly fetches all the dependencies path mentioned in there (for all others).

It and some other bits can be referred here…
https://github.com/abhishekkr/tux-svc-mux/blob/master/shell_profile/a.golang.sh#L31

… …  …

What it do?

If ran without any parameters. It checks for current working directory for a file called ‘go-get-pkg.txt’. If not found creates one empty file by that name. To be done at initialization of project. If found, then it iterates through each line and pass it directly to “get get ${line}”. If ran with parameters. Each parameter is treated as path to files similar to ‘go-get-pkg.txt’ and similar action as explained previously is performed on each file.

Sample ‘go-get-pkg.txt’ file
-tags zmq_3_x github.com/alecthomas/gozmq github.com/abhishekkr/levigoNS github.com/abhishekkr/goshare

…read full blogpost here

[just.few.tuts] systemd enabled lightweight NameSpace Containers ~ QuickStart Guide

Posted in AbhishekKr, tutorial with tags , , , , , , , , , , on November 19, 2013 by abhishekkr

justfewtuts.blogspot.in [15/Nov/2013]

http://justfewtuts.blogspot.in/2013/11/systemd-enabled-lightweight-namespace.html

systemd (for some time now) provides a powerful chroot alternative to linux users for creating quick and lightweight system containers using power ofcgroups and socket activation.

There is a lot more to “systemd” than this, but that’s for some other post. Until then can explore it, starting here.

There is a utility “systemd-nspawn” provided by systemd which acts as container manager. This is what can be used to easily spawn a new linux container and manage it. It has been updated with (the systemd’s amazing trademark feature) Socket Activation.

This enables any container to make parent/host’s systemd instance to listen at different service ports for itself. Only when those service ports receive a connection, these container will spawn and act to it. Voila, resource utilization and scalability concepts.
More of this can read in detail at: http://0pointer.de/blog/projects/socket-activated-containers.html

Here we’ll see some way to quickly start using it via some custom made commands.

…..

…..

…..read full blogpost here

[tekwalk] Fabric (py orchestration util) issue with my FreeBSD node, and Easy Fix

Posted in Blogroll, tutorial with tags , , , , on September 22, 2013 by abhishekkr

@ tekwalk.blogspot.in [12/Aug/2013]

http://tekwalk.blogspot.in/2013/08/fabric-py-orchestration-util-issue-with.html

Recently…..

The way Fabric works is whatever you ask it to “run(<cmd>)” over remote nodes, it runs that command by passing it to ” bash -l -c ‘<cmd>’ “.
Now as the issue was with my FreeBSD machine is it didn’t had “bash” in the first place. So, it was failing.
It can be fixed in 2 ways
First way,
add a line like following to make Fabric use the SHELL present on the remote node, as FreeBSD node had ‘C Shell’… so

env.shell = ‘/bin/csh -c’

Second way,
install ‘bash’ on the remote nodes and make sure it’s reachable via path “/bin/bash”

pkg_add -r bash

ln -sf /usr/local/bin/bash /bin/bash

…..click here to read full post

[just.few.tuts] Puppet ~ Beginner’s Concept Guide (Part 4) Where Is My Data?

Posted in Blogroll, tutorial with tags , , , , , , , , , , , , , , , on August 2, 2013 by abhishekkr

justfewtuts.blogspot.in [26/July/2013]

http://justfewtuts.blogspot.com/2013/07/wip-puppet-beginners-concept-guide-part.html

Puppet
beginners concept guide (Part 4)

Where is my Data?

When I started my Puppet-ry, the examples I used to see had all configuration data buried inside the DSL code of manifests, people were trying to use inheritance to push down data. Then got to see a design pattern in puppet manifests keeping out separate parameters manifest for configuration variables. Then came along the External Data lookup via CSV files as a Puppet function. Then with enhancements in puppet and other modules came along more.

Below are few usable to fine ways utilizing separate data sources within your manifests,

Here, we will see usage styles of data for Puppet Manifests, Extlookup CSV, Hiera, Plug-in Facts and PuppetDB.

params-manifest:

It is the very basic way of separating out data from your functionality code, and the preferred way for in-future growing value-set type of data. It will keep it separate from the code since start.

…..

…..click here to read full post

[just.few.tuts] Testing Chaos with Automated Configuration Management solutions

Posted in Blogroll, tutorial with tags , , , , , , , , , , , , , , , , , on June 23, 2013 by abhishekkr

justfewtuts.blogspot.in [31/May/2013]

http://justfewtuts.blogspot.in/2013/05/testing-chaos-with-automated.html

…..That’s the shift. The logic developed for Infrastructure acts as a glue to all other applications created in house and 3rd party. Here in Infrastructure feature development there is more to test for the effect it has on the it’s users (software/hardware) and less on internal changes (dependencies and dynamic content). Now the stuff in parentheses here means a lot more than seems… let’s get into detail of it.

Real usability of Testing is based on keeping sanctity of WHAT needs to be tested WHERE.

Software/Hardware services that collaborate with the help of Automated Infrastructure logic needs major focus of testing. These services can be varying from the
  • in-house ‘Product’, that is the central component you are developing
  • 3rd Party services it collaborates with,
  • external services it utilizes for what it doesn’t host,
  • operating system that it supports and Ops-knows what not.
Internal changes mainly revolve around
  • Resources/Dependencies getting called in right order and grouped for specific state.
  • It also relates to correct generation/purging of dynamic content, that content can itself range as
    • non-corrupt configuration files generated of a template
    • format of sent configuration data from one Infra-component to another for reflected changes
    • dynamically creating/destroying service instances in case of auto-scalable infrastructure

One can decide HOW, on ease and efficiency basis.

Unit Tests work for the major portion of ‘Internal Changes’ mentioned before usingchefspecrspec-chefrspec-puppet like libraries are good enough. They can very well test the dependency order and grouping management…..

…..click here for full blogpost

[tekwalk] perform performance test using Multi-Mechanize

Posted in Blogroll, tutorial with tags , , , , , , , on June 23, 2013 by abhishekkr

tekwalk.blogspot.in [18/May/2013]

http://tekwalk.blogspot.in/2013/05/perform-performance-test-using-multi.html

What? multi-mechanize is an OpenSource load testing framework written and configurable in Python. So either make calls to any web service or simple import and utilize any python-accessible API/service.
It’s successor of an old Python load testing framework called Pylot.

Developed and maintained @GitHub

Install available through ‘pip’ too as
pip install multi-mechanize
It also requires matplotlib library if you wanna view Graphs in the generated HTML report (or otherwise), BUT it’s not mandatory as the framework would perform all tests fine with an import error for matplotlib.

This also follows a……

…..click here for full blogpost