-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #123 from vshn/add/backfilling
Add documentation how to backfill billingdata
- Loading branch information
Showing
2 changed files
with
24 additions
and
0 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
docs/modules/ROOT/pages/how-tos/appcat/backfill_billing.adoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters