Setting up Dev Environment¶
This page is intended for people who are building Digital Rebar Provision from sources or contributing to the code base. We maintain inline documentation and test environment and contributors are expected to participate in maintenance of those efforts.
Note
Prerequisites: go version 1.16 or better. These documents expect ability to both install and update Golang.
Developer Quick Start¶
You will need to get the provision source tree.
go get -u gitlab.com/rackn/provision
go get -u gitlab.com/rackn/provision-plugins
go get -u gitlab.com/rackn/provision-server
If more details on how to run the result are needed, consult the Production Install section. The install.sh script can be used to install from the source directory after a build.
Building The API¶
After the code and assets have been obtained once, the process can be repeated from the project root with the following command:
Another reason to use the tools/build.sh script is that it will inject version information into the built binaries to make it easier to track what version is deployed. Developer builds and production builds will be identifiable through the version command on both the server and the cli.
Note
If you have performed a previous build and generated assets are updated, you may need to delete [embedded]{.title-ref} directory and checkout [git checkout --embedded]{.title-ref} then rebuild to ensure that the server can start. This problem manifests with the error: [No such embedded asset chain.c32: Asset chain.c32 not found]{.title-ref}
Running the Tests¶
Digital Rebar Provision uses the Golang test libraries and the development team works hard to maintain test coverage.
The tools/test.sh
in the provision root directory is the main way to test the entire code base.
To test individual modules from their subdirectories run: go test
How to get Swagger-Ui¶
DigitalRebar Provision uses Swagger to generate interactive help for the API. This is in the tree by default. If an update is needed, do the following in the file swagger-initializer.js:
Packaging the Code¶
Once the code is built, the code can be package for storage in GitLab or for use by the install.sh script.
Running the tools/package.sh script will generate a dr-provision.zip and dr-provision.sha256 file. These files can be used with the rs_install process.