aboutsummaryrefslogtreecommitdiffstats
path: root/conf/unit/afm-unit-debug.conf.in
blob: f7e37a27af07ae17be0cbd8ca72229680d26738d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
;---------------------------------------------------------------------------------
; File:
;
;    afm-unit.conf
;
; Mode:
;
;    DEVEL
;
; Role:
;
;    Configure how installation of widget produces unit files for systemd
;
; Processing and format:
;
;    1. File load
;
;           Lines beginning with ; are firstly removed
;
;    2. File instantiation
;
;           Mustache (extended) substitutions are applied using JSON
;           data deduced from config.xml file of the widget.
;
;    3. Extraction of units
;
;           Extract produced units, pack it (remove empty lines and directives)
;
; Directives:
;
;    Any directive occupy one whole line starting with %
;
;     - %nl
;
;             produce an empty line at the end
;
;     - %begin systemd-unit
;     - %end systemd-unit
;
;             delimit the produced unit
;
;     - %systemd-unit user
;     - %systemd-unit system
;
;             tells the kind of unit (user/system)
;
;     - %systemd-unit service NAME
;     - %systemd-unit socket NAME
;
;             gives the name and type of the unit
;
;     - %systemd-unit wanted-by NAME
;
;             tells to install a link to unit in the wants of NAME
;
; Setting variables:
;
;    AFM uses the feature of systemd that completely ignores options prefixed
;    with X-
;
;    Consequently, options starting with X-AFM- are recorded as public data
;    about the application and options starting starting with X-AFM-- are
;    recorded as private data.
;
;    Examples:
;
;        X-AFM-description={{description}}
;
;              Records the description of the unit in the field "description"
;              of both the public and private object describing the unit.
;
;        X-AFM--wgtdir={{:#metadata.install-dir}}
;
;              Records the installation directory path in the field "wgtdir"
;              of the private object only.
;
;---------------------------------------------------------------------------------
{{#targets}}
;---------------------------------------------------------------------------------
;----         M A I N    P A R T    O F   T H E   S E R V I C E               ----
;---------------------------------------------------------------------------------
%begin systemd-unit
# auto generated by wgtpkg-unit for {{:id}} version {{:version}} target {{:#target}} of {{:idaver}}
%nl
%systemd-unit system
%systemd-unit service afm-{{#required-permission.urn:AGL:permission::public:hidden}}service{{/required-permission.urn:AGL:permission::public:hidden}}{{^required-permission.urn:AGL:permission::public:hidden}}appli{{/required-permission.urn:AGL:permission::public:hidden}}-{{:id}}--{{:ver}}--{{:#target}}@
[Unit]
Description={{description}}
X-AFM-description={{description}}
X-AFM-name={{name.content}}
X-AFM-shortname={{name.short}}
X-AFM-id={{idaver}}{{^#target=main}}@{{:#target}}{{/#target=main}}
X-AFM-version={{:version}}
X-AFM-author={{author.content}}
X-AFM-author-email={{author.email}}
X-AFM-width={{width}}
X-AFM-height={{height}}
{{#icon}}
X-AFM-icon={{:#metadata.install-dir}}/{{:src}}
{{/icon}}
X-AFM--ID={{:id}}
X-AFM--target-name={{:#target}}
X-AFM--content={{content.src}}
X-AFM--type={{content.type}}
X-AFM--wgtdir={{:#metadata.install-dir}}
X-AFM--workdir=/home/%i/app-data/{{:id}}
%nl
Requires=afm-user-session@%i.target
After=user@%i.service
# Adds check to smack
ConditionSecurity=smack
%nl
# Automatic bound to required api
{{#required-binding}}
{{#value=extern}}
BindsTo=afm-link-{{name}}@%i.service
After=afm-link-{{name}}@%i.service
{{/value=extern}}
{{/required-binding}}
{{#required-api}}
{{#value=auto|ws}}
BindsTo=afm-api-{{name}}@%i.service
After=afm-api-{{name}}@%i.service
{{/value=auto|ws}}
{{/required-api}}
{{#provided-api}}
{{#value=ws|auto}}
Requires=afm-api-{{name}}@%i.socket
After=afm-api-{{name}}@%i.socket
{{/value=ws|auto}}
{{/provided-api}}
%nl
[Service]
EnvironmentFile=-@afm_confdir@/unit.env.d/*
SmackProcessLabel=User::App::{{:id}}
SuccessExitStatus=0 SIGKILL
User=%i
Slice=user-%i.slice
#CapabilityBoundingSet=
#AmbientCapabilities=
{{#required-permission.urn:AGL:permission::platform:no-oom}}OOMScoreAdjust=-500{{/required-permission.urn:AGL:permission::platform:no-oom}}
{{#required-permission.urn:AGL:permission::partner:real-time}}IOSchedulingClass=realtime{{/required-permission.urn:AGL:permission::partner:real-time}}
{{#required-permission.urn:AGL:permission::public:display}}SupplementaryGroups=display{{/required-permission.urn:AGL:permission::public:display}}
{{^required-permission.urn:AGL:permission::public:syscall:clock}}SystemCallFilter=~@clock{{/required-permission.urn:AGL:permission::public:syscall:clock}}
%nl
WorkingDirectory=-/home/%i/app-data/{{:id}}
ExecStartPre=/bin/mkdir -p /home/%i/app-data/{{:id}}
Environment=AFM_APP_INSTALL_DIR={{:#metadata.install-dir}}
Environment=PATH=/usr/sbin:/usr/bin:/sbin:/bin:{{:#metadata.install-dir}}/bin
Environment=LD_LIBRARY_PATH={{:#metadata.install-dir}}/lib
Environment=XDG_DATA_HOME=/home/%i/app-data/{{:id}}
Environment=XDG_CONFIG_HOME=/home/%i/app-data/{{:id}}
Environment=XDG_CACHE_HOME=/home/%i/app-data/{{:id}}
Environment=XDG_RUNTIME_DIR=@afm_users_rundir@/%i
Environment=DBUS_SESSION_BUS_ADDRESS=unix:path=@afm_users_rundir@/%i/bus
; Needed to enable debug
Environment=AFM_ID={{idaver}}{{^#target=main}}@{{:#target}}{{/#target=main}}
EnvironmentFile=-@afm_platform_rundir@/debug/{{idaver}}{{^#target=main}}@{{:#target}}{{/#target=main}}.env
SyslogIdentifier=afbd-{{idaver}}{{^#target=main}}@{{:#target}}{{/#target=main}}
StandardInput=null
StandardOutput=journal
StandardError=journal
;---------------------------------------------------------------------------------
;----   text/html  application/vnd.agl.native  application/vnd.agl.service    ----
;---------------------------------------------------------------------------------
{{#content.type=text/html|application/vnd.agl.native|application/vnd.agl.service}}
X-AFM-http-port={{:#metadata.http-port}}
Type=notify
ExecStart=/usr/bin/afb-daemon \
	--name afbd-{{idaver}}{{^#target=main}}@{{:#target}}{{/#target=main}} \
	--rootdir={{:#metadata.install-dir}} \
	--workdir=/home/%i/app-data/{{id}} \
	--verbose \
	--verbose \
	--monitoring \
	--port={{:#metadata.http-port}} \
	--token=HELLO \
	--roothttp={{#content.type=application/vnd.agl.service}}.{{/content.type=application/vnd.agl.service}}{{^content.type=application/vnd.agl.service}}{{#required-permission.urn:AGL:permission::public:no-htdocs}}.{{/required-permission.urn:AGL:permission::public:no-htdocs}}{{^required-permission.urn:AGL:permission::public:no-htdocs}}htdocs{{/required-permission.urn:AGL:permission::public:no-htdocs}}{{/content.type=application/vnd.agl.service}} \
	{{#required-permission.urn:AGL:permission::public:applications:read}}--alias=/icons:{{:#metadata.icons-dir}}{{/required-permission.urn:AGL:permission::public:applications:read}} \
	{{#required-api}} \
		{{#value=auto|ws}}--ws-client=unix:@afm_users_rundir@/%i/apis/ws/{{name}}{{/value=auto|ws}} \
		{{#value=dbus}}--dbus-client={{name}}{{/value=dbus}} \
		{{#value=cloud}}--cloud-client={{name}}{{/value=cloud}} \
		{{#value=local}}--binding={{:#metadata.install-dir}}/{{name}}{{/value=local}} \
		{{#value=tcp}}--ws-client=tcp:{{name}}{{/value=tcp}} \
	{{/required-api}} \
	{{#required-binding}} \
		{{#value=local}}--binding={{:#metadata.install-dir}}/{{name}}{{/value=local}} \
		{{#value=extern}}--binding=@afm_users_rundir@/%i/apis/link/{{name}}{{/value=extern}} \
	{{/required-binding}} \
	{{#provided-api}} \
		{{#value=auto|ws}}--ws-server=sd:{{name}}{{/value=auto|ws}} \
		{{#value=dbus}}--dbus-server={{name}}{{/value=dbus}} \
		{{#value=tcp}}--ws-server=tcp:{{name}}{{/value=tcp}} \
	{{/provided-api}} \
	{{#content.type=text/html}}--exec /usr/bin/web-runtime http://localhost:@p/{{content.src}}?token=@t{{/content.type=text/html}} \
	{{#content.type=application/vnd.agl.native}}--exec {{:#metadata.install-dir}}/{{content.src}} @p @t{{/content.type=application/vnd.agl.native}}
{{/content.type=text/html|application/vnd.agl.native|application/vnd.agl.service}}
;---------------------------------------------------------------------------------
;----                 application/x-executable                                ----
;---------------------------------------------------------------------------------
{{#content.type=application/x-executable}}
ExecStart={{:#metadata.install-dir}}/{{content.src}}
{{/content.type=application/x-executable}}
{{#required-permission.urn:AGL:permission::system:run-by-default}}
;---------------------------------------------------------------------------------
; auto start
;---------------------------------------------------------------------------------
[Install]
WantedBy=afm-user-session@.target
%systemd-unit wanted-by afm-user-session@.target
{{/required-permission.urn:AGL:permission::system:run-by-default}}
%end systemd-unit
;-------------------------------------------------------------------------------
;----        P R O V I D E D   A P I S                                      ----
;-------------------------------------------------------------------------------
{{#provided-api}}
;-------------------------------------------------------------------------------
;----        T H E   S E R V I C E   O F   T H E   A P I                    ----
;-------------------------------------------------------------------------------
%begin systemd-unit
# auto generated by wgtpkg-unit for {{:id}} version {{:version}} target {{:#target}} of {{:idaver}}
%systemd-unit system
%systemd-unit service afm-api-{{name}}@
[Unit]
Description=Provides api {{name}} for user %i
X-AFM-API-TYPE={{value}}
Requires=afm-user-setup@%i.service
After=afm-user-setup@%i.service
{{#value=ws|auto}}
Requires=afm-api-{{name}}@%i.socket
After=afm-api-{{name}}@%i.socket
{{/value=ws|auto}}
[Service]
Type=oneshot
RemainAfterExit=yes
{{#value=ws|auto}}
ExecStart=/bin/true
{{/value=ws|auto}}
%end systemd-unit
;-------------------------------------------------------------------------------
;----        T H E   S O C K E T   O F   T H E   A P I                      ----
;-------------------------------------------------------------------------------
{{#value=ws|auto}}
%begin systemd-unit
# auto generated by wgtpkg-unit for {{:id}} version {{:version}} target {{:#target}} of {{:idaver}}
%systemd-unit system
%systemd-unit socket afm-api-{{name}}@
[Unit]
Description=Provides websocket api {{name}} for user %i
Requires=afm-user-setup@%i.service
After=afm-user-setup@%i.service
DefaultDependencies=no
[Socket]
SmackLabel=*
SmackLabelIPIn=System
SmackLabelIPOut=System
ListenStream=@afm_users_rundir@/%i/apis/ws/{{name}}
FileDescriptorName={{name}}
Service=afm-{{#required-permission.urn:AGL:permission::public:hidden}}service{{/required-permission.urn:AGL:permission::public:hidden}}{{^required-permission.urn:AGL:permission::public:hidden}}appli{{/required-permission.urn:AGL:permission::public:hidden}}-{{:id}}--{{:ver}}--{{:#target}}@%i.service
%end systemd-unit
{{/value=ws|auto}}
{{/provided-api}}
;-------------------------------------------------------------------------------
;----        P R O V I D E D   B I N D I N G                                ----
;-------------------------------------------------------------------------------
{{#provided-binding}}
;-------------------------------------------------------------------------------
;----        T H E   S E R V I C E   O F   T H E   B I N D I N G            ----
;-------------------------------------------------------------------------------
%begin systemd-unit
# auto generated by wgtpkg-unit for {{:id}} version {{:version}} target {{:#target}} of {{:idaver}}
%systemd-unit system
%systemd-unit service afm-link-{{name}}@
[Unit]
Description=Provides binding {{name}} for user %i
Requires=afm-user-setup@%i.service
After=afm-user-setup@%i.service
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/ln -sf {{:#metadata.install-dir}}/{{value}} @afm_users_rundir@/%i/apis/link/{{name}}
%end systemd-unit
{{/provided-binding}}
{{/targets}}
;---------------------------------------------------------------------------------
; End of file afm-unit.conf mode DEVEL
;---------------------------------------------------------------------------------