From aa7337cfebfff3f5c0326451049bb39fbda77ab5 Mon Sep 17 00:00:00 2001 From: Steve Shipway Date: Fri, 4 Mar 2016 01:45:37 +0000 Subject: [PATCH] Add Janitor container definition --- templates/janitor/0/docker-compose.yml | 15 +++++++++++ templates/janitor/0/rancher-compose.yml | 25 ++++++++++++++++++ templates/janitor/README.md | 16 ++++++++++++ templates/janitor/catalogIcon-janitor.svg | 31 +++++++++++++++++++++++ templates/janitor/config.yml | 7 +++++ 5 files changed, 94 insertions(+) create mode 100644 templates/janitor/0/docker-compose.yml create mode 100644 templates/janitor/0/rancher-compose.yml create mode 100644 templates/janitor/README.md create mode 100644 templates/janitor/catalogIcon-janitor.svg create mode 100644 templates/janitor/config.yml diff --git a/templates/janitor/0/docker-compose.yml b/templates/janitor/0/docker-compose.yml new file mode 100644 index 0000000..5cce2d9 --- /dev/null +++ b/templates/janitor/0/docker-compose.yml @@ -0,0 +1,15 @@ +cleanup: + image: meltwater/docker-cleanup:1.4.0 + environment: + CLEAN_PERIOD: ${FREQUENCY} + DELAY_TIME: "900" + KEEP_IMAGES: ${KEEP} + labels: + io.rancher.scheduler.global: "true" + io.rancher.scheduler.affinity:host_label_ne: ${EXCLUDE_LABEL} + privileged: true + tty: true + stdin_open: true + volumes: + - /var/run/docker.sock:/var/run/docker.sock + - /var/lib/docker:/var/lib/docker diff --git a/templates/janitor/0/rancher-compose.yml b/templates/janitor/0/rancher-compose.yml new file mode 100644 index 0000000..ca4ae8b --- /dev/null +++ b/templates/janitor/0/rancher-compose.yml @@ -0,0 +1,25 @@ +.catalog: + name: "Janitor" + version: "v1.4.0" + description: "Docker cleanup" + uuid: janitor-0 + questions: + - variable: "FREQUENCY" + label: "Frequency" + description: "Run the cleanup on a cycle of this many seconds" + default: 3600 + required: true + type: "int" + - variable: "EXCLUDE_LABEL" + label: "Exclude label" + description: "Specify a Rancher host label here that will be used to determine on which hosts the container should not deploy." + default: janitor.exclude=true + required: true + type: "string" + - variable: "KEEP" + label: "Keep images" + description: "A comma separated list of images that should never be removed" + default: "rancher/agent:v0.8.2,rancher/agent-instance:v0.6.0" + required: false + type: "string" + diff --git a/templates/janitor/README.md b/templates/janitor/README.md new file mode 100644 index 0000000..df71318 --- /dev/null +++ b/templates/janitor/README.md @@ -0,0 +1,16 @@ +# Janitor + +### Topology + +A Janitor instance will be started on every host that does not match the +scheduling rule (default is `janitor.exclude=true`). + +### Operation + +This will run a task daily (by default) that will delete any unused +image, and any orphaned volume. The rancher container images are excluded +from the list of images to clean up. + +This will halp to prevent the /var/lib/docker filesystem from filling up +with old and unused container images. + diff --git a/templates/janitor/catalogIcon-janitor.svg b/templates/janitor/catalogIcon-janitor.svg new file mode 100644 index 0000000..936390a --- /dev/null +++ b/templates/janitor/catalogIcon-janitor.svg @@ -0,0 +1,31 @@ + + + + Layer 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/templates/janitor/config.yml b/templates/janitor/config.yml new file mode 100644 index 0000000..aa8322e --- /dev/null +++ b/templates/janitor/config.yml @@ -0,0 +1,7 @@ +name: Janitor +description: | + Automatic cleanup of unused images on hosts, in order to save disk space. +version: v1.4.0 +category: monitoring +maintainer: Steve Shipway +