Chapter 4. JSON Schema

Table of Contents

Overall document structure
Supported keys
hostname
packages
rootpw
arch
language
keymap
firmware
services
netconfig
netaddresses
pppoe_links
nameservers
access-points
timezone
repositories
signingkeys
users
Examples

The Horizon system supports converting JSON files to HorizonScript. This chapter describes the JSON schema supported by the Horizon JSON tooling.

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.

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, images, which is an array of objects containing Horizon JSON keys. See the section called “Examples” for more information.

Format.  String

Short Description.  The device's host name.

Corresponding HorizonScript key.  hostname

Format.  Array of String

Short Description.  A list of packages to install to the device.

Corresponding HorizonScript key.  pkginstall

Format.  String

Short Description.  The encrypted root password for the device.

Corresponding HorizonScript key.  rootpw

Format.  String

Short Description.  The device's CPU architecture.

Corresponding HorizonScript key.  arch

Format.  String

Short Description.  The language to use for the device's interface.

Corresponding HorizonScript key.  language

Format.  String

Short Description.  The keyboard map to use for the device's hardware inputs.

Corresponding HorizonScript key.  keymap

Format.  String or Boolean

Short Description.  Determines whether or not the device will have non-free firmware installed.

Corresponding HorizonScript key.  firmware

Format.  Array of Object

Short Description.  Specifies additional services to start on device boot.

Object Structure. 

service

(String) The name of the service to start.

runlevel

(String) The runlevel that the service should start under. If no runlevel is specified, default is used.

Corresponding HorizonScript key.  svcenable

Format.  String

Short Description.  Determines the network configuration system used on the device.

Corresponding HorizonScript key.  netconfigtype

Format.  Array of Object

Short Description.  Specifies the device's network addressing configuration.

Object Structure. 

id

(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.

interface

(String) The network interface to use for this address.

addr-type

(String) The type of this address: none to bring up the interface without an address (common for bridging), dhcp for DHCP, or static for static addressing.

address

(Object) The network address. Only valid if addr-type is static.

If static addressing is desired, the address object is described below.

ip-address

(String) The IPv4 or IPv6 address for this connection.

net-prefix

(Number) The network prefix for this connection. Valid values are 1-32 for IPv4, and 1-128 for IPv6.

gateway

(String) The IPv4 or IPv6 address for the gateway for this connection.

Corresponding HorizonScript key.  netaddress

Format.  Array of Object

Short Description.  Specifies the device's PPPoE configuration.

Object Structure. 

interface

(String) The network interface to use for this PPPoE link.

mtu

(Number) The MTU for this PPPoE link. Default is 1472.

username

(String) The username to use for authenticating this PPPoE link.

password

(String) The passphrase/secret to use for authenticating this PPPoE link.

lcp-echo-interval

(Number) The number of seconds between LCP echo requests.

lcp-echo-failure

(Number) The number of echo request failures before this link is failed.

Corresponding HorizonScript key.  pppoe

Format.  Array of String

Short Description.  IP addresses used for Domain Name System (DNS) resolution.

Corresponding HorizonScript key.  nameserver

Format.  Array of Object

Short Description.  Specifies the device's wireless networking configuration.

Object Structure. 

interface

(String) The wireless network interface to use for this access point.

ssid

(String) The SSID for this access point.

security

(String) The security type to use for this access point: none, wep, or wpa.

password

(String) The shared secret to use for authenticating this wireless link.

Corresponding HorizonScript key.  netssid

Format.  String

Short Description.  The time zone to use on the device.

Corresponding HorizonScript key.  timezone

Format.  Array of String

Short Description.  The APK repositories to use for package installation on the device.

Corresponding HorizonScript key.  repository

Format.  Array of String

Short Description.  The location of the signing key(s) used by the device's APK repositories.

Corresponding HorizonScript key.  signingkey

Format.  Array of Object

Short Description.  Specifies the device's user accounts.

Object Structure. 

username

(String) The login name of this account.

alias

(String) The friendly name/GECOS of this account.

passphrase

(String) The encrypted passphrase to use to authenticate to this account. See the section called “userpw for information about the format of passphrase.

groups

(String) Comma-separated list of this account's member groups.

Corresponding HorizonScript keys.  username, useralias, userpw, usergroups

Example 4.1. Basic example of Horizon JSON file

{
 "hostname": "horizon-json-testmachine.adelielinux.org",
 "packages": ["adelie-base-posix", "easy-kernel", "easy-kernel-modules",
              "netifrc", "openrc", "s6-linux-init"],
 "rootpw": "...",
 "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"]
}
                


Example 4.2. Example of multi-configuration Horizon JSON file

{"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": "...",
   "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"]
  }
 ]
}