gogs-dply.yaml 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. apiVersion: apps/v1
  2. kind: Deployment
  3. metadata:
  4. name: gogs
  5. spec:
  6. replicas: 1
  7. selector:
  8. matchLabels:
  9. name: gogs
  10. template:
  11. metadata:
  12. labels:
  13. name: gogs
  14. nginx: backend
  15. spec:
  16. containers:
  17. - name: gogs
  18. image: gogs/gogs
  19. imagePullPolicy: "Always"
  20. env:
  21. - name: RUN_CROND
  22. value: "true"
  23. - name: SOCAT_LINK
  24. value: "false"
  25. - name: BACKUP_INTERVAL
  26. value: "7d"
  27. - name: BACKUP_RETENTION
  28. value: "30d"
  29. - name: PUID
  30. value: "1000"
  31. - name: GUID
  32. value: "1000"
  33. volumeMounts:
  34. - name: gogs
  35. mountPath: /data
  36. - name: backup
  37. mountPath: /backup
  38. ports:
  39. - containerPort: 22
  40. name: ssh
  41. - containerPort: 3000
  42. name: http
  43. livenessProbe:
  44. initialDelaySeconds: 300
  45. timeoutSeconds: 10
  46. httpGet:
  47. port: 3000
  48. httpHeaders:
  49. - name: Host
  50. value: "gogs.dodges.it"
  51. volumes:
  52. - name: gogs
  53. persistentVolumeClaim:
  54. claimName: gogs
  55. - name: backup
  56. hostPath:
  57. type: DirectoryOrCreate
  58. path: /tmp/backup
  59. ---
  60. apiVersion: batch/v1
  61. kind: CronJob
  62. metadata:
  63. name: gogs-backup
  64. spec:
  65. schedule: "@weekly"
  66. jobTemplate:
  67. spec:
  68. template:
  69. spec:
  70. affinity:
  71. nodeAffinity:
  72. requiredDuringSchedulingIgnoredDuringExecution:
  73. nodeSelectorTerms:
  74. - matchExpressions:
  75. - key: kubernetes.io/arch
  76. operator: In
  77. values:
  78. - amd64
  79. containers:
  80. - name: gogs-backup
  81. image: qdii/backup-rsync:latest
  82. env:
  83. - name: LOCAL_FOLDER_PATH
  84. value: /mnt
  85. - name: REMOTE_USER
  86. value: "uab10c1ba4bc"
  87. - name: REMOTE_SERVER
  88. value: "bck.dodges.it"
  89. - name: REMOTE_FOLDER_PATH
  90. value: "/home/uab10c1ba4bc/data/vol0/gogs"
  91. volumeMounts:
  92. - name: backup
  93. mountPath: "/root/.ssh/id_rsa"
  94. subPath: ssh_private_key
  95. readOnly: true
  96. - name: backup
  97. mountPath: "/root/.ssh/id_rsa.pub"
  98. subPath: ssh_public_key
  99. readOnly: true
  100. - name: backup-dir
  101. mountPath: /mnt
  102. restartPolicy: Never
  103. volumes:
  104. - name: backup
  105. secret:
  106. secretName: backup
  107. defaultMode: 0400
  108. - name: backup-dir
  109. hostPath:
  110. type: DirectoryOrCreate
  111. path: /tmp/backup