mirror of https://github.com/zulip/zulip.git
[manual] Use the same socket across server restarts
We let supervisor create the socket for us by making humbug-django a fcig-program. Unfortunately, supevisor doesn't support putting fcgi-programs in groups (see https://github.com/Supervisor/supervisor/issues/148), so we have to restart tornado and django separately. To deploy, copy the config files over and restart nginx and supervisor (via stopping and then starting it because restart is broken). I believe the automated restart as part of update-deployment will fail because of the way supervisor treats programs in groups. If so, after restarting supervisor, you will also need to run restart-server manually to fill the caches and then delete the lock directory in humbug-deployments. (imported from commit bfb5db7dd42dcbc4bfefa2944355b3cbb2ef9104)
This commit is contained in:
parent
f69762e612
commit
cce8dfab84
|
@ -30,6 +30,6 @@ location ~ /json/get_updates|/api/v1/get_messages|/api/v1/messages/latest|/json/
|
||||||
# Send everything else to Django via FastCGI
|
# Send everything else to Django via FastCGI
|
||||||
location / {
|
location / {
|
||||||
include fastcgi_params;
|
include fastcgi_params;
|
||||||
fastcgi_pass unix:/home/humbug/humbug-deployments/current/fastcgi-socket;
|
fastcgi_pass unix:/home/humbug/humbug-deployments/fastcgi-socket;
|
||||||
fastcgi_split_path_info ^()(.*)$;
|
fastcgi_split_path_info ^()(.*)$;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
; Note: shell expansion ("~" or "$HOME") is not supported. Environment
|
; Note: shell expansion ("~" or "$HOME") is not supported. Environment
|
||||||
; variables can be expanded using this syntax: "%(ENV_HOME)s".
|
; variables can be expanded using this syntax: "%(ENV_HOME)s".
|
||||||
|
|
||||||
[program:humbug-django-fcgi]
|
[fcgi-program:humbug-django]
|
||||||
command=python /home/humbug/humbug-deployments/current/manage.py runfcgi socket=/home/humbug/humbug-deployments/current/fastcgi-socket daemonize=False maxchildren=20 ; the program (relative uses PATH, can take args)
|
command=python /home/humbug/humbug-deployments/current/manage.py runfcgi daemonize=False maxchildren=20 ; the program (relative uses PATH, can take args)
|
||||||
;process_name=%(program_name)s ; process_name expr (default %(program_name)s)
|
;process_name=%(program_name)s ; process_name expr (default %(program_name)s)
|
||||||
;numprocs=1 ; number of processes copies to start (def 1)
|
;numprocs=1 ; number of processes copies to start (def 1)
|
||||||
;directory=/tmp ; directory to cwd to before exec (def no cwd)
|
;directory=/tmp ; directory to cwd to before exec (def no cwd)
|
||||||
|
@ -38,6 +38,9 @@ stderr_logfile_backups=10 ; # of stderr logfile backups (default 10)
|
||||||
;environment=A=1,B=2 ; process environment additions (def no adds)
|
;environment=A=1,B=2 ; process environment additions (def no adds)
|
||||||
;serverurl=AUTO ; override serverurl computation (childutils)
|
;serverurl=AUTO ; override serverurl computation (childutils)
|
||||||
directory=/home/humbug/humbug/
|
directory=/home/humbug/humbug/
|
||||||
|
socket=unix:///home/humbug/humbug-deployments/fastcgi-socket
|
||||||
|
socket_owner=humbug:humbug
|
||||||
|
socket_mode=0700
|
||||||
|
|
||||||
[program:humbug-tornado]
|
[program:humbug-tornado]
|
||||||
command=python /home/humbug/humbug-deployments/current/manage.py runtornado localhost:9993
|
command=python /home/humbug/humbug-deployments/current/manage.py runtornado localhost:9993
|
||||||
|
@ -103,9 +106,6 @@ directory=/home/humbug/humbug/
|
||||||
; create one or more 'real' group: sections to create "heterogeneous"
|
; create one or more 'real' group: sections to create "heterogeneous"
|
||||||
; process groups.
|
; process groups.
|
||||||
|
|
||||||
[group:humbug-web]
|
|
||||||
programs=humbug-django-fcgi,humbug-tornado ; each refers to 'x' in [program:x] definitions
|
|
||||||
|
|
||||||
[group:humbug-workers]
|
[group:humbug-workers]
|
||||||
programs=humbug-events-user-activity,humbug-events-subscribe-new-users,humbug-events-confirmation-emails,humbug-events-missedmessage_reminders ; each refers to 'x' in [program:x] definitions
|
programs=humbug-events-user-activity,humbug-events-subscribe-new-users,humbug-events-confirmation-emails,humbug-events-missedmessage_reminders ; each refers to 'x' in [program:x] definitions
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,9 @@ subprocess.check_call(["python", "./manage.py", "send_stats", "incr", "events.se
|
||||||
# the other worker processes.
|
# the other worker processes.
|
||||||
logging.info("Killing daemons")
|
logging.info("Killing daemons")
|
||||||
subprocess.check_call(["supervisorctl", "stop", "humbug-workers:*"])
|
subprocess.check_call(["supervisorctl", "stop", "humbug-workers:*"])
|
||||||
subprocess.check_call(["supervisorctl", "restart", "humbug-web:*"])
|
subprocess.check_call(["supervisorctl", "stop", "humbug-django"])
|
||||||
|
subprocess.check_call(["supervisorctl", "restart", "humbug-tornado"])
|
||||||
|
subprocess.check_call(["supervisorctl", "start", "humbug-django"])
|
||||||
subprocess.check_call(["supervisorctl", "start", "humbug-workers:*"])
|
subprocess.check_call(["supervisorctl", "start", "humbug-workers:*"])
|
||||||
|
|
||||||
logging.info("Flushing memcached")
|
logging.info("Flushing memcached")
|
||||||
|
|
Loading…
Reference in New Issue