_invidious.tpl 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. {{- define "invidious.workload" -}}
  2. workload:
  3. invidious:
  4. enabled: true
  5. primary: true
  6. type: Deployment
  7. podSpec:
  8. hostNetwork: false
  9. containers:
  10. invidious:
  11. enabled: true
  12. primary: true
  13. imageSelector: image
  14. securityContext:
  15. runAsUser: 1000
  16. runAsGroup: 1000
  17. env:
  18. INVIDIOUS_CONFIG_FILE: /config/config.yaml
  19. {{ with .Values.invidiousConfig.additionalEnvs }}
  20. envList:
  21. {{ range $env := . }}
  22. - name: {{ $env.name }}
  23. value: {{ $env.value }}
  24. {{ end }}
  25. {{ end }}
  26. probes:
  27. liveness:
  28. enabled: true
  29. type: http
  30. path: /api/v1/comments/jNQXAC9IVRw
  31. port: {{ .Values.invidiousNetwork.webPort }}
  32. readiness:
  33. enabled: true
  34. type: http
  35. path: /api/v1/comments/jNQXAC9IVRw
  36. port: {{ .Values.invidiousNetwork.webPort }}
  37. startup:
  38. enabled: true
  39. type: http
  40. path: /api/v1/comments/jNQXAC9IVRw
  41. port: {{ .Values.invidiousNetwork.webPort }}
  42. initContainers:
  43. {{- include "ix.v1.common.app.permissions" (dict "containerName" "01-permissions"
  44. "UID" 1000
  45. "GID" 1000
  46. "mode" "check"
  47. "type" "install") | nindent 8 }}
  48. {{- include "ix.v1.common.app.postgresWait" (dict "name" "01-postgres-wait"
  49. "secretName" "postgres-creds") | nindent 8 }}
  50. 02-fetch-seed:
  51. enabled: {{ .Release.IsInstall }}
  52. type: init
  53. imageSelector: gitImage
  54. securityContext:
  55. runAsUser: 1000
  56. runAsGroup: 1000
  57. command:
  58. - /bin/sh
  59. - -c
  60. args:
  61. - |
  62. echo "Fetching DB Seed..."
  63. mkdir -p /shared/invidious
  64. cd /shared/invidious
  65. git init && \
  66. git remote add invidious https://github.com/iv-org/invidious.git && \
  67. git fetch invidious && \
  68. # Fetch config and docker dirs
  69. git checkout invidious/master -- docker config
  70. # Move config into docker dir
  71. echo "Preparing directory structure..."
  72. mv -fv config docker
  73. echo "Done."
  74. 03-init-db:
  75. enabled: {{ .Release.IsInstall }}
  76. type: init
  77. imageSelector: postgresImage
  78. securityContext:
  79. runAsUser: 1000
  80. runAsGroup: 1000
  81. envFrom:
  82. - secretRef:
  83. name: postgres-creds
  84. command:
  85. - /bin/sh
  86. - -c
  87. args:
  88. - |
  89. echo "Initializing Invidious DB..."
  90. cd /shared/invidious/docker
  91. ./init-invidious-db.sh
  92. echo "Done."
  93. 04-init-config:
  94. enabled: true
  95. type: init
  96. imageSelector: image
  97. securityContext:
  98. runAsUser: 1000
  99. runAsGroup: 1000
  100. command:
  101. - /bin/sh
  102. - -c
  103. args:
  104. - |
  105. if [ ! -f /config/config.yaml ]; then
  106. echo "Initializing Invidious Config..."
  107. cp -v /invidious/config/config.yml /config/config.yaml
  108. exit 0
  109. fi
  110. echo "Config already exists, skipping."
  111. 05-update-config:
  112. enabled: true
  113. type: init
  114. imageSelector: yqImage
  115. securityContext:
  116. runAsUser: 1000
  117. runAsGroup: 1000
  118. readOnlyRootFilesystem: false
  119. command: /setup/config.sh
  120. {{- end -}}