_invidious.tpl 3.7 KB

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