Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Kubernetes manifest files for running EF-API in the production instance. [#72](https://github.com/htrc/torchlite-app/issues/72)
- Credentials for mutual TLS with registry to all torchlite-backend deployments to support direct communication when getting worksets. [#125](https://github.com/htrc/torchlite-backend/issues/125)
- Google Analytics ID to production [#156](https://github.com/htrc/torchlite-frontend/issues/156)
- Add cron job for setting up mongodb backup in all TORCHLITE instances. [#33](https://github.com/htrc/torchlite-argocd/issues/33)

### Changed
- Backend cache expiration time in the development instance to 3600 seconds (1 hour). [#7](https://github.com/htrc/torchlite-argocd/issues/7)
Expand Down
28 changes: 28 additions & 0 deletions torchlite-mongodb-backup-prod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: torchlite-mongodb-backup-prod-argocd-app
namespace: argocd
labels:
env: prod
annotations:
notifications.argoproj.io/subscribe.on-deployed.slack: torchlite
notifications.argoproj.io/subscribe.on-health-degraded.slack: torchlite
spec:
project: default

source:
repoURL: https://github.com/htrc/torchlite-argocd.git
targetRevision: main
path: torchlite-mongodb-backup/prod
destination:
server: https://kubernetes.default.svc
namespace: torchlite-prod

syncPolicy:
syncOptions:
- CreateNamespace=true

automated:
selfHeal: true
prune: true
2 changes: 1 addition & 1 deletion torchlite-mongodb-backup/dev/cronjob.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ spec:
volumes:
- name: backup-storage
persistentVolumeClaim:
claimName: mongodb-backup-pvc
claimName: mongodb-backup-dev-pvc
2 changes: 1 addition & 1 deletion torchlite-mongodb-backup/dev/pv.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: mongodb-backup-pv
name: mongodb-backup-dev-pv
spec:
capacity:
storage: 100Gi # 2 times the size of the dev mongodb persistent volume as we will be retaining the most recent 2 backups in the backup volume
Expand Down
2 changes: 1 addition & 1 deletion torchlite-mongodb-backup/dev/pvc.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: mongodb-backup-pvc
name: mongodb-backup-dev-pvc
spec:
accessModes:
- ReadWriteOnce
Expand Down
32 changes: 32 additions & 0 deletions torchlite-mongodb-backup/prod/cronjob.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
apiVersion: batch/v1
kind: CronJob
metadata:
name: mongodb-backup
spec:
schedule: "00 05 * * *" # Runs backup every day at 5:00 AM
jobTemplate:
spec:
template:
spec:
containers:
- name: mongodump
image: quay.io/mongodb/mongodb-community-server:6.0.5-ubi8
command:
- sh
- -c
- |
# Perform backup
mongodump --host=mongodb-svc -u torchlite -p $password --port=27017 --out=/backup/$(date +\%Y-\%m-\%dT\%H-\%M-\%S)
# Remove backups older than 7 days
find /backup -type d -mtime +7 -exec rm -rf {} +
envFrom:
- secretRef:
name: mongodb-admin-torchlite
volumeMounts:
- name: backup-storage
mountPath: /backup
restartPolicy: OnFailure
volumes:
- name: backup-storage
persistentVolumeClaim:
claimName: mongodb-backup-prod-pvc
12 changes: 12 additions & 0 deletions torchlite-mongodb-backup/prod/pv.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: mongodb-backup-prod-pv
spec:
capacity:
storage: 700Gi # 7 times the size of the prod mongodb persistent volume as we will be retaining 7 days of backups in the backup volume
accessModes:
- ReadWriteOnce
hostPath:
path: /mnt/mongodb-backup
type: DirectoryOrCreate
10 changes: 10 additions & 0 deletions torchlite-mongodb-backup/prod/pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: mongodb-backup-prod-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 700Gi # 7 times the size of the prod mongodb persistent volume as we will be retaining 7 days of backups in the backup volume
2 changes: 1 addition & 1 deletion torchlite-mongodb-backup/stage/cronjob.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ kind: CronJob
metadata:
name: mongodb-backup
spec:
schedule: "*/5 * * * *" # Test stage backup.
schedule: "00 04 15 * *" # Run at 4:00 AM on the 15th of every month
jobTemplate:
spec:
template:
Expand Down