Skip to content

Commit

Permalink
Merge pull request #123 from vshn/add/backfilling
Browse files Browse the repository at this point in the history
Add documentation how to backfill billingdata
  • Loading branch information
Kidswiss authored Nov 27, 2024
2 parents 2b734d9 + a2dcf7a commit ff2de5a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
21 changes: 21 additions & 0 deletions docs/modules/ROOT/pages/how-tos/appcat/backfill_billing.adoc
Original file line number Diff line number Diff line change
@@ -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.
3 changes: 3 additions & 0 deletions docs/modules/ROOT/partials/nav.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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[]
Expand Down

0 comments on commit ff2de5a

Please sign in to comment.