Creating your own MinIO server

This is also conveniently available as a Docker image. It is recommended to run this on a dedicated host because the storage that's involved can grow quite large, and you don't want this service to take down any other service that is running on that host.

Run the container with the following command:

docker run -it -p 9005:9000 -v ~/.minio:/root/.minio -v /s3:/export --name caching-server minio/minio:latest server /export

Take note of the /s3 volume that is mounted in the container, which will serve as the directory that stores the cached objects.

The output of the preceding command will appear after some time:

latest: Pulling from minio/minio
e7c96db7181b: Already exists
94d4d681d0f2: Pull complete
664c3f016f88: Pull complete
b3235cce6961: Pull complete
Digest:sha256:244c711462a69303c0aa4f8d7943ba8b36dd55246e29da44c6653e39eaa42e70
Status: Downloaded newer image for minio/minio:latest

The container image will be downloaded.

After that, the MinIO container will start and report the location it uses, as well as AccesKey and SecretKey, which are to be used by the runners:

Endpoint:  http://172.17.0.4:9000  http://127.0.0.1:9000
AccessKey: xxx
SecretKey: xxx

We will demonstrate the usage of the cache by building a Node.js example project. It contains a node_modules directory, which we specify as a cached location in the .gitlab-ci.yml file.

When you build the Node.js project using a GitLab Runner, it will report its use of the cache in the Runner job log file:

node_modules/: found 5728 matching files          
Uploading cache.zip to http://192.168.178.82:9005/joustie-gitlab-runner-cache/project/14/default
Created cache
Job succeeded

When we looked on the dedicated machine where the MinIO container was running, we found the following directory structure when we typed in the tree command in /s3 (this is the directory that's used by the MinIO Docker container to store objects):

$tree
.
└── joustie-gitlab-runner-cache
└── project
└── 14
└── default

3 directories, 1 file

We ran the GitLab Runner job again, which found cache.zip in the MinIO bucket.

This was an example of using a single runner. However, you may want to use these options to scale your Runner instances. Let's look at this in the next section.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.149.243.32