pythontwistedfabrictwistd

fabric don't start twisted application as a daemon


I have written a simple automation script for deploying and restarting my twisted application on remote Debian host. But I have an issue with starting using twistd. I have a run.tac file and start my application as follows inside fabric task:

@task
def start():
    run("twistd -y run.tac")

And then just fab -H host_name start. It works great on localhost but when I want to start application on remote host I get nothing. I can see in log file that application is actually launched, but factory is not started. I've also checked netstat -l - nothing is listening my port. I've tried to run in non-daemon mode, like so twistd -ny run.tac, and, voila, factory started and I can see it in netstat -l on remote host. But that is not the way I want it to work cause it. Any help is appreciated.


Solution

  • There was an issue reported sometime back which is similar to this.

    It also suggested that it seems to succeed with the option pty=False. Can you try and check that?

    run("twistd -y run.tac", pty=False)
    

    Some more pointers from the FaQ: