apiVersion: batch/v1 kind: CronJob metadata: name: ip2location-update namespace: default spec: # Run on the 1st of every month at 3am UTC schedule: "0 3 1 * *" concurrencyPolicy: Forbid successfulJobsHistoryLimit: 3 failedJobsHistoryLimit: 3 jobTemplate: spec: template: spec: containers: - name: ip2location-updater image: curlimages/curl:latest command: - /bin/sh - -c - | set -e echo "Downloading IP2Location LITE DB5..." # Download to temp cd /tmp curl -L -o ip2location.zip "https://www.ip2location.com/download/?token=${IP2LOCATION_TOKEN}&file=DB5LITEBIN" # Extract unzip -o ip2location.zip # Find and copy the BIN file BIN_FILE=$(ls *.BIN 2>/dev/null | head -1) if [ -z "$BIN_FILE" ]; then echo "ERROR: No BIN file found" exit 1 fi # Copy to shared volume cp "$BIN_FILE" /data/IP2LOCATION-LITE-DB5.BIN echo "Done! Database updated: /data/IP2LOCATION-LITE-DB5.BIN" env: - name: IP2LOCATION_TOKEN valueFrom: secretKeyRef: name: dutchie-backend-secret key: IP2LOCATION_TOKEN volumeMounts: - name: ip2location-data mountPath: /data restartPolicy: OnFailure volumes: - name: ip2location-data persistentVolumeClaim: claimName: ip2location-pvc --- apiVersion: v1 kind: PersistentVolumeClaim metadata: name: ip2location-pvc namespace: default spec: accessModes: - ReadWriteOnce resources: requests: storage: 100Mi