Skip to content

Shared caching (S3-compatible)

Kamil Trzcińśki requested to merge shared-caching into master

This implements support for external caching server, it has to be S3-compatible server.

The GitLab Runner when restoring and archiving cache will ask S3-server and download or upload the archive.

This allows to use separate machines (auto-scaling: https://gitlab.com/gitlab-org/gitlab-ci-multi-runner/merge_requests/53) and have a full caching support.

To enable caching define that in config.toml:

    [runners.cache]
    Type = "s3"
    ServerAddress = "address.com"
    AccessKey = "access-key"
    SecretKey = "secret-key"
    BucketName = "runner"
    Insecure = false

As S3-compatible server you can use: https://www.minio.io/:

# Create a new VM, you can also use that with Web interface or use any already provision Docker server
docker-machine create -d digitalocean \
    --digitalocean-image=coreos-beta \
    --digitalocean-ssh-user=core \
    --digitalocean-access-token=digital-ocean-token \
    --digitalocean-region=nyc2 \
    --digitalocean-size=8gb \
    --digitalocean-private-networking \
    gitlab-runner-cache-server
docker-machine ssh gitlab-runner-cache-server

# Start minio S3-compatible server
# You can replace 34233 with any port
docker run -it --restart always -p 34233:9000 -v /.minio:/.minio -v /export:/export --name minio minio/minio:latest server /export

# Check Access Key and Secret Key
sudo cat /.minio/config.json

# Create bucket
sudo mkdir /export/runner

# Check IP address of server
ifconfig eth0
# or
ifconfig eth1

# Put the IP in GitLab Runner config.toml:
[runners.cache]
Type = "s3"
ServerAddress = "ip-address:34233"
AccessKey = "access-key"
SecretKey = "secret-key"
BucketName = "runner"
Insecure = false

Merge request reports