diff --git a/rocketchat/README.org b/rocketchat/README.org new file mode 100644 index 0000000..3f548ef --- /dev/null +++ b/rocketchat/README.org @@ -0,0 +1,81 @@ +# -*- ispell-local-dictionary: "english" -*- +#+SETUPFILE: ~/.emacs.d/etc/setup/latex.setup +#+SETUPFILE: ~/.emacs.d/etc/setup/html-readtheorg-local.setup + +#+TITLE: Rocket.Chat + +* Updating the charm to a new version + +We are using official image. Latest tags usually. You can +double-check available candidate for official images like this: + +#+begin_src sh +docker search rocket.chat +#+end_src + +So we usually pull and test images like this : + +#+begin_src sh +docker pull rocket.chat:X.Y.Z +#+end_src + +This worked on 3.6.3, but changed before 3.8.0 to: + +#+begin_src sh +docker pull rocketchat/rocket.chat:X.Y.Z +#+end_src + +from: https://hub.docker.com/r/rocketchat/rocket.chat + +Get the available tags: + +#+begin_src sh +IMAGE_BASE_NAME=rocket.chat + +## lookup on docker hub only. Could think doing it for any docker +## image identifier available on `pull`. This would mean querying +## other registries, probably with a different api. +docker:lookup_available_tags() { + local image="$1" limit="${2:-10}" filter="$3" eor p + + ## remove any tags on image name + image="${image%%:*}" + + if [[ "$image" == *"/"* ]]; then + username="${image%%/*}" + image="${image##*/}" + else + username="library" + fi + + p=0 + eor= + while [ -z "$eor" ]; do + ((p++)) + out=$(curl -s "https://registry.hub.docker.com/v2/repositories/$username/$image/tags/?page=$p" | + jq -r '."results"[]["name"]') || break + [ -z "$out" ] && break + ## 10 results are expected per request, otherwise + ## this means we are hitting End of Records. + nb_result=$(printf "%s\n" "$out" | wc -l) + [ "$nb_result" -lt 10 ] && eor=true + ## filter records + [ "$filter" ] && out=$(printf "%s\n" "$out" | egrep "$filter") + [ -z "$out" ] && continue + nb_result=$(printf "%s\n" "$out" | wc -l) + if [ "$limit" -le "$nb_result" ]; then + printf "%s\n" "$out" | head -n "$limit" + break + fi + printf "%s\n" "$out" + limit=$((limit - nb_result)) + done + +} + +docker:lookup_available_tags rocketchat/rocket.chat 15 "^[0-9]+(\.[0-9]+)*$" + +#+end_src + +Rocket.chat has a powerfull and working update database that will +take care of migrating database on startup. \ No newline at end of file