From f8c9cf728142a37df533385493dbba7e56daca6b Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Sun, 19 Mar 2023 13:07:31 +0000 Subject: [PATCH 1/2] Update Kubernetes example and README for persistence --- README.md | 2 ++ examples/k8s-cronjob.yaml | 20 +++++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 142baa1..4637230 100644 --- a/README.md +++ b/README.md @@ -72,6 +72,8 @@ This script is also available in a pre-packaged container, [mastodon_get_replies The same rules for running this as a cron job apply to running the container, don't overlap any executions. +Persistent files are stored in `/app/artifacts` within the container, so you may want to map this to a local folder on your system. + An example Kubernetes CronJob for running the container is included in the [`examples`](https://github.com/nanos/mastodon_get_replies/tree/main/examples) folder. ## Acknowledgments diff --git a/examples/k8s-cronjob.yaml b/examples/k8s-cronjob.yaml index accd720..9d0d54a 100644 --- a/examples/k8s-cronjob.yaml +++ b/examples/k8s-cronjob.yaml @@ -1,4 +1,16 @@ --- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: mastodon-get-replies-pvc +spec: + accessModes: + - ReadWriteOnce + volumeMode: Filesystem + resources: + requests: + storage: 100Mi +--- apiVersion: batch/v1 kind: CronJob metadata: @@ -13,11 +25,17 @@ spec: spec: template: spec: + volumes: + - name: artifacts + persistentVolumeClaim: + claimName: mastodon-get-replies-pvc containers: - name: mastodon-get-replies image: ghcr.io/nanos/mastodon_get_replies:latest args: - --server=your.server.social - --access-token=TOKEN + volumeMounts: + - name: artifacts + mountPath: /app/artifacts restartPolicy: Never - From 5e7fbba0d0bb06304ce665bc4267be4be9e572bf Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Sun, 19 Mar 2023 13:19:53 +0000 Subject: [PATCH 2/2] Add more arguments to the example --- examples/k8s-cronjob.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/examples/k8s-cronjob.yaml b/examples/k8s-cronjob.yaml index 9d0d54a..d770438 100644 --- a/examples/k8s-cronjob.yaml +++ b/examples/k8s-cronjob.yaml @@ -35,6 +35,14 @@ spec: args: - --server=your.server.social - --access-token=TOKEN + - --home-timeline-length + - "200" + - --reply-interval-in-hours + - "24" + - --max-followings + - "80" + - --max-followers + - "80" volumeMounts: - name: artifacts mountPath: /app/artifacts