Hi Andy, 

I've had the same problem when trying to start apache remotely using fabric and 
after some research on the web i found out that that's a problem with fabric's 
"run" command using pseudo-terminals(pty). The default behavior for "run" 
command is to use a pty in the remote machine so it doesn't interact directly 
with a remote machine terminal, and this causes some commands to run in a weird 
way, such as apache and pgbouncer i believe. Unfortunately i haven't been able 
to fully understand why fabric does this... if anyone have a good explanation, 
please share. 



Anyways, try setting "pty=False" in the run/sudo command. It should solve your 
problem. 

Regards, 





Marcelo Araújo Pontes 
Infra e Redes 







----- Mensagem original -----
De: "Andy Mroczkowski" <[email protected]> 
Para: [email protected] 
Enviadas: Domingo, 1 de Abril de 2012 22:24:06 
Assunto: [Fab-user] trouble with pgbouncer - SIGINT? 


Greetings. 


I'm trying to use fabric to set up a postgresql server with pgbouncer 
http://wiki.postgresql.org/wiki/PgBouncer roughly based on these instructions 
http://www.askthepony.com/blog/2011/07/django-and-postgresql-improving-the-performance-with-no-effort-and-no-code/
 . I have everything working except for actually starting the pgbouncer 
service. I have the following line in my fabfile: 


sudo("service pgbouncer restart") 


The output looks ok: 



[ubuntu@host] sudo: service pgbouncer restart 
[ubuntu@host] out: * Restarting pgbouncer pgbouncer 
[ubuntu@host] out: ...done. 


However, after fabric disconnects, pgbouncer is not running. It's log file 
reports: 



2012-04-02 00:53:56.205 22454 LOG File descriptor limit: 1024 (H:4096), 
max_client_conn: 100, max fds possible: 110 
2012-04-02 00:53:56.207 22456 LOG listening on 127.0.0.1:6432 
2012-04-02 00:53:56.208 22456 LOG listening on 
unix:/var/run/postgresql/.s.PGSQL.6432 
2012-04-02 00:53:56.208 22456 LOG process up: pgbouncer 1.4.2, libevent 
2.0.12-stable (epoll), adns: evdns2 
2012-04-02 00:54:03.904 22456 LOG Got SIGINT, shutting down 
2012-04-02 00:54:04.233 22456 LOG server connections dropped, exiting 


It seems like the service is starting, and then exiting almost immediately due 
to receiving a SIGINT. 


If I run the command manually from my local shell (without fabric) it works 
fine. No immediate shutdown due to SIGINT 


ssh -i key.pem ubuntu@host 'sudo service pgbouncer restart' 


I can only assume that somehow fabric is sending SIGINT (directly or 
indirectly), but I don't know a lot the fabric execution environment or UNIX 
signals/daemons in general. 


Any ideas? 


Thanks, 


- Andy 
_______________________________________________ 
Fab-user mailing list 
[email protected] 
https://lists.nongnu.org/mailman/listinfo/fab-user 
_______________________________________________
Fab-user mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/fab-user

Reply via email to