Hi list,

First, thank you very much for providing uwsgi.  I'm using it since
nearly 3 years for my applications, and I've seen constant progress
and improvements.  The Debian package is also great (although it
doesn't support pidfile2 but this is another story).

Let me explain a usecase we have at my company, for providing
hot-reload to Python developers.

In /etc/uwsgi/apps-enabled I request Chef to generate one app config
for each developer.  Here is the Chef template I use:

{
    "uwsgi": {
        "touch-reload": <%= (Dir.glob(@app_dir + "/*/*.py") +
Dir.glob(@app_dir + "/*.py") + Dir.glob(@app_dir + "/ui/*/*.tmpl") +
Dir.glob(@app_dir + "/ui/*.tmpl")).inspect %>,
        "module": "server:application",
        "pythonpath": <%= [@app_dir + "/core"].to_json %>,
        "uid": "www-data",
        "gid": "www-data"
    }
}

As you can see, I use the ruby globbing functions to generate the list
of touch files and instruct Uwsgi to reload all files that are part of
the project, as the developer may change any of them anytime.

This is working great when we're working on this pre-defined set of
files. The list may contain thousands of entries, but it doesn't
appear to be a problem for uwsgi to monitor so many files.

However, when the developer checkouts another branch in Git, the set
of files differs, and of course reloading may not happen.  Also, it's
very annoying that uwsgi complains with "unable to stat" as soon as
one of the touch-files disappears.  When checking out a new branch
many files may disappear, so uwsgi will log gigabytes of such
messages.

So uwsgi's touch-reload is great and allows to save a lot of time
during development, but I would like it to be a little smarter:
instead of hardcoding the list of touch files in the app
configuration, I'd like to specify my globbing patterns directly in
the config file, so that uwsgi computes the list of touch files at
startup, and recomputes it at reload of course.

Something like this:

{
    "uwsgi": {
        "touch-reload-patterns": ["/my/app/dir/src/*/*.py",
"/my/app/dir/src/*.py", "/my/app/dir/ui/*/*.tmpl",
"/my/app/dir/ui/*.tmpl"],
        "module": "server:application",
        "pythonpath": <%= [@app_dir + "/core"].to_json %>,
        "uid": "www-data",
        "gid": "www-data"
    }
}

WDYT?
-- 
Jean-Baptiste Quenot
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to