CloudRepo Edge storage
Your Edge keeps a copy of every file your builds pull, so the next pull comes from your own network. It keeps that copy in one place: the VM’s own disk, or an S3 bucket of your own. Pick one. The Edge will not start with both, or with neither.
Both live in /etc/cloudrepo-edge/edge.env, the settings file from step 3 of the install guide.
On the VM’s own disk
Section titled “On the VM’s own disk”This is what the install guide sets up:
EDGE_HOST=your-org.mycloudrepo.ioEDGE_INGRESS=your-org.mycloudrepo.io:443EDGE_API_URL=https://api.cloudrepo.ioEDGE_STORE_DIR=/var/lib/cloudrepo-edge/storeEDGE_SPOOL_DIR=/var/lib/cloudrepo-edge/spoolEDGE_STORE_DIR is where the copy lives. There is no size to set: the store uses the disk it is on. When a new file
would leave less than 20% of that disk free, the Edge first removes the files your builds pulled longest ago, until
30% is free. It never writes past the last 5%. Past that, a pull still works: the Edge serves it from CloudRepo and
does not keep it. To keep more, give the store a disk of its own.
EDGE_SPOOL_DIR holds each file while it arrives, before it joins the store. Keep it with either store.
In an S3 bucket of your own
Section titled “In an S3 bucket of your own”What the bucket needs:
- A bucket for this Edge alone, and a key for that bucket alone that can read, write and list its objects.
- Support for writes with
If-None-Match: *, which the Edge uses to claim the bucket. - Path-style addressing: your provider’s endpoint, then the bucket’s name as the whole path.
In /etc/cloudrepo-edge/edge.env, take out the EDGE_STORE_DIR line and put the bucket’s lines in its place:
EDGE_HOST=your-org.mycloudrepo.ioEDGE_INGRESS=your-org.mycloudrepo.io:443EDGE_API_URL=https://api.cloudrepo.ioEDGE_BUCKET_URL=https://s3.example.com/cloudrepo-edgeEDGE_BUCKET_REGION=us-east-1EDGE_SPOOL_DIR=/var/lib/cloudrepo-edge/spoolEDGE_BUCKET_URL is your endpoint and the bucket’s name. It starts with https://, or http:// for a bucket
inside your own network. EDGE_BUCKET_REGION is the bucket’s region, us-east-1 if you leave it out.
The bucket’s key
Section titled “The bucket’s key”Copy the key from your own secret store. First make its two files, open to the Edge’s user alone:
sudo install -o 65532 -g 65532 -m 0600 /dev/null /etc/cloudrepo-edge/bucket/access-key-idsudo install -o 65532 -g 65532 -m 0600 /dev/null /etc/cloudrepo-edge/bucket/secret-access-keyPut your access key id in the first file. Run this command on its own, paste the id, press Enter, then Ctrl-D:
sudo tee /etc/cloudrepo-edge/bucket/access-key-id >/dev/nullPut your secret access key in the second file the same way:
sudo tee /etc/cloudrepo-edge/bucket/secret-access-key >/dev/nullYour own certificate authority
Section titled “Your own certificate authority”Skip this if a public CA signed your bucket’s certificate. If your own CA signed it, as it often does for storage
inside your network, put that CA’s certificate (PEM, here bucket-ca.pem) beside the key:
sudo install -o 65532 -g 65532 -m 0600 bucket-ca.pem /etc/cloudrepo-edge/bucket/ca.pemThen add this line to /etc/cloudrepo-edge/edge.env:
EDGE_BUCKET_CA_FILE=/var/run/cloudrepo-edge/bucket/ca.pemThat is where the Edge sees the key’s directory, so the file needs no mount of its own. The Edge then checks your
bucket’s certificate against this CA alone, and uses it for nothing else. The file is mode 0600 and at most 64 KiB of
PEM certificates, and the bucket’s URL must start with https://. If anything is wrong with it, the Edge stops before
it sends anything, and its log names EDGE_BUCKET_CA_FILE and what is wrong.
Register with the bucket
Section titled “Register with the bucket”With a bucket, step 4 of the install guide registers the Edge with a different command. Use the one in the install
guide’s “Keep the store in an S3 bucket” section, in place of step 4’s last command. It mounts the key’s directory,
/etc/cloudrepo-edge/bucket, where the Edge reads it, and leaves out the store’s directory, which a bucket does not
use. If a key file is missing or the bucket cannot be read, register stops and says what is wrong, and your join
token is not spent.
Check the bucket
Section titled “Check the bucket”The Edge’s health checks pass even when the bucket is out, because the Edge then serves every pull from CloudRepo and
keeps nothing. So read the Edge’s log too: a line with "level":"WARN" that names the bucket says what is wrong.