Mount volumes, configs...
This guide allows you to describe, inside your inventory, volumes, configs and secrets files containers have access to once they have booted.
You should avoid any manual operation that can be fully automated by Ansible : connecting NFS to your container, creating local folders, mounting config and secret files inside services...
All configurations that describe platform deployment should be shared under source control.
Docker Swarm cannot update volume definitions on-the-fly. If you do an update on an existing Docker Swarm volume, please shutdown the REGARDS stack then run it again using regards.yml.
This issue does not concern configs, secrets and new Docker Swarm volume.
Inventory configuration file
The REGARDS convention is to save these information inside :
inventories/<your inventory>/group_vars/regards_nodes/mounts.yml
If you don't have the mounts.yml file, you can initiate it with the following code, which is the default mounting if you don't have it yet:
# Define volumes, REGARDS volumes, configs and secrets
group_docker_mounts:
# Define NFS configurations used by REGARDS volumes
nfs: []
# Allow some files inside <inventory>/group_vars/regards_nodes/files/... to be attached
# to frontend / workers containers as Secret file (read only)
secrets: []
# Allow some files inside <inventory>/group_vars/regards_nodes/files/... to be attached
# to frontend / workers containers as Config file (read only)
configs: []
volumes: []
regards:
# Common input folder for dataprovider, fem, ingest and storage
data_inputs: []
The default configuration does not use any NFS server, all files are considered to be stored locally on the main server by the playbook. Thus, you should deploy REGARDS on one single node.
If you have more than one server, the default configuration is insufficient: if a running container on node1 writes some files on its local disk workdir and reboots on node2, it won't find its file unless you reboot the service on node1.
NFS definition
You can define a list of Network File System servers REGARDS will connect to as following:
group_docker_mounts:
nfs:
- name: nfs-regards-qua
config:
o: rw,relatime,vers=4.0,[...],addr=<nfs server adress>
device_prefix: "<nfs domain name when existing>:/path/to/regards/workspace/"
- name: nfs-mission1
config:
o: rw,relatime,vers=4.0,[...],addr=<nfs server adress>
device_prefix: "<nfs domain name when existing>:/MISSION1"
This example defines 2 NFS :
- a NFS server
nfs-regards-quaused by REGARDS on the Qualification environment to store its files (cache, workdir..) - a NFS server
nfs-mission1that holds products for the missionMISSION1
| Field Name | Mandatory | Description |
|---|---|---|
| name | x | Unique identifier of the NFS server |
| config.o | x | NFS configuration to connect to |
| config.device_prefix | x | Prefix of the path inside the NFS server every volume share. Must be accessible by the REGARDS runtime docker user |
| config.type | (Default value nfs) - Driver used by Docker swarm |
You will be able to use the same NFS server, using its name, on several mount definitions. See Volume definition, Data inputs and Workdir configuration.
Data inputs
Data inputs configuration allow you to define a Docker Swarm volume that is automatically mounted on dataprovider, fem, ingest and storage services.
It allows REGARDS to access to your data.
group_docker_mounts:
[...]
regards:
data_inputs:
- name: local-input-datastore
local: true
source: "{{ group_workdir_local }}{{ group_stack_name }}/workspace/regards/input"
destination: /input
- name: mission1-datastore
nfs: nfs-mission1
device_postfix: ""
destination: /data/MISSION1
| Field Name | Mandatory | Description |
|---|---|---|
| name | x | Name of the Docker Swarm volume (must be unique) |
| destination | x | Mount path inside the container |
| local | (Default value false) - Mount a local path from the server | |
| source | When local=true | Mount a local path from a host server to the container |
| nfs | When local undefined | Identifier of the NFS server defined in group_docker_mounts.nfs |
| device_postfix | When nfs provided | (Default value is an empty string) A postfix path to add to the nfs.device_prefix to obtain the path inside the NFS server. final path = nfs.device_prefix + device_postfix |