Uploading the custom configuration
After you register your custom image, you must modify the JSON configuration file that you downloaded and then upload it to the IBM® Software Hub cluster under a new name.
Prerequisites: Get an authorization token and export it as the MY_TOKEN
environment variable. See Generating an
API authorization token.
- Open the JSON configuration file that you downloaded in an editor.
- Find the line that contains the
"image"attribute. It has the following format"image":"<image registry>/<image name>:<image tag>, and contains a value such as"image": "<private-registry>/wslocal-runtime-241-py@sha256:f21b54dee335c9a39de5980a41ac2a422a2bda8820b91da005dba53ba5857434" - Replace
name,display_name,description, andauthorwith your own data. Ifnameconsists of several words, separate each word with a hyphen (for example,custom-def-name). Thenamemust be unique among all runtime definitions of IBM Software Hub. The unique name that you provide appears in the Software version dropdown when an environment template is created. - Use the registry URL that you used when you registered the custom image.
- Change
<image name>:<image tag>to the values that you used when you registered your custom image. - Optional: Set user-defined variables. See Setting user-defined variables.
- Save the file.
- Create a runtime definition with the settings that are defined in the JSON file by using the API:
curl -k -X POST -H "Authorization: ZenApiKey ${MY_TOKEN}" -H "Content-Type:application/json" "${CPD_URL}/v2/runtime_definitions" -d @</path/to/runtime/def/><custom-def-file-name>.jsonNote:</path/to/runtime/def/>is the path to the runtime definition JSON file on your local computer.- In case of Python requests, you can pass the payload inline. For example
requests.post(..., data=<content of custom-def-file-name.json file>) - You cannot skip the
@symbol. This symbol is mandatory.
If the creation of the runtime definition is successful, you receive a response that contains a GUID that can you can use to retrieve, update or delete the runtime definition.
- Make sure that each compute node prepulls the new custom image. See Image download optimization.
Setting user-defined variables
You can add arbitrary environment variables to the runtime, for example if you want users to be able to access the Web through a proxy.
The variables that you add must be prefixed with _userdefined_. If you want to
set the http_proxy variable, the variable must to be named
_userdefined_http_proxy. If this prefix is missing, the variable is filtered out
and is not available in the runtime.
env
section to the top level of the JSON configuration file. See an example:
"env": [
{
"name": "_userdefined_http_proxy",
"value": "http://proxy:3129"
},
{
"name": "_userdefined_https_proxy",
"value": "http://proxy:3129"
}
],LD_LIBRARY_PATH
because this might lead to breaking changes. If you decide to modify this variable, make sure that
you include the current value of the variable in addition to your changes.Get the current value by starting the runtime and running the following command:
!printenv LD_LIBRARY_PATH