Swarm administration¶
Service definition¶
The configuration is stored, checked and dispatched to OnSphere’s modules through the osp-configuration-dispatcher. More information is available in the osp-configuration-dispatcher chapter.
Common configuration of services¶
Each module will generate one service. Each of them has a default configuration provided but in some case you need to modify this configuration to fit your needs. This can be freely done in the OnSphere Git.
The compose file is an aggregate of all the module.service files present in the configuration
, and a list of “generic-compose files” :
Files |
Usage |
---|---|
stack.version |
The version of the compose file |
stack.configs |
The access of the swarm configurations files |
stack.networks |
The configuration of networks |
stack.volumes |
The configuration of volumes |
You can visualize the result of this aggregate directly in portainer.
Default networks¶
Network |
Use |
---|---|
back |
Used by modules to communicate with each other. |
front |
Used by modules that will communicate with the user (through the front-end). |
outside_access |
Used by modules needing to make queries to the outside of the swarm (e.g. a modbus connectors need to establish connections with the modbus slaves). |
portainer |
Used by the |
For more information about the network configuration, you can check the official docker network configuration.
Defaults volumes¶
Warning
Docker swarm does not share volumes between node. See Persistent storage for more information.
The minimum configuration is :
volumes:
osp-git: null
osp-mysql: null
osp-runtime-configuration: null
Volume |
Usage |
---|---|
osp-git |
Contains the stack configuration |
osp-mysql |
Contains the Keycloak configuration (authentication) |
osp-runtime-configuration |
Contains the currently running configuration |
Additional documentation is available at docker volumes documentation.
Configurations¶
This is the link with the configuration provided for this SWARM.
configs:
osp-config-1:
external: true
Additional documentation is available at docker-configs documentation.
Modify the configuration of a service¶
Each service has a file named module.service
. This name is used for the generation of the compose file.
You can add every docker-compose options you want to any service. The only rule is the first line must begin with the name of the service.
Note
You cannot change the name of the osp-services as the internal network routing is done with this naming format.
A typical module.service file looks like this :
osp-alarms:
image: ${{image-repository}}osp-alarms${{image-version}}
networks:
- "back"
- "mongo"
depends_on:
- "osp-configuration-dispatcher"
secrets:
${{auto-generated-secret-access}}
- Where :
${{auto-generated-secret-access}}
is replaced at runtime by the secrets generated by the osp-configuration-dispatcher${{image-repository}}
is replaced by the docker repository from which the image should be retrieved from${{image-version}}
is replaced by the image version tag
Keywords¶
OnSphere provides some keywords to inject elements on the generated stack file (e.g to open a port when the debug mode is enabled).
There are two types of keywords.
Line¶
This type of keywords will replace the entire line.
keyword |
Usage |
---|---|
|
The line is replaced by the _TAG_ on debug mode with ‘-’ at the beginning of the line |
|
Internal usage only : Is replaced by the generations of secret for all services. This field is mandatory in the stack.secrets files |
|
Gives access to auto-generated module certificates signed by the local CA, usable only in services section ()not for external-services) |
|
Appends the default logger configuration from the content of the file service-default-logger |
|
Generates the port declaration of the service - i.e. |
|
This value is replaced with a port declaration to expose the given port if the service is in debug mode. This keyword must be placed inside the service port declaration. The _FIRST_PORT_ must be replaced by the mapping port on the container. e.g., if debug is accessible via port 5005 on the container, |
|
Insert _PORT_DEF_ if a remote connector is used in the configuration. This keyword must be placed inside the service port declaration. e.g. |
|
Is replaced with |
|
Creates an environment variable |
|
Creates an environment variable |
In place¶
This type of keywords will only replace itself, allowing it to be injected into a line
keyword |
Usage |
---|---|
|
Is replaced by the stack-id |
|
Is replaced by the image repository configured in the configuration dispatcher module. |
|
Is replaced by the image version configured in the configuration dispatcher module. |
|
Is replaced by the service name of the current module |