Modifying containers on the location server
The platform uses the /opt/ispsystem/dci/etc/location.yaml configuration file to configure the docker containers on the location server. The Docker Compose format is used to describe the configuration.
You can edit the configuration by using the patch (modification) mechanism. Patches allow you to add files, environment variables and additional services to docker containers.
Example of creating a patch
This example shows how to change the IMPITOOL_PATH environment variable. After performing these actions in the eservice_handler docker container, the /usr/bin/ipmitool_1.8.19 file will be used to run the ipmitool utility.
- Connect to the location server via SSH.
Create a patch.yaml file with the following content:
patch.yaml
version: "3.5" services: eservice_handler: environment: IPMITOOL_PATH: "/usr/bin/ipmitool_1.8.19"
CODEEncode the contents of patch.yaml as per Base64:
echo -ne "patch.yaml" | base64
BASHSave the command response.
Example of response
cGF0Y2gueWFtbA==
CODE- Get the authorization token:
curl -k -X POST -H "accept: application/json" -H "Content-Type: application/json" 'https://domain.com/auth/v4/public/token' -d '{"email": "admin_email", "password": "admin_pass"}'
CODEComments to the commanddomain.com — domain name or IP address of the server with the platform
admin_email — platform administrator's email
admin_pass — platform administrator's password
In response, you will get the message in the form:
Example of response in JSON
{ "confirmed": true, "expires_at": null, "id": "6", "token": "4-e9726dd9-61d9-2940-add3-914851d2cb8a" }
CODESave the received token value.
Execute the API request:
curl -k -# -d '{"patches":[{"name":"<patch_name>","patch":"<patch_base64>"}]}' -H "Cookie: ses6=<token>" -H "x-xsrf-token: <token>" -o- "https://domain.com/dci/v3/location/<location_id>/setup"
BASHComments to the command<patch_name> — discretionary name of the patch. After the request has been executed, the patch will be saved in the /opt/ispsystem/dci/etc/<patch_name>.yml file on the location server
<patch_base64> — contents of the patch encoded as per Base64
<token> — authorization token
domain.com — domain name or IP address of the platform server
<location_id> — location ID
DCImanager 6 will start setting up the location, taking into account the created patch.
Managing patches
You can manage patches through API queries.
Add patches
curl -k -# -d '{"patches":[{"name":"<patch1_name>","patch":"<patch1_base64>"},{"name":"<patch2_name>","patch":"<patch2_base64>"},{"name":"<patch3_name>","patch":"<patch3_base64>"}]}' -H "Cookie: ses6=<token>" -H "x-xsrf-token: <token>" -o- "https://domain.com/dci/v3/location/<location_id>/setup"
If patches have already been applied to the location, specify them in the patches list. Patches not listed will be deleted from the location.
Get a list of patches used
curl -k -# -X GET -H "Cookie: ses6=<token>" -H "x-xsrf-token: <token>" -o- "https://domain.com/dci/v3/location/<location_id>"
The response of the command will contain the patches parameter with data about the patches.
Deleting all patches
curl -k -# -d '{"patches":[]}' -H "Cookie: ses6=<token>" -H "x-xsrf-token: <token>" -o- "https://domain.com/dci/v3/location/<location_id>/setup"
<patchX_name> — discretionary name of the patch. After the request has been executed, the patch will be saved in the /opt/ispsystem/dci/etc/<patch_name>.yml file on the location server
<patchX_base64> — contents of the patch encoded as per Base64
<token> — authorization token
domain.com — domain name or IP address of the platform server
<location_id> — location ID
Managing modified containers
Use the script /opt/ispsystem/dci/etc/location_compose.sh to start and stop the modified containers on the location server. The platform generates a script automatically and includes information about all the patches that need to be run on the location. If you do not use the script, the current patches will be deleted when you restart the containers.
Starting all services
/opt/ispsystem/dci/etc/location_compose.sh up -d
Stopping all services
/opt/ispsystem/dci/etc/location_compose.sh down