From a2dcf7a79a3c9da4a54aff9f8396d12ad4238ca6 Mon Sep 17 00:00:00 2001 From: Simon Beck Date: Mon, 18 Nov 2024 16:30:27 +0100 Subject: [PATCH] Add documentation how to backfill billingdata It sometimes happens that Odoo is not available for a certain amount of time. --- .../how-tos/appcat/backfill_billing.adoc | 21 +++++++++++++++++++ docs/modules/ROOT/partials/nav.adoc | 3 +++ 2 files changed, 24 insertions(+) create mode 100644 docs/modules/ROOT/pages/how-tos/appcat/backfill_billing.adoc diff --git a/docs/modules/ROOT/pages/how-tos/appcat/backfill_billing.adoc b/docs/modules/ROOT/pages/how-tos/appcat/backfill_billing.adoc new file mode 100644 index 00000000..de392db5 --- /dev/null +++ b/docs/modules/ROOT/pages/how-tos/appcat/backfill_billing.adoc @@ -0,0 +1,21 @@ += Backfil Billing Data + +It might happen that Odoo is down for more than 3 hours. +In that case we need to backfill the billing data for VSHN services. + +== Script of lesser doom + +In accordance to the https://git.vshn.net/aline.abler/scriptofdoom[scriptofdoom.sh], we came up with a slightly less doomy script: + +[source,bash] +---- +while read -r cronjob rest +do + echo $cronjob + kubectl --as cluster-admin -n syn-appcat create job --from cronjob/$cronjob $cronjob --dry-run -oyaml | yq e '.spec.template.spec.containers[0].args[0] = "appuio-reporting report --timerange 1h --begin=$(date -d \"now -12 hours\" -u +\"%Y-%m-%dT%H:00:00Z\") --repeat-until=$(date -u +\"%Y-%m-%dT%H:00:00Z\")"' | kubectl --as cluster-admin apply -f - +done <<< "$(kubectl --as cluster-admin -n syn-appcat get cronjobs.batch --no-headers)" +---- + +This will loop over all the billing cronjobs in the `syn-appcat`, create a new job from them and replace the args with whatever we want. + +This specific example will backfill the last 12h, but it can be adjusted to whatever time range is needed. diff --git a/docs/modules/ROOT/partials/nav.adoc b/docs/modules/ROOT/partials/nav.adoc index 7c86f4fc..183c207f 100644 --- a/docs/modules/ROOT/partials/nav.adoc +++ b/docs/modules/ROOT/partials/nav.adoc @@ -128,6 +128,9 @@ ** xref:app-catalog:ROOT:how-tos/haproxy/stats.adoc[HAProxy] +* HowTos +** xref:app-catalog:ROOT:how-tos/appcat/backfill_billing.adoc[] + * Runbooks ** PostgreSQL By VSHN *** xref:app-catalog:ROOT:how-tos/appcat/vshn/postgres/PostgreSQLConnectionsCritical.adoc[]