Question

Assuming that I have the following directory structure for a Python project:

config/ scripts/ src/

where should a fabric deployment script should go? I assume that it should be in scripts, obviously, but for me it seems more appropriate to store in scripts, the actual code that fires up the project.

Was it helpful?

Solution

This is really a preference thing -- however there are a couple places I like, depending on situation.

Most frequently, and particularly in cases like yours where the fabfile is tied to a piece of software, I like to put it the project directory. I view fabfiles as akin to Makefiles in this case, so this feels like a natural place. (e.g. for your example, put the fabfile in the same directory holding config/ scripts/ and src/)

In other cases, I use fab for information gathering. Specifically I run a few commands and pull files from a series of servers. Similarly I initiate various tests on remote hosts. In these cases I like to set up a special directory for the fabfile (called tests, or whatever) and pull data to the relevant subdirectory.

Finally I have a few fabfiles I keep in $HOME/lib. These do some remote tasks that I frequently deal with. One of these is for setting up new pylons projects on my dev server. I have rpaste set up as an alias to fab -f $HOME/lib/rpaste.py. This allows me to select the target action at will.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top