Reputation: 133
I have just started to use Fabric to automate our most basic python deployments, and a part of our stack is a jobs server that uses rq (http://python-rq.org/) as our queue solution on top of redis. For some reason that I can not explain, the rq-dashboard and rqworker commands will not start inside of fabric. I can copy/paste the exact line that Fabric is using and it works just fine, but it fails in Fabric.
The Fabric code looks like this:
env.activate = '. /src/venvs/appvenv/bin/activate'
@task
def deploy_jobs_box():
with cd(repo_dir):
with show('debug'):
with shell_env(APP_ENV='development'), prefix(env.activate):
run("rq-dashboard > /dev/null 2>&1 &")
run("rqworker > logs/rqworker.log 2>&1 &")
I've tried every variation of running the rq commands inside of a script, etc, that I can think of, and none of them work. oddly enough, if I do put them in a script (with just those lines), and include a "ps aux | grep rq" at the end, I see the rq processes...but once the fab script finishes, and I check the box, the processes are gone.
any help at all would be appreciated, thank you.
Upvotes: 0
Views: 260
Reputation: 133
I needed to use nohup (http://linux.101hacks.com/unix/nohup-command/), as was helpfully pointed out by nvie, author of rq, here: https://github.com/nvie/rq/issues/444#issuecomment-62519088
so:
nohup rq-dashboard > /dev/null 2>&1 & nohup rqworker > logs/rqworker.log 2>&1 &
in the run commands solves this problem.
thanks nvie.
Upvotes: 2