Server Configuration Options

While a Blocks server often works fine as is, there are a number of configuration options that can be changed to further tailor the system to your network and other requirements. Configuration can be applied in the following two ways:

  • By changing configuration options for the Blocks server itself. This is done through a configuration file read by the Blocks server as it starts up.
  • By changing operating system settings to activate other, complementary features, such as DNS, DHCP, remote access, enterprise wifi network integration, etc. Such configuration is done in other parts of the system, and is mainly supported when running on a Linux server.

Configuration File Settings

You can configure Blocks using a configuration file. There are two possible locations and names for this file:

  1. In the home directory of the user account under which the server is run, named PIXILAB-Blocks-config.yml.
  2. Inside Blocks' data folder, then named config.yml. Blocks' data folder must in this case be named “PIXILAB-Blocks-root”, and located in the home directory of the user account under which the server is run.

:!: On our Linux-based server, the home directory of the user account under which the server is at /home/pixi-server/.

Here’s an example of what you may find in this file:

# Location of Blocks' data folder
root: /home/pixi-server/PIXILAB-Blocks-root

# Where to go when addressing root of server (i.e., just http://pixi.guide/)
serverRootRedirect: /spot/?mobile=Mob1

# Main server configuration
server:
  type: pixilab_server
  #corsPath: /rest/script/invoke/*
  #corsAllowOrigin: "*"
  applicationConnectors:
    - type: http
      port: 8080
      
scripting:
  watchFiles: true

logging:
  # The default level of all loggers, such as OFF, ERROR, WARN, INFO
  level: WARN

  loggers:
    Realm: INFO # Log task log statements messages, regardless of originating Realm
    Script: INFO # Log "console.log" messages from advanced scripts

#defaultNetwork: 10.2.0.10
  
#artnet:
#  bindToAddress: 10.3.0.10
#  sendToAddress: 10.3.0.25

# Enable tftp server for network boot support.
#tftp:
#  port: 8069

This file uses the YAML file format. Lines beginning with a #-sign are comments. To activate such lines in the example above, remove the leading #-sign.

Note that the file has a hierarchical structure. For instance, the watchFiles option is nested under scripting. Options may be nested several levels deep, as is the case with the port option shown above. It is very important that you adhere precisely to this hierarchical structure, or the configuration will not work as expected. Below is a detailed description of each level of the configuration file.

:!: When editing the configuration file, make sure you observe YAML syntax rules. In particular, indentation is significant in YAML files. Don't use tabs for indentation. Use two spaces per indentation level, as shown in the example above.

Top Level Items

The following items are found at the top level of the configuration file.

  • root. Absolute path to Blocks' root data directory. Not required when using the config.yml file inside your Blocks' root data directory (option 1 above). See more under alternative blocks data location below.
  • serverRootRedirect. Server path to go to when accessing the root level of the server. This is often used to specify the path to a Mobile Spot to be accessed by default by guest users.
  • defaultNetwork. Address of network interface (NIC) to be use for general broadcast data, such as wake-on-LAN packets. Specify this to be the NIC used by such devices if your server has more than one active NIC.
  • scripting. Scripting options are defined under this heading. The only option available hereunder is watchFiles. Set to true to automatically reload advanced script and devices drivers, as those are modified. Default is false (in which case you need to restart the server to pick up any such file changes).
  • artnet. Options related to ArtNET/DMX-512 data. The bindToAddress sub-option specifies which NIC to use for Art-Net data. Set this to the IP address of the desired NIC if you want to segregate ArtNet data on a separate subnet. The sendToAddress sub-option specifies the address to be used to send Art-Net data. If not specified, ArtNet data will be broadcast (broadcast is the most common mode of operation).
  • httpClient. Configuration for outgoing http requests, w.g., when using the SimpleServer scripting module. More details can be found here.
  • mirror. Configuration options for the Blocks' mirroring service.

Some top-level items have more complex structure, and are described individually below.

Top level server item

This item specifies details for Blocks' web server, such as port numbers to use, where to find SSL certificates, etc.

:!: IMPORTANT: If you specify server, you must set its type to pixilab_server, as shown above.

  • type. Server type. Must be set to pixilab_server.
  • corsPath and corsAllowOrigin. If you want to accept calls from other servers/clients, e.g., to endpoints specified by user scripts (using the @resource annotation), specify the root path of such requests, and the Access-Control-Allow-Origin header to be returned here.
  • applicationConnectors. specifies the connection details for the web server, such as port numbers used, etc.

See below for details on server sub-options.

server: applicationConnectors

Specify port numbers and other server-related settings under server:applicationConnectors: like this:

