File tree 8 files changed +71
-42
lines changed
8 files changed +71
-42
lines changed Original file line number Diff line number Diff line change 5
5
become : true
6
6
vars :
7
7
app_user : ubuntu
8
+ uwsgi_apps :
9
+ - api-production
10
+ - api-testing
11
+ - husky-musher
8
12
9
13
tasks :
10
14
- import_tasks : tasks/apt-update.yaml
29
33
name : prometheus
30
34
state : reloaded
31
35
32
- - name : uwsgi is restarted
33
- service :
34
- name : uwsgi
35
- state : restarted
36
-
37
- - name : uwsgi is reloaded
38
- service :
39
- name : uwsgi
40
- state : reloaded
41
-
42
36
- name : promtail is restarted
43
37
service :
44
38
name : promtail
Original file line number Diff line number Diff line change 1
1
[Unit]
2
2
Description =Prometheus uWSGI exporter for %i
3
- After =uwsgi.service
4
- BindsTo =uwsgi.service
3
+ After =uwsgi@%i .service
4
+ BindsTo =uwsgi@%i .service
5
5
6
6
[Service]
7
7
User =prometheus
Original file line number Diff line number Diff line change
1
+ [Unit]
2
+ Description =uWSGI server for %i app
3
+ Before =multi-user.target
4
+ Before =graphical.target
5
+ After =remote-fs.target
6
+ After =network-online.target
7
+ Wants =network-online.target
8
+ Wants =prometheus-uwsgi-exporter@%i.service
9
+
10
+ [Service]
11
+ ExecStart =/usr/bin/uwsgi --ini /etc/uwsgi/base.ini --ini /etc/uwsgi/apps-available/%i.ini
12
+ ExecReload =/bin/kill -HUP $MAINPID
13
+ RuntimeDirectory =uwsgi/app/%i
14
+ # Newer versions of systemd export RUNTIME_DIRECTORY automatically, but not the
15
+ # version we have.
16
+ Environment =RUNTIME_DIRECTORY =%t/uwsgi/app/%i
17
+ User =www-data
18
+ Group =www-data
19
+ Restart =on-failure
20
+ KillSignal =SIGQUIT
21
+ Type =notify
22
+ NotifyAccess =all
23
+
24
+ [Install]
25
+ WantedBy =default.target
Original file line number Diff line number Diff line change
1
+ [uwsgi]
2
+ ini = /opt/backoffice/id3c-production/uwsgi.ini
Original file line number Diff line number Diff line change
1
+ [uwsgi]
2
+ ini = /opt/backoffice/id3c-testing/uwsgi.ini
Original file line number Diff line number Diff line change
1
+ [uwsgi]
2
+ ini = /opt/backoffice/husky-musher/uwsgi.ini
Original file line number Diff line number Diff line change
1
+ # Originally based on the Ubuntu defaults in /usr/share/uwsgi/conf/default.ini.
2
+ # Expects to be run under the systemd [email protected] template.
3
+ [uwsgi]
4
+ # try to autoload appropriate plugin if "unknown" option has been specified
5
+ autoload = true
6
+
7
+ # enable main process manager
8
+ master = true
9
+
10
+ # start a couple worker/child processes by default
11
+ processes = 2
12
+
13
+ # automatically stop child procs when the main proc goes away
14
+ no-orphans = true
15
+
16
+ # app and stats sockets
17
+ socket = $(RUNTIME_DIRECTORY)/socket
18
+ stats = $(RUNTIME_DIRECTORY)/stats
19
+ chmod-socket = 660
20
+
21
+ # place timestamps into log
22
+ log-date = true
Original file line number Diff line number Diff line change 5
5
- uwsgi
6
6
- uwsgi-plugin-python3
7
7
8
- - name : uwsgi is enabled
9
- service :
10
- name : uwsgi
11
- enabled : yes
12
- state : started
13
8
14
9
- name : uwsgi base config exists
15
10
copy :
16
- remote_src : true
17
- src : /usr/share/uwsgi/conf/default.ini
11
+ src : files/etc/uwsgi/base.ini
18
12
dest : /etc/uwsgi/base.ini
19
- force : no
20
- backup : yes
21
-
22
- - name : uwsgi base config enables stats
23
- community.general.ini_file :
24
- path : /etc/uwsgi/base.ini
25
- section : uwsgi
26
- option : stats
27
- # See the comments in /etc/uwsgi/base.ini (as copied from the original
28
- # source above) for where these %(…) substitutions come from.
29
- value : /run/uwsgi/%(deb-confnamespace)/%(deb-confname)/stats
30
- backup : yes
31
- notify :
32
- - uwsgi is reloaded
13
+ owner : root
14
+ group : root
15
+ mode : ugo=r
33
16
34
- - name : uwsgi default invocation is configured
35
- lineinfile :
36
- path : /etc/default/uwsgi
37
- regexp : ' ^INHERITED_CONFIG='
38
- line : ' INHERITED_CONFIG=/etc/uwsgi/base.ini'
39
- notify :
40
- # Restart not reload since the actual options used to invoke uWSGI changed,
41
- # not just the contents of its config files.
42
- - uwsgi is restarted
17
+ - name : uwsgi app configs exists
18
+ loop : " {{ uwsgi_apps }}"
19
+ copy :
20
+ src : " files/etc/uwsgi/apps-available/{{ item }}.ini"
21
+ dest : /etc/uwsgi/apps-available/
22
+ owner : root
23
+ group : root
24
+ mode : ugo=r
43
25
44
26
- name : uwsgi app logs readable by adm group
45
27
file :
You can’t perform that action at this time.
0 commit comments