@@ -8,7 +8,8 @@ A puppet module for installing and managing uwsgi
88This module installs and configures [ uWSGI] ( http://uwsgi-docs.readthedocs.org )
99in [ Emperor mode] ( http://uwsgi-docs.readthedocs.org/en/latest/Emperor.html ) .
1010
11- It does not, currently, manage uwsgi applications (PRs welcome).
11+ It can also create and manage uwsgi applications that run under the emperor,
12+ which are best defined in hiera.
1213
1314Just about every option is configurable, so it should work on most distributions
1415by putting together a hiera file.
@@ -30,6 +31,9 @@ parameters.
3031 Package state.
3132 Default: 'installed'
3233
34+ If 'absent' or 'purged', then remove the ` service_file ` and ` config_file `
35+ also
36+
3337* ` package_provider `
3438 The provider to use to install the package.
3539 Default: 'pip'
@@ -97,8 +101,6 @@ parameters.
97101
98102#### Using Hiera
99103
100- Hiera can be (should be!) used to change any of the default uwsgi parameters.
101-
102104Sets up some custom options within the emperor config file:
103105
104106``` yaml
@@ -129,3 +131,85 @@ uwsgi::service_enable: false
129131uwsgi::install_pip : false
130132uwsgi::install_python_dev : false
131133` ` `
134+
135+ ## Defined Types
136+
137+ ### uwsgi::app
138+
139+ Responsible for creating uwsgi applications that run under the uwsgi emperor.
140+ You shouldn't need to use this type directly, as the ` uwsgi` class will
141+ automatically create all applications defined in hiera under the uwsgi::app
142+ key. See the hiera section below for examples.
143+
144+ # ### Parameters
145+
146+ * `ensure`
147+ Ensure the config file exists. Default : ' present'
148+
149+ * `template`
150+ The template used to construct the config file.
151+ Default : ' uwsgi/uwsgi_app.ini.erb'
152+
153+ * `uid`
154+ The user to run the application as. Required.
155+ May be the user name, not just the id.
156+
157+ * `gid`
158+ The group to run the application as. Required.
159+ May be the group name, not just the id.
160+
161+ * `application_options`
162+ Extra options to set in the application config file
163+
164+ # ### Using Hiera
165+
166+ Configure a django application :
167+
168+ ` ` ` yaml
169+ ---
170+ uwsgi::app:
171+ django:
172+ ensure: 'present'
173+ uid: 'django'
174+ gid: 'django'
175+ application_options:
176+ chdir: '/path/to/project'
177+ module: 'mysite.wsgi:application'
178+ socket: '/tmp/uwsgi_django.sock'
179+ master: 'True'
180+ vaccum: 'True'
181+ max-requests: '5000'
182+ buffer-size: '32768'
183+ processes: 4
184+ threads: 8
185+ ` ` `
186+
187+ Configure multiple applications (all yaml files are aggregated using
188+ `hiera_hash`) :
189+
190+ ` ` ` yaml
191+ # common.yaml
192+ ---
193+ uwsgi::app:
194+ django_1:
195+ ensure: 'present'
196+ uid: 'django'
197+ gid: 'django'
198+ application_options:
199+ chdir: '/path/to/project'
200+ module: 'mysite.wsgi:application'
201+ socket: '/tmp/uwsgi_django.sock'
202+
203+
204+ # role_app_server.yaml
205+ ---
206+ uwsgi::app:
207+ django_2:
208+ ensure: 'present'
209+ uid: 'django'
210+ gid: 'django'
211+ application_options:
212+ chdir: '/path/to/project2'
213+ module: 'mysite.wsgi:application'
214+ socket: '/tmp/uwsgi_django2.sock'
215+ ` ` `
0 commit comments