Bug 156723 - [patch] www/uwsgi: improved rc.d script
Summary: [patch] www/uwsgi: improved rc.d script
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Daniel Gerzo
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-29 18:50 UTC by Lukáš Lalinský
Modified: 2011-07-25 17:20 UTC (History)
0 users

See Also:


Attachments
file.txt (3.84 KB, text/plain)
2011-04-29 18:50 UTC, Lukáš Lalinský
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Lukáš Lalinský 2011-04-29 18:50:11 UTC
I needed to run multiple uWSGI instances and defining a number of "profiles" seemed like the best option. This is similar to what databases/slony1v2 uses. For example, in /etc/rc.conf I can have the following settings:

uwsgi_enable="YES"
uwsgi_profiles=yserver1 server2"
uwsgi_server1_flags="..."
uwsgi_server2_flags="..."

And the rc.d script will now manage two uWSGI instances, each of them can be individually restarted/reloaded/etc. If the uwsgi_profiles is not set, the current variables are used instead.

The attached patch contains the following changes:

     - Don't kill all uwsgi processes with SIGKILL, kill only the master
       process with SIGINT and let it terminate its children gracefully.
    
     - Use SIGHUP for the reload command and add a new command brutalreload
       (I'd have used forcereload but that's already taken) that sends the
       SIGTERM signal. http://projects.unbit.it/uwsgi/wiki/uWSGISignals
    
     - Add support for running multiple uwsgi instances with different
       configurations. With no profiles, everything works as before. When you
       define the uwsgi_profiles variable, it will read the names from there
       and try to load also variables uwsgi_<profile>_<option>. The script will
       perform specified actions on all profiles, unless you specify an extra
       argument in which case it will be performed only on this profile.
       For example, the following command will only reload the "django" profile:

I did the changes mainly for myself, but I thought it could be useful to other people.

Fix: Patch attached with submission follows:
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2011-04-29 18:50:21 UTC
Responsible Changed
From-To: freebsd-ports-bugs->danger

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 dfilter service freebsd_committer freebsd_triage 2011-07-25 17:16:04 UTC
danger      2011-07-25 16:15:50 UTC

  FreeBSD ports repository (doc committer)

  Modified files:
    www/uwsgi            Makefile 
    www/uwsgi/files      uwsgi.in 
  Log:
  - install uwsgidecorators.py as well [1]
  - improve the rc.d script - allow multiple instances etc (see PR) [2]
  
  PR:             ports/156723 [2]
  Submitted by:   Luka Lalinsky <lalinsky@gmail.com> [2]
  Requested by:   Attila Nagy <bra@fsn.hu> [1]
  
  Revision  Changes    Path
  1.13      +4 -1      ports/www/uwsgi/Makefile
  1.3       +59 -5     ports/www/uwsgi/files/uwsgi.in
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 3 Daniel Gerzo freebsd_committer freebsd_triage 2011-07-25 17:17:18 UTC
State Changed
From-To: open->closed

- committed, thank you very much for your submission!