_invidious.tpl 3.8 KB

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