Blocks v2 Server Configuration Options

While a Blocks server generally 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 set some configuration parameters in a config.yml file, located in your server’s data folder. This folder is typically called “PIXILAB-Blocks-root”, and is located in the home directory of the user account under which you run the server. Here’s an example of what can find in this file:

# 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
  applicationConnectors:
    - type: http
      port: 9080
  #corsPath: /rest/script/invoke/*
  #corsAllowOrigin: "*"
      
scripting:
  watchFiles: true

#defaultNetwork: 10.0.2.10
  
#artnet:
#  bindToAddress: 10.0.3.10
#  sendToAddress: 10.0.3.25  

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. Some options you may want to modify:

  • 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.
  • port under server/applicationConnectors. The port number used by Blocks http server. Under Windows, you may want to set this to the default port 80. MacOS (like most UNIX-based operating systems) doesn’t allow access to ports below 1024 for user mode applications. The default value if not specified in the config file is 8080.
  • corsPath under server for adding CORS headers to responses to requests under the specified path (in this example under /rest/script/invoke/, invoking user script methods marked with the @resource annotation). This is an advanced option for allowing Blocks functions to be invoked from other web services. When specifying the corsPath option, you must also specify the corsAllowOrigin option, and may specify the corsAllowMethods and corsAllowHeaders options, specifying the value returned in corresponding headers.
  • watchFiles under scripting. 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).
  • 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.
  • bindToAddress under artnet. Address of any additional NIC used for Art-Net data. Specify this if using Art-Net devices if your server is equipped with more than one active NIC.
  • sendToAddress under artnet. Specify a unicast address here if you want Art-Net data to be sent to a specific address. Default is to use network broadcast for Art-Net data.

:!: IMPORTANT The PIXILAB Linux server comes with a configuration file specifying http port 9080 instead. This is in order to not interfere with any Unifi Controller software, if enabled, which uses port 8080. On the Linux server, port 9080 is then re-mapped to port 80 in the firewall (iptables). Make sure you keep the http port set to 9080 if you change or replace the config.yml file.

While some of the options described above can only be used under Windows, and not under MacOS, the PIXILAB Linux server image includes support for all those features, and many more, but managed in a different manner.

:!: 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.

Alternative Blocks Data Location

You may prefer to store Blocks' data somewhere else than in the “PIXILAB-Blocks-root” diretory in the current user's home directory. This can be accomplished by putting a file named "PIXILAB-Blocks-config.yml" in the current user's home directory. This is a file with the same syntax and options as shown above, plus one additional option:

root: /Volume/External4/Blocks

This option tells Blocks to look for its data at the specified file system location, thus allowing you to put Blocks' data directory where you want. Additional options can be specified in this "PIXILAB-Blocks-config.yml" file, as shown above. In this case, Blocks will not look in its data directory for any config.yml file, so all options must then be specified in the "PIXILAB-Blocks-config.yml" file.