summaryrefslogblamecommitdiff
path: root/devel/script/4_json.xml
blob: b0234a4edc5676af08da3e3f3f75cce653dc5806 (plain) (tree)
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
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451


































































































































































































































































































































































































































































                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
<?xml version="1.0" encoding="utf-8"?>
<chapter label="4" id="json">
    <title>JSON Schema</title>
    <para>The Horizon system supports converting JSON files to HorizonScript.  This chapter describes the JSON schema supported by the Horizon JSON tooling.</para>
    <para>It is important to note that not all features of Horizon are available from JSON.  For more advanced use cases, consider writing HorizonScript files directly.  However, it is felt that supporting JSON interchange is important for interoperability with external systems.</para>
    <section id="js_doc_structure">
        <title>Overall document structure</title>
        <para>There are two document formats supported by the Horizon JSON tooling.  The most common is a simple structure where a single root object contains the Horizon JSON keys.  The second, and less common, describes multiple configurations called "images" in a single JSON file.  The root object contains a single key/value pair, <literal>images</literal>, which is an array of objects containing Horizon JSON keys.  See <xref linkend="js_examples" /> for more information.</para>
    </section>
    <section id="js_keys">
        <title>Supported keys</title>
        <para/>
        <section id="js_hostname">
            <title><literal>hostname</literal></title>
            <formalpara id="js_hostname.format">
                <title>Format</title>
                <para>String</para>
            </formalpara>
            <formalpara id="js_hostname.desc">
                <title>Short Description</title>
                <para>The device's host name.</para>
            </formalpara>
            <formalpara id="js_hostname.xref">
                <title>Corresponding HorizonScript key</title>
                <para><link linkend="hostname"><literal>hostname</literal></link></para>
            </formalpara>
        </section>
        <section id="js_packages">
            <title><literal>packages</literal></title>
            <formalpara id="js_packages.format">
                <title>Format</title>
                <para>Array of String</para>
            </formalpara>
            <formalpara id="js_packages.desc">
                <title>Short Description</title>
                <para>A list of packages to install to the device.</para>
            </formalpara>
            <formalpara id="js_packages.xref">
                <title>Corresponding HorizonScript key</title>
                <para><link linkend="pkginstall"><literal>pkginstall</literal></link></para>
            </formalpara>
        </section>
        <section id="js_rootpw">
            <title><literal>rootpw</literal></title>
            <formalpara id="js_rootpw.format">
                <title>Format</title>
                <para>String</para>
            </formalpara>
            <formalpara id="js_rootpw.desc">
                <title>Short Description</title>
                <para>The encrypted root password for the device.</para>
            </formalpara>
            <formalpara id="js_rootpw.xref">
                <title>Corresponding HorizonScript key</title>
                <para><link linkend="rootpw"><literal>rootpw</literal></link></para>
            </formalpara>
        </section>
        <section id="js_arch">
            <title><literal>arch</literal></title>
            <formalpara id="js_arch.format">
                <title>Format</title>
                <para>String</para>
            </formalpara>
            <formalpara id="js_arch.desc">
                <title>Short Description</title>
                <para>The device's CPU architecture.</para>
            </formalpara>
            <formalpara id="js_arch.xref">
                <title>Corresponding HorizonScript key</title>
                <para><link linkend="arch"><literal>arch</literal></link></para>
            </formalpara>
        </section>
        <section id="js_language">
            <title><literal>language</literal></title>
            <formalpara id="js_language.format">
                <title>Format</title>
                <para>String</para>
            </formalpara>
            <formalpara id="js_language.desc">
                <title>Short Description</title>
                <para>The language to use for the device's interface.</para>
            </formalpara>
            <formalpara id="js_language.xref">
                <title>Corresponding HorizonScript key</title>
                <para><link linkend="language"><literal>language</literal></link></para>
            </formalpara>
        </section>
        <section id="js_keymap">
            <title><literal>keymap</literal></title>
            <formalpara id="js_keymap.format">
                <title>Format</title>
                <para>String</para>
            </formalpara>
            <formalpara id="js_keymap.desc">
                <title>Short Description</title>
                <para>The keyboard map to use for the device's hardware inputs.</para>
            </formalpara>
            <formalpara id="js_keymap.xref">
                <title>Corresponding HorizonScript key</title>
                <para><link linkend="keymap"><literal>keymap</literal></link></para>
            </formalpara>
        </section>
        <section id="js_firmware">
            <title><literal>firmware</literal></title>
            <formalpara id="js_firmware.format">
                <title>Format</title>
                <para>String or Boolean</para>
            </formalpara>
            <formalpara id="js_firmware.desc">
                <title>Short Description</title>
                <para>Determines whether or not the device will have non-free firmware installed.</para>
            </formalpara>
            <formalpara id="js_firmware.xref">
                <title>Corresponding HorizonScript key</title>
                <para><link linkend="firmware"><literal>firmware</literal></link></para>
            </formalpara>
        </section>
        <section id="js_services">
            <title><literal>services</literal></title>
            <formalpara id="js_services.format">
                <title>Format</title>
                <para>Array of Object</para>
            </formalpara>
            <formalpara id="js_services.desc">
                <title>Short Description</title>
                <para>Specifies additional services to start on device boot.</para>
            </formalpara>
            <formalpara id="js_services.struct">
                <title>Object Structure</title>
                <para>
                    <variablelist>
                        <varlistentry>
                            <term><literal>service</literal></term>
                            <listitem><para>(String) The name of the service to start.</para></listitem>
                        </varlistentry>
                        <varlistentry>
                            <term><literal>runlevel</literal></term>
                            <listitem><para>(String) The runlevel that the service should start under.  If no <literal>runlevel</literal> is specified, <literal>default</literal> is used.</para></listitem>
                        </varlistentry>
                    </variablelist>
                </para>
            </formalpara>
            <formalpara id="js_services.xref">
                <title>Corresponding HorizonScript key</title>
                <para><link linkend="svcenable"><literal>svcenable</literal></link></para>
            </formalpara>
        </section>
        <section id="js_netconfig">
            <title><literal>netconfig</literal></title>
            <formalpara id="js_netconfig.format">
                <title>Format</title>
                <para>String</para>
            </formalpara>
            <formalpara id="js_netconfig.desc">
                <title>Short Description</title>
                <para>Determines the network configuration system used on the device.</para>
            </formalpara>
            <formalpara id="js_netconfig.xref">
                <title>Corresponding HorizonScript key</title>
                <para><link linkend="netconfigtype"><literal>netconfigtype</literal></link></para>
            </formalpara>
        </section>
        <section id="js_netaddresses">
            <title><literal>netaddresses</literal></title>
            <formalpara id="js_netaddresses.format">
                <title>Format</title>
                <para>Array of Object</para>
            </formalpara>
            <formalpara id="js_netaddresses.desc">
                <title>Short Description</title>
                <para>Specifies the device's network addressing configuration.</para>
            </formalpara>
            <formalpara id="js_netaddresses.struct">
                <title>Object Structure</title>
                <para>
                    <variablelist>
                        <varlistentry>
                            <term><literal>id</literal></term>
                            <listitem><para>(String) This connection's identifier.  This field is for operator reference only - it will not appear in the HorizonScript or in the device's configuration.</para></listitem>
                        </varlistentry>
                        <varlistentry>
                            <term><literal>interface</literal></term>
                            <listitem><para>(String) The network interface to use for this address.</para></listitem>
                        </varlistentry>
                        <varlistentry>
                            <term><literal>addr-type</literal></term>
                            <listitem><para>(String) The type of this address: <literal>none</literal> to bring up the interface without an address (common for bridging), <literal>dhcp</literal> for DHCP, or <literal>static</literal> for static addressing.</para></listitem>
                        </varlistentry>
                        <varlistentry>
                            <term><literal>address</literal></term>
                            <listitem><para>(Object) The network address.  Only valid if <literal>addr-type</literal> is <literal>static</literal>.</para></listitem>
                        </varlistentry>
                    </variablelist>
                    If static addressing is desired, the <literal>address</literal> object is described below.
                    <variablelist>
                        <varlistentry>
                            <term><literal>ip-address</literal></term>
                            <listitem><para>(String) The IPv4 or IPv6 address for this connection.</para></listitem>
                        </varlistentry>
                        <varlistentry>
                            <term><literal>net-prefix</literal></term>
                            <listitem><para>(Number) The network prefix for this connection.  Valid values are 1-32 for IPv4, and 1-128 for IPv6.</para></listitem>
                        </varlistentry>
                        <varlistentry>
                            <term><literal>gateway</literal></term>
                            <listitem><para>(String) The IPv4 or IPv6 address for the gateway for this connection.</para></listitem>
                        </varlistentry>
                    </variablelist>
                </para>
            </formalpara>
            <formalpara id="js_netaddresses.xref">
                <title>Corresponding HorizonScript key</title>
                <para><link linkend="netaddress"><literal>netaddress</literal></link></para>
            </formalpara>
        </section>
        <section id="js_pppoe_links">
            <title><literal>pppoe_links</literal></title>
            <formalpara id="js_pppoe_links.format">
                <title>Format</title>
                <para>Array of Object</para>
            </formalpara>
            <formalpara id="js_pppoe_links.desc">
                <title>Short Description</title>
                <para>Specifies the device's PPPoE configuration.</para>
            </formalpara>
            <formalpara id="js_pppoe_links.struct">
                <title>Object Structure</title>
                <para>
                    <variablelist>
                        <varlistentry>
                            <term><literal>interface</literal></term>
                            <listitem><para>(String) The network interface to use for this PPPoE link.</para></listitem>
                        </varlistentry>
                        <varlistentry>
                            <term><literal>mtu</literal></term>
                            <listitem><para>(Number) The MTU for this PPPoE link.  Default is 1472.</para></listitem>
                        </varlistentry>
                        <varlistentry>
                            <term><literal>username</literal></term>
                            <listitem><para>(String) The username to use for authenticating this PPPoE link.</para></listitem>
                        </varlistentry>
                        <varlistentry>
                            <term><literal>password</literal></term>
                            <listitem><para>(String) The passphrase/secret to use for authenticating this PPPoE link.</para></listitem>
                        </varlistentry>
                        <varlistentry>
                            <term><literal>lcp-echo-interval</literal></term>
                            <listitem><para>(Number) The number of seconds between LCP echo requests.</para></listitem>
                        </varlistentry>
                        <varlistentry>
                            <term><literal>lcp-echo-failure</literal></term>
                            <listitem><para>(Number) The number of echo request failures before this link is failed.</para></listitem>
                        </varlistentry>
                    </variablelist>
                </para>
            </formalpara>
            <formalpara id="js_pppoe_links.xref">
                <title>Corresponding HorizonScript key</title>
                <para><link linkend="pppoe"><literal>pppoe</literal></link></para>
            </formalpara>
        </section>
        <section id="js_nameservers">
            <title><literal>nameservers</literal></title>
            <formalpara id="js_nameservers.format">
                <title>Format</title>
                <para>Array of String</para>
            </formalpara>
            <formalpara id="js_nameservers.desc">
                <title>Short Description</title>
                <para>IP addresses used for Domain Name System (DNS) resolution.</para>
            </formalpara>
            <formalpara id="js_nameservers.xref">
                <title>Corresponding HorizonScript key</title>
                <para><link linkend="nameserver"><literal>nameserver</literal></link></para>
            </formalpara>
        </section>
        <section id="js_access-points">
            <title><literal>access-points</literal></title>
            <formalpara id="js_access-points.format">
                <title>Format</title>
                <para>Array of Object</para>
            </formalpara>
            <formalpara id="js_access-points.desc">
                <title>Short Description</title>
                <para>Specifies the device's wireless networking configuration.</para>
            </formalpara>
            <formalpara id="js_access-points.struct">
                <title>Object Structure</title>
                <para>
                    <variablelist>
                        <varlistentry>
                            <term><literal>interface</literal></term>
                            <listitem><para>(String) The wireless network interface to use for this access point.</para></listitem>
                        </varlistentry>
                        <varlistentry>
                            <term><literal>ssid</literal></term>
                            <listitem><para>(String) The SSID for this access point.</para></listitem>
                        </varlistentry>
                        <varlistentry>
                            <term><literal>security</literal></term>
                            <listitem><para>(String) The security type to use for this access point: <literal>none</literal>, <literal>wep</literal>, or <literal>wpa</literal>.</para></listitem>
                        </varlistentry>
                        <varlistentry>
                            <term><literal>password</literal></term>
                            <listitem><para>(String) The shared secret to use for authenticating this wireless link.</para></listitem>
                        </varlistentry>
                    </variablelist>
                </para>
            </formalpara>
            <formalpara id="js_access-points.xref">
                <title>Corresponding HorizonScript key</title>
                <para><link linkend="netssid"><literal>netssid</literal></link></para>
            </formalpara>
        </section>
        <section id="js_timezone">
            <title><literal>timezone</literal></title>
            <formalpara id="js_timezone.format">
                <title>Format</title>
                <para>String</para>
            </formalpara>
            <formalpara id="js_timezone.desc">
                <title>Short Description</title>
                <para>The time zone to use on the device.</para>
            </formalpara>
            <formalpara id="js_timezone.xref">
                <title>Corresponding HorizonScript key</title>
                <para><link linkend="timezone"><literal>timezone</literal></link></para>
            </formalpara>
        </section>
        <section id="js_repositories">
            <title><literal>repositories</literal></title>
            <formalpara id="js_repositories.format">
                <title>Format</title>
                <para>Array of String</para>
            </formalpara>
            <formalpara id="js_repositories.desc">
                <title>Short Description</title>
                <para>The APK repositories to use for package installation on the device.</para>
            </formalpara>
            <formalpara id="js_repositories.xref">
                <title>Corresponding HorizonScript key</title>
                <para><link linkend="repository"><literal>repository</literal></link></para>
            </formalpara>
        </section>
        <section id="js_signingkeys">
            <title><literal>signingkeys</literal></title>
            <formalpara id="js_signingkeys.format">
                <title>Format</title>
                <para>Array of String</para>
            </formalpara>
            <formalpara id="js_signingkeys.desc">
                <title>Short Description</title>
                <para>The location of the signing key(s) used by the device's APK repositories.</para>
            </formalpara>
            <formalpara id="js_signingkeys.xref">
                <title>Corresponding HorizonScript key</title>
                <para><link linkend="signingkey"><literal>signingkey</literal></link></para>
            </formalpara>
        </section>
        <section id="js_users">
            <title><literal>users</literal></title>
            <formalpara id="js_users.format">
                <title>Format</title>
                <para>Array of Object</para>
            </formalpara>
            <formalpara id="js_users.desc">
                <title>Short Description</title>
                <para>Specifies the device's user accounts.</para>
            </formalpara>
            <formalpara id="js_users.struct">
                <title>Object Structure</title>
                <para>
                    <variablelist>
                        <varlistentry>
                            <term><literal>username</literal></term>
                            <listitem><para>(String) The login name of this account.</para></listitem>
                        </varlistentry>
                        <varlistentry>
                            <term><literal>alias</literal></term>
                            <listitem><para>(String) The friendly name/GECOS of this account.</para></listitem>
                        </varlistentry>
                        <varlistentry>
                            <term><literal>passphrase</literal></term>
                            <listitem><para>(String) The encrypted passphrase to use to authenticate to this account.  See <xref linkend="userpw" /> for information about the format of <literal>passphrase</literal>.</para></listitem>
                        </varlistentry>
                        <varlistentry>
                            <term><literal>groups</literal></term>
                            <listitem><para>(String) Comma-separated list of this account's member groups.</para></listitem>
                        </varlistentry>
                    </variablelist>
                </para>
            </formalpara>
            <formalpara id="js_users.xref">
                <title>Corresponding HorizonScript keys</title>
                <para><link linkend="username"><literal>username</literal></link>, <link linkend="useralias"><literal>useralias</literal></link>, <link linkend="userpw"><literal>userpw</literal></link>, <link linkend="usergroups"><literal>usergroups</literal></link></para>
            </formalpara>
        </section>
    </section>
    <section id="js_examples">
        <title>Examples</title>
        <para>
            <example id="js_0001-basic">
                <title>Basic example of Horizon JSON file</title>
                <programlisting>
{
 "hostname": "horizon-json-testmachine.adelielinux.org",
 "packages": ["adelie-base-posix", "easy-kernel", "easy-kernel-modules",
              "netifrc", "openrc", "s6-linux-init"],
 "rootpw": "<userinput>...</userinput>",
 "root": "/dev/sda1",
 "netaddresses": [{"id":"eth0", "interface":"eth0", "addr-type":"dhcp"}],
 "nameservers": ["9.9.9.9"],
 "timezone": "America/Chicago",
 "repositories": ["https://distfiles.adelielinux.org/adelie/1.0/system",
                  "https://distfiles.adelielinux.org/adelie/1.0/user"],
 "signingkeys": ["/etc/apk/keys/powerpc-1@packages.adelielinux.org.pub",
                 "/etc/apk/keys/powerpc-2@packages.adelielinux.org.pub"]
}
                </programlisting>
            </example>
            <example id="js_0002-fuller">
                <title>Example of multi-configuration Horizon JSON file</title>
                <programlisting>
{"images":
 [
  {"name": "Test Image",
   "hostname": "horizon-json-testmachine.adelielinux.org",
   "packages": ["adelie-base-posix", "easy-kernel", "easy-kernel-modules",
                "netifrc", "openrc", "s6-linux-init"],
   "rootpw": "<userinput>...</userinput>",
   "root": "/dev/sda1",
   "arch": "ppc64",
   "language": "en_GB.UTF-8",
   "keymap": "us",
   "firmware": false,
   "netconfig": "netifrc",
   "netaddresses": [{"id":"eth0", "interface":"eth0", "addr-type":"dhcp"}],
   "nameservers": ["9.9.9.9"],
   "timezone": "America/Chicago",
   "repositories": ["https://distfiles.adelielinux.org/adelie/1.0/system",
                    "https://distfiles.adelielinux.org/adelie/1.0/user"],
   "signingkeys": ["/etc/apk/keys/powerpc-1@packages.adelielinux.org.pub",
                   "/etc/apk/keys/powerpc-2@packages.adelielinux.org.pub"]
  }
 ]
}
                </programlisting>
            </example>
        </para>
    </section>
</chapter>