An app for sending a preconfigured gRPC command to trigger daily email digest generation. Purpose built to be run as a CronJob in a Kubernetes cluster with Sentry monitoring.
The service performs these steps:
- Reports job start to Sentry for monitoring
- Connects to your notification service via gRPC and sends a command to trigger digest email generation
- Reports success/failure status back to Sentry
Configure the service using these environment variables:
# Which environment we're running in (used for Sentry monitoring)
ENVIRONMENT=staging
CRON_URL=https://oxxxxxxxxxxxxxxxx.ingest.de.sentry.io/api/xxxxxxxxxxxxxxxx/cron/digest-trigger/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/
NOTIFICATION_SERVICE_URL=https://notification.init.svc.cluster.local:8080
RUST_LOG=info# Who is sending the command (shown in logs and potentially forwarded)
COMMAND_FROM="Kubernetes Debrief Trigger CronJob"
# The specific command to send to the notification service
COMMAND_COMMAND="SendDigestEmailsCommand"
# JSON data payload for the command
COMMAND_DATA="{\"template\":\"daily-digest\"}"
# Optional requester identifier
COMMAND_REQUESTER=""- Rust 1.70+ (
rustuprecommended) - Protocol Buffers compiler (
protoc)
On macOS:
brew install protobufUse task. Update .env.local to point to your local notification service.
- Check CronJob status:
kubectl get cronjobs - View recent job runs:
kubectl get jobs - Check logs:
kubectl logs -l job-name=digestive-daily-<timestamp> - Monitor in Sentry for cron job health and failure alerts
This service is designed to run as a Kubernetes CronJob.
Production Usage: This service is currently deployed in production at kvist-no/infra.
Here's an example configuration:
apiVersion: batch/v1
kind: CronJob
metadata:
name: digestive-daily
namespace: your-namespace
spec:
# Run every day at 8 AM UTC
schedule: "0 8 * * *"
jobTemplate:
spec:
template:
spec:
restartPolicy: OnFailure
containers:
- name: digestive
image: your-registry/digestive:latest
env:
- name: ENVIRONMENT
value: "staging"
- name: CRON_URL
valueFrom:
secretKeyRef:
name: digestive-secrets
key: sentry-cron-url
- name: NOTIFICATION_SERVICE_URL
value: "https://notification.init.svc.cluster.local:8080"
- name: RUST_LOG
value: "info"
- name: COMMAND_DATA
value: '{"template":"daily-digest"}'
resources:
requests:
memory: "32Mi"
cpu: "10m"
limits:
memory: "64Mi"
cpu: "100m"
# Clean up completed jobs after 3 successful runs and 1 failed run
successfulJobsHistoryLimit: 3
failedJobsHistoryLimit: 1apiVersion: v1
kind: Secret
metadata:
name: digestive-secrets
namespace: your-namespace
type: Opaque
stringData:
sentry-cron-url: "https://oxxxxxxxxxxxxxxxx.ingest.de.sentry.io/api/xxxxxxxxxxxxxxxx/cron/digest-trigger/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/"