Croit offers a simple file server mechanism in case you want to serve some files to your croit nodes. Our API has 2 endpoints to serve files, one is unauthenticated and anyone that can connect to the API can download these files, and the other is authenticated using credentials of a croit user.
Unauthenticated endpoint extra-file
You can put files into the /config/extra-files
directory inside the docker container (you may need to create this directory). Those files are then accessible via the API endpoint api/extra-files/path/to/file
.
For example, create a file on the management node:
mkdir /config/extra-files
echo "test" > /config/extra-files/example.txt
Then, on a croit node, you can load this file:
CROIT_API=$(cat /proc/cmdline | sed 's/.*croit-api=\([^ ]*\) .*/\1/')
unset http_proxy
curl http://$CROIT_API/api/extra-files/example.txt > example.txt
By default, croit nodes are configured to use apt-cacher-ng
running on the management node as an HTTP proxy. This is done to cache operating system packages installable from repositories so that the cluster does not download them multiple times. However, apt-cacher-ng
only allows downloading packages from repositories and disallows everything else, including the request for the extra file attempted by curl
. That’s why this preconfigured proxy needs to be bypassed.
Note that curl
is only an example here. The instruction (
) is general enough so that it works with other commands.unset http_proxy
Authenticated endpoint extra-files-secure
(starting with croit v2201.1)
You can put files into the /config/extra-files-secure
directory inside the docker container (you may need to create this directory). Those files are then accessible via the authenticated API endpoint api/extra-files-secure/path/to/file
.
For example, create a file on the management node:
mkdir /config/extra-files-secure
echo "test" > /config/extra-files-secure/example.txt
And create a user under Settings > User management
with the Secure folder
role:
Then, on a croit node, you can load this file:
CROIT_API=$(cat /proc/cmdline | sed 's/.*croit-api=\([^ ]*\) .*/\1/')
unset http_proxy
curl --user readuser:password http://$CROIT_API/api/extra-files-secure/example.txt > example.txt
Contact us!
croit GmbH
Freseniusstrasse 31h
81247 Munich
Germany
croit North America Inc
6800 Weiskopf Avenue
Suite 150 PMB #1786
McKinney
TX 75070