Static File Service Setup

There are two kinds of static files in RackHD: one of them are used for RackHD functionality, and the other is node discovery and os installation. This section introduces a mechanism to move the latter type to a separate third-party service in order to offload the burden of file transmission in RackHD.

Files That can be Moved into a Separate Server

Some files, including schema, swagger configuration and others, interacts closely with RackHD, and are part of its functionalities. Others are served for node discovery and OS installation (if users put OS image under the same static file directory). on-http manages all the files mentioned above by default, and the latter (files for discovery and OS installation) can be moved to a third-party static file server, which will be discussed below.

Diagrams for Different Working Modes

RackHD supports three modes to serve static files. This chapter introduces the settings for the last two modes.

  • Legacy Mode: nodes get static files from on-http service (default).
  • Single-Host Mode: nodes get static files from another service in the same host as RackHD.
  • Multi-Host Mode: nodes get static files from different host.
../_images/static_server_mode.png

Setup a Static File Server

Prerequisites

The server can be accessed by nodes.

Configure a Third-Party Static File Server

Since RackHD doesn’t require any customization on a file server, users could adopt any frameworks they are familiar with. Here takes nginx as an example about the configuration.

After install nginx, modify nginx_conf to make sure the following configuration works.

http {
    server {
        listen 3000;
        sendfile on;

        location / {
            root /home/onrack/;
        }
    }
}

“3000” is the port for the server; “location” is the URI root path to access static files; and “root” specifies the directory that will be used to search for files.

Restart nginx server after the new configuration.

Copy Static File into the Server

In the RackHD file directory on static file server (specified in “root” item above), create a directory named “common”. Copy files from on-imagebuilder binary in bintray into this folder.

Configure the Path of Static File Server in RackHD

In config.json, add the following fields:

...
"fileServerAddress": "172.31.128.3",
"fileServerPort": 3000,
"fileServerPath": "/",
...

The following table describes the configurations above.

Parameter Description
fileServerAddress IP address of static file server that nodes can access
fileServerPort port the server is listening to. Optional, the default value is 80
fileServerPath the “location” in server configuration. Optional, the default value is ‘/’

Restart RackHD services after adding these fields.

Notes

  • fileServer configurations takes higher priority than httpStaticRoot, which means that when above fields exists, RackHD will use file server address for static files and ignore that specified “httpSaticRoot”.
  • When user creates a payload for a task, they could use {{ file.server }} as the address that nodes will use to get static file. It will direct to the correct address holding static file, depending on different working modes.
  • httpProxies still works. If user has setup a static file server, but would like to use http proxy for some OS bootstrap workflow, they could modify “repo” option to still use {{ api.server }} for the address of RackHD on-http service (take sample payload as an example):
...
"install-os": {
    "version": "7.0",
    "repo": "{{ api.server }}/Centos/7.0",
    "rootPassword": "root"
}
...