Fully Open Edge Cloud

How-To Upload To Shacache Using Slapcache

Howto properly configure slapcache to upload into shacache
  • Last Update:2021-12-21
  • Version:001
  • Language:en

Generic shacache knowledge

Shacache is a cache to holds any kind of software resources (see homepage).

Shacache come with a generic python egg: slapos.libnetworkcache.

In order to ease the use of slapos.libnetworkcache, RapidSpace team developed a more specific egg: slapcache.

Install slapcache

First install slapcache using pip or pip3 (depending on your installation):

pip install slapcache

This will install 3 binaries:

~$ ls -1 /usr/local/bin/slapcache*
/usr/local/bin/slapcache-conf
/usr/local/bin/slapcache-download
/usr/local/bin/slapcache-upload

Configure slapcache

Then you need to create a generic configuration file by calling "sudo slapcache-conf". This will create the simplest configuration file in /etc/opt/slapcache.cfg to be able to download from shacache using SlapOS Administrators certificate (This is the main feature of slapcache egg).

Then you need to obtain 2 different certificates/key to be able to upload:

  1. HTTPS certificate: in order to connect to shacache.org through HTTPS (required to upload): it will be configured through sha{cache,dir}-{ca,cert,key}-file option. You need to ask an admin of shacache.org to get one
  2. Signing certificate: to sign your uploads: it will be configured through signature-{private-key,certificate}-file options. Either you generate one yourself with the script generate-signature-key from slapos.libnetworkcache (in this case the public key must be added to signature-certificate-list whenever your signature should be accepted) or you get an existing one

When you have both certificate, you need to edit /etc/opt/slapcache.cfg by adding the following lines in the [networkcache] section:

download-dir-url = https://www.shacache.org/shadir

signature-private-key-file = /etc/opt/vifib_shacache_signature.key
signature-certificate-file = /etc/opt/vifib_shacache_signature.cert

upload-cache-url = https://www.shacache.org/shacache
shacache-cert-file = /etc/opt/vifib_upgrader.crt
shacache-key-file = /etc/opt/vifib_upgrader.key
shacache-ca-file = /etc/opt/shacache/ca.crt

upload-dir-url = https://www.shacache.org/shadir
shadir-cert-file = /etc/opt/vifib_upgrader.crt
shadir-key-file = /etc/opt/vifib_upgrader.key
shadir-ca-file = /etc/opt/shacache/ca.crt

 

Make sure to use the proper path for your configuration.