Bootstrapping

Bootstrapping

Bootstrapping is a way to run internal processes routinely and uniformly to manage your software environment and version control. It helps with automated software development methods like Continuous Integration and Continuous Deployment (CI-CD) and Automated Testing.

We added bootstrapping to version 1.16.6 of our Veracity Learning LRS. This new feature lets you briefly invoke your instance of Veracity Learning to automatically create objects, such as user accounts, LRSs, API keys, and more! 

Alternatively, you can tell the software to read a JSON file that configures the objects. In the command line (or in an .env file), you set the path to the JSON file under the parameter, bootstrap.

Although you can create objects with a bootstrap script, you cannot modify objects. Moreover, you must use a valid schema to define the new objects. Check the OpenAPI documentation for explicit schemas. 

Example Bootstrap Command and File

The following command line example executes the Veracity Learning app, calls an example JSON file (a copy of which is in the Attachments at the bottom of this article), sets logging parameters, and then quits…

Example Command Line:
./lrs2-win.exe --bootstrap=./bootstrapTest.json --logLevel=debug --logSources=bootstrap --continue=false
Notes
Unless you explicitly set the value for continue to true, the server will shut down after processing the bootstrap file.

In the Attachments at the bottom of this article, you can find an Example File that creates three objects in the parent models property. First, it creates a super-admin user with full system permissions. Next, the file creates two LRSs, one with a basic auth xAPI access key and a forwarding route to the other. Finally, the JSON file creates a system management API key to further manage the system using REST API.

Model Names

The top-level of the JSON file exports a single object: a models property. This parent property contains objects whose property names align with the API model names of the System-Level API. 

There is one special case: the lrs object. Alongside its own properties (as defined within the schema). the child lrs object may contain another inner models property. The objects defined in the lrs models property mirror the outer structure, with each key name being a model name, but from the LRS-Level API.

During bootstrapping, you must name objects in both models properties using their internal names, not the names used in the API. The tables below translate the API object names to the internal object names to use when bootstrapping:

System Level
Model name in API
Model name in bootstrap
lrs
lrs
apikey
apikey
user
user
rateLimit
rateLimit
plugins
pluginConfig

LRS Level
Model name in API
Model name in bootstrap
statementViewerReport
statementViewerReport
statements
statement
upstreams
upstreamLRS
xapi-access-keys
key
api-keys
apikey
logs
clientLog
embeddableCharts
embedableChart
embeddableDashboards
embedableDashboard
plugins
pluginConfig
dashboards
customDashboard
scripts
script