SONM supports several ways for data transfer. The easiest way to do this is to use the BTFS and CIFS Docker volume plugins.
To use CIFS plugin you need access to working Samba server. If you don't have one — you'll need to configure it first. CIFS plugin mounts shared directories content at specified mount point.
Config your container: section in task description file(task.yaml): Add subsections volumes: and mounts: as follows:
volumes:
cifs:
type: cifs
options:
share: <samba.serv.com/share>
username: <username>
password: <password>
mounts:
- cifs:<mount_point>:<mount_mode>
You need to define following variables here:
container:
image: [email protected]:b5f21641a9d7bbb59dc94fb6a663c43fbf3f56270ce7c7d51801ac74d2e70046
commit_on_stop: false
volumes:
cifs:
type: cifs
options:
share: 46.101.106.116/share/
username: sonm
password: pass
mounts:
- cifs:/mnt/samba:ro
This task.yaml example will launch Httpd container from whitelist and mount shared folder Share from 46.101.106.116 at /mnt. Note that due security reasons Read-Write mode for this particular shared folder on 46.101.106.116 is disabled. On your own Samba server you can change that and mount your shared directory in any mode.
BTFS, is the acronym for bittorent filesystem. Using BTFS, you can mount magnet link as a directory and then use it as any read-only directory in your file tree. The contents of the torrent file or magnet link will be mounted inside the directory of your choice. When a program tries to access the file for reading, the actual data will be downloaded on demand. Furthermore, tools like ls, cat and cp works as expected.
In case you need to transfer large amount of data to multiple instances - BTFS will be much faster than CIFS. Note that BTFS mounts directories in Read-only mode. So if you need to pull results of computation back - you need to use different ways to get it.
Config your container: section in task description file(task.yaml): Add subsections volumes: and subsection mounts: as follows:
volumes:
btfs:
type: btfs
options:
magnet: "<magnet_link>"
mounts:
- btfs:<mount_point>:ro
You should define magnet_link and mount_point here - contents of magnet_link will be mounted at mount_point. Default mount point is /mnt
.
You can create magnet link by any convenient Bittorrent client(UTorrent/Transmission for example).
Important! Note that mounting BTFS volume may take some time: it can take about ~10-15 seconds. Your application should check if data is mounted before working with it.
container:
commit_on_stop: false
image: [email protected]:b5f21641a9d7bbb59dc94fb6a663c43fbf3f56270ce7c7d51801ac74d2e70046
volumes:
btfs:
type: btfs
options:
magnet: "magnet:?xt=urn:btih:9635cabd201a92fda5d6c70d35cbfb707e290589&dn=ubuntu-18.04.1-live-server-amd64.iso&tr=http%3A%2F%2Ftorrent.ubuntu.com%3A6969%2Fannounce&tr=http%3A%2F%2Fipv6.torrent.ubuntu.com%3A6969%2Fannounce"
mounts:
- btfs:/mnt:ro
This task.yaml example will launch Httpd container from whitelist and mount Ubuntu 18.04 Server installation disk inside /mnt