Add more documentation

Document the scheduled job to clean docker images.
Document the versions of java, clojure, and graal used to build native image.
Mention official garbage collect rather than distribution pruner.
Signed-off-by: Snorre Magnus Davøen's avatarSnorre Magnus Davøen <snorre.davoen@nsd.no>
parent 69dc21c4
Pipeline #45231 passed with stages
in 2 minutes and 33 seconds
......@@ -4,9 +4,17 @@ A simple Clojure command line app to instruct GitLab to clean Docker image tags
It uses the GitLab REST API (v4) to retrieve project information and sending bulk deletion requests for tags.
The app can be used to list projects and their number of registry repositories and tags as well.
The app is meant to be used in conjunction with [GitLab's docker-distribution-pruner](https://gitlab.com/gitlab-org/docker-distribution-pruner).
The `docker-distribution-pruner` cli app seems to delete more of the orphaned image data than the built in `gitlab-ctl registry-garbage-collect`.
For this reason you should probably use `docker-distribution-pruner` after running containinator.
The app is meant to be used in conjunction with [GitLab's registry garbage collection feature](https://docs.gitlab.com/omnibus/maintenance/#container-registry-garbage-collection).
You want to use the `-m` option to properly collect/recycle image layers for unused tags.
## Automatic docker image cleanup
The containinator project includes a `.gitlab-ci.yml` file that defines a scheduled job to run the contianinator 'terminate-tags' task.
It runs the job once every week per the current [schedule](https://gitlab.nsd.no/ops/containinator/pipeline_schedules).
The scheduled job does not run the `terminate-pipelines` task, but this task is probably not necessary to run all that often.
When you create a new version of the code make sure to build a Docker image and push it to the GitLab container registry of this project.
This way you can use it in the `.gitlab-ci.yml` job.
## Installation
......@@ -41,26 +49,28 @@ The Docker image is based on the `adoptopenjdk/openjdk12` image and thus bundles
./containinator --help
```
There are two sub-commands in the app:
There are three sub-commands in the app:
- locate
- terminate
- terminate-tags
- terminate-pipelines
The `locate` command lists projects and key stats about the project's container registry.
The `terminate` command sends bulk tag deletion commands for all projects with a container registry.
The `terminate-tags` command sends bulk tag deletion commands for all projects with a container registry.
The `terminate-pipelines` command sends commands to delete pipelines for all projects containing pipelines.
## Examples
```bash
./containinator -Djava.library.path=$JAVA_HOME/lib/ --token <yourtoken> --gitlab https://gitlab.<yourdomain>.<tld> locate --sort tag-count --limit 20 -f tag-count -f registry-count
./containinator -Djava.library.path=$JAVA_HOME/lib/ --token <yourtoken> --gitlab https://gitlab.<yourdomain>.<tld> locate --sort tag-count --limit 20 -f tag-count
Locating projects for given arguments on https://gitlab.nsd.no Please be patient, it could take some time.
| :id | :name | :registry-count | :tag-count |
|-----+-----------------------+-----------------+------------|
| 123 | project-a | 1 | 28 |
| 242 | project-b | 1 | 27 |
| :id | :name | :tag-count |
|-----+-----------------------+------------|
| 123 | project-a | 28 |
| 242 | project-b | 27 |
```
......@@ -94,6 +104,12 @@ sudo apt-get install build-essential libz-dev zlib1g-dev
Add `/path/to/graal-vm/bin` to your `$PATH`, and a `$GRAALVM_HOME` to point to `/path/to/graal-vm`.
The build was last performed with:
- openjdk version "13" 2019-09-17
- GRAALVM_VERSION=19.3.0
- Clojure (tools deps) 1.10.1.478
### To build a Docker image:
Ensure that the `libsunec.so` command is present in the project root.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment