Fabric - Learning part1

Reading Time : ~ .

Finally here i am writing my first blog post after a long time to break silence in my techie brain.

Okay, lets start with the story, i can configure Linux production server with uwsgi, nginx, vsftpd, mysql, mongodb, postfix, php, python tools, and other relevant pieces of software single-handedly and i learnt it the hard way and do the hard way for granular performance and security. And there came a pseudo friend of mine asking me why didn't i do it with fabric which is awesome as i am python expert.

So, let me walk through my experience while i try it for first time.

first install fabric with pip

sudo pip install fabric

 

then use your favorite editor to create file called

fabfile.py

and save it with the following content.

 

def hello():
    print "Hello dolly"
now lets run it with
$ fab hello
hello dolly

Done.

wow we got it, so we need to keep all the code in fabfile.py (i think this is standard name with my current knowledge) and run functions in it by calling fab

ok, now lets pass some parameters to it

def hello(name="world"):
    print("Hello %s" % name)
$ fab hello:name=ashwin
hello ashwin

Done.

this is it for now, lets put it to real use in next part.

i am followed http://docs.fabfile.org/en/1.4.0/tutorial.html in this tutorial.

part 2 Go for it...

target="_blank"
    By Posted On
SENIOR DEVELOPER at MICROPYRAMID

Need any Help in your Project?Let's Talk

Latest Comments
Related Articles
Understanding Logstash Parsing Configurations and options Jagadeesh V

In This Tutorial we will learn to customize Logstash to parse any type of Log Files. Logstash helps us to process logs and other event ...

Continue Reading...
ELK Stack for Parsing your Logs- Part 2 Jagadeesh V

In Previous Tutorial we looked into Setting up EL Server which can ingest your Syslog files. In this Post, you will learn about pushing your ...

Continue Reading...
Setting Up Sentry - Web Application Event Tracking platform Jagadeesh V

When you want to track your exception and log mesages in a UI rather than storing it in a file(which we usually do), we can ...

Continue Reading...

Subscribe To our news letter

Subscribe to our news letter to receive latest blog posts into your inbox. Please fill your email address in the below form.
*We don't provide your email contact details to any third parties