server:
  applicationConnectors:
    - type: http
      port: 8080
    - type: https
      port: 8443
      keyStorePath: "/home/pixi-server/certs/pixi.guide.p12"
      keyStoreType: PKCS12
      keyStorePassword: 3xamplePwd
      certAlias: 1

If not specified, port 8080 is used for http and https is disabled. Under Windows, you may change the http connector to use the standard port 80 instead, thus removing the need to type :8080 after domain name IP address in a browser. Under Linux/MacOS, you can not use ports below 1024.

The above example is appropriate when using PIXILAB's Linux-based server, which provides iptables redirection rules for the standard port 80 (http) and 443 (https) to the ports specified above. The keyStore and certAlias options shown above depend on the certificate used for the https connection. PIXILAB can provide a certificate for use with the pixi.guide domain name. If you want to use another domain name, you must obtain and install the necessary certificate yourself.

:!: A certificate has a limited timespan. You must replace the certificate with a new one before it expires, or your https connection will cease to work on the expiration date.

See here for more details on advanced applicationConnectors settings. Those are advanced settings, that most users won't need. PIXILAB doesn't support servers where such advanced settings have been applied.

server: requireHttps

If set to true, a secure https connection will be enforced for all edit opertions, as well as spot connections that need authentication. Spots used only for display purposes generally don't have a keyboard connected, and don't provide access to protected functions, so they will continue to use http.

server: auth

Specifies advanced authentication and authorization options. In most cases, you don't need to specify these settings. Use only when specifically instructed to do so, e.g. for integration with single-sign-on systems such as Active Directory or OKTA. Here's an example of how you can configure such options.

Top level tftp item

Specifies options for the built-in TFTP-server. This is intended for network booting of PIXILAB Player. It accepts the following options:

tftp:
  port: 8069
  path: public/PIXILAB_Player/boot
  • port is the port number used by the TFTP server. This must be specified in the configuration file to enable the TFTP-server. To use network booting of players, set this to 8069, as shown above. A firewall rule exists to redirect the standard TFTP port 69 to port 8069 on server images based on Ubuntu 20.04LTS and to port 9069 on older images running Ubuntu 18.04.
  • path is the path, under the Blocks root folder, from which files will be served by the TFTP server. If not specified, this defaults to public/PIXILAB_Player/boot, as shown above, which matches the standard installation directory for the PIXILAB Player network boot files.

Top level mail item

Specifies options used by the SimpleMailer scripting module, which can be used to send email from Blocks using user scripts. Here's an example configuration:

mail:
  sender: info@pixilab.se
  username: sendtester@pixilab.net
  password: 3522yt^$aber
  smtp.auth: true
  smtp.starttls.enable: true
  smtp.host: mail.pixilab.net
  smtp.port: 587
  smtp.ssl.trust: mail.pixilab.net
  • sender is the email address that will be passed along as the sender of the email.
  • username is the user name given to the mail server used to send the email.
  • password is the password corresponding to username, needed to send email through the mail server.

This feature relies on an external mail server. The details of that mail server are specified as additional options, and follow the Java Mail standard. Note that options specified under mail omit the leading mail. part. I.e., the option listed as mail.smtp.starttls.enable in the documentation linked to above, is specified as smtp.starttls.enable in Blocks' configuration file, since it's already under the mail heading.

Top level logging item

The top-level logging item controls where logs are sent, and the verbosity of logs.

logging:
  # The default level of all loggers, such as OFF, ERROR, WARN, INFO
  level: WARN

  loggers:
    Realm: INFO # Log task log statements messages, regardless of originating Realm
    Script: INFO # Log "console.log" messages from advanced scripts

See here for more details on advanced logging. Those are advanced settings, that most users won't need. PIXILAB doesn't support servers where such advanced settings have been applied.

Alternative Blocks Data Location

You can store Blocks' data somewhere else than in the “PIXILAB-Blocks-root” directory in the current user's home directory. This is done by putting a file named "PIXILAB-Blocks-config.yml" in the current user's home directory (option 1 of those mentioned at the top of this article). In this case, you must specify root in the configuration file:

root: /Volume/External4/Blocks

If running your Blocks server on windows, the PIXILAB-Blocks-config.yml is still placed in the user home directory (C:\Users\[Your username]) and the path to the root directory should follow this structure:

root: C:/External4/Blocks 

This option tells Blocks to look for its data at the specified path, thus allowing you to put Blocks' data directory where you want. Additional options are specified in this "PIXILAB-Blocks-config.yml" file, as Blocks will not look in its data directory for any config.yml file.