Oleg Tsarev
Oleg Tsarev

Reputation: 146

How to right distribute python application which based on python-fabric

My application has a python script for control a farm of linux hosts. More precisely, I have a clustered database management system. The script implements the routine tasks for controlling the cluster -- start nodes, stop nodes, get status of nodes, etc.

Right now the script is written in python with just the standard python libraries. It uses paramiko for access to remote hosts by ssh. It is very ugly, and useless for developers and maintainers of the script.

I want switch to python-fabric.

My problem is: how do I correctly write the scripts and pack it into a distribution (packages, tar.gz, etc)?

The primary application build-system is CMake, and uses the configure_file statement to generate my script from a template, with substitution of full paths to the C++ application, libraries, etc.

I want the build script to:

  1. Create a separate environment using virtualenv
  2. Install pip in the separate environment
  3. Install fabric in the separate environment
  4. Run the "activate" script generated by virtualenv and call stuff from it

What are the disadvantages of this solution? What other solutions can you propose?

Upvotes: 1

Views: 438

Answers (1)

mayhewr
mayhewr

Reputation: 4021

I think you are not getting any responses because your question is too vague.

Fabric is a tool that simplifies automating ssh commands. You can do any of the things you listed in essentially the exact same way you would from the command line via run() in fabric. It is a great tool.

virtualenv new_env becomes run('virtualenv new_env') for instance. As far as packing is concerned, you can pack it in the same way you pack any python package (with a setup.py file).

If you are keen on simplifying your builds/deployments, start using fabric and come back here if you run into any problems the documentation doesn't cover.

Upvotes: 1

Related Questions