tutor 23.0.0.dev3217__tar.gz → 23.0.0.dev3221__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/PKG-INFO +1 -1
  2. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/commands/mounts.py +8 -2
  3. tutor-23.0.0.dev3221/tutor/templates/apps/permissions/fix-volume-permissions.sh +23 -0
  4. tutor-23.0.0.dev3221/tutor/templates/build/permissions/Dockerfile +28 -0
  5. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/templates/jobs/init/cms.sh +3 -2
  6. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/templates/jobs/init/lms.sh +3 -2
  7. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/templates/k8s/deployments.yml +80 -0
  8. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/templates/kustomization.yml +3 -0
  9. tutor-23.0.0.dev3217/tutor/templates/build/permissions/Dockerfile +0 -7
  10. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/.gitignore +0 -0
  11. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/.hatch_build.py +0 -0
  12. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/LICENSE.txt +0 -0
  13. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/README.rst +0 -0
  14. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/pyproject.toml +0 -0
  15. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/requirements/base.in +0 -0
  16. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/requirements/dev.txt +0 -0
  17. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/requirements/plugins.txt +0 -0
  18. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/__about__.py +0 -0
  19. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/__init__.py +0 -0
  20. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/bindmount.py +0 -0
  21. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/commands/__init__.py +0 -0
  22. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/commands/cli.py +0 -0
  23. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/commands/compose.py +0 -0
  24. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/commands/config.py +0 -0
  25. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/commands/context.py +0 -0
  26. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/commands/dev.py +0 -0
  27. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/commands/images.py +0 -0
  28. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/commands/jobs.py +0 -0
  29. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/commands/jobs_utils.py +0 -0
  30. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/commands/k8s.py +0 -0
  31. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/commands/local.py +0 -0
  32. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/commands/params.py +0 -0
  33. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/commands/plugins.py +0 -0
  34. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/commands/upgrade/__init__.py +0 -0
  35. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/commands/upgrade/common.py +0 -0
  36. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/commands/upgrade/compose.py +0 -0
  37. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/commands/upgrade/k8s.py +0 -0
  38. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/config.py +0 -0
  39. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/core/__init__.py +0 -0
  40. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/core/hooks/__init__.py +0 -0
  41. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/core/hooks/actions.py +0 -0
  42. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/core/hooks/contexts.py +0 -0
  43. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/core/hooks/filters.py +0 -0
  44. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/core/hooks/priorities.py +0 -0
  45. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/env.py +0 -0
  46. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/exceptions.py +0 -0
  47. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/fmt.py +0 -0
  48. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/hooks/__init__.py +0 -0
  49. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/hooks/catalog.py +0 -0
  50. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/images.py +0 -0
  51. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/interactive.py +0 -0
  52. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/plugins/__init__.py +0 -0
  53. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/plugins/base.py +0 -0
  54. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/plugins/indexes.py +0 -0
  55. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/plugins/openedx.py +0 -0
  56. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/plugins/v0.py +0 -0
  57. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/plugins/v1.py +0 -0
  58. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/py.typed +0 -0
  59. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/serialize.py +0 -0
  60. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/tasks.py +0 -0
  61. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/templates/apps/caddy/Caddyfile +0 -0
  62. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/templates/apps/openedx/config/cms.env.yml +0 -0
  63. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/templates/apps/openedx/config/lms.env.yml +0 -0
  64. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/templates/apps/openedx/config/partials/auth.yml +0 -0
  65. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/templates/apps/openedx/granian-config +0 -0
  66. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/templates/apps/openedx/settings/cms/__init__.py +0 -0
  67. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/templates/apps/openedx/settings/cms/development.py +0 -0
  68. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/templates/apps/openedx/settings/cms/production.py +0 -0
  69. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/templates/apps/openedx/settings/cms/test.py +0 -0
  70. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/templates/apps/openedx/settings/lms/__init__.py +0 -0
  71. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/templates/apps/openedx/settings/lms/development.py +0 -0
  72. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/templates/apps/openedx/settings/lms/production.py +0 -0
  73. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/templates/apps/openedx/settings/lms/test.py +0 -0
  74. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/templates/apps/openedx/settings/partials/common_all.py +0 -0
  75. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/templates/apps/openedx/settings/partials/common_cms.py +0 -0
  76. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/templates/apps/openedx/settings/partials/common_lms.py +0 -0
  77. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/templates/apps/openedx/settings/partials/common_test.py +0 -0
  78. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/templates/apps/permissions/setowners.sh +0 -0
  79. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/templates/apps/redis/redis.conf +0 -0
  80. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/templates/build/openedx/Dockerfile +0 -0
  81. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/templates/build/openedx/bin/reload-granian +0 -0
  82. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/templates/build/openedx/bin/run-granian +0 -0
  83. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/templates/build/openedx/revisions.yml +0 -0
  84. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/templates/build/openedx/settings/cms/__init__.py +0 -0
  85. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/templates/build/openedx/settings/cms/assets.py +0 -0
  86. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/templates/build/openedx/settings/cms/i18n.py +0 -0
  87. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/templates/build/openedx/settings/granian-config +0 -0
  88. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/templates/build/openedx/settings/lms/__init__.py +0 -0
  89. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/templates/build/openedx/settings/lms/assets.py +0 -0
  90. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/templates/build/openedx/settings/lms/i18n.py +0 -0
  91. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/templates/build/openedx/settings/partials/assets.py +0 -0
  92. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/templates/build/openedx/settings/partials/i18n.py +0 -0
  93. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/templates/build/openedx/themes/README +0 -0
  94. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/templates/build/permissions/setowner.sh +0 -0
  95. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/templates/config/base.yml +0 -0
  96. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/templates/config/defaults.yml +0 -0
  97. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/templates/dev/docker-compose.jobs.yml +0 -0
  98. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/templates/dev/docker-compose.yml +0 -0
  99. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/templates/jobs/init/meilisearch.sh +0 -0
  100. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/templates/jobs/init/mounted-directories.sh +0 -0
  101. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/templates/jobs/init/mysql.sh +0 -0
  102. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/templates/k8s/jobs.yml +0 -0
  103. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/templates/k8s/namespace.yml +0 -0
  104. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/templates/k8s/override.yml +0 -0
  105. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/templates/k8s/services.yml +0 -0
  106. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/templates/k8s/volumes.yml +0 -0
  107. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/templates/local/docker-compose.jobs.yml +0 -0
  108. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/templates/local/docker-compose.prod.yml +0 -0
  109. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/templates/local/docker-compose.yml +0 -0
  110. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/templates/version +0 -0
  111. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/types.py +0 -0
  112. {tutor-23.0.0.dev3217 → tutor-23.0.0.dev3221}/tutor/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: tutor
3
- Version: 23.0.0.dev3217
3
+ Version: 23.0.0.dev3221
4
4
  Summary: The Docker-based Open edX distribution designed for peace of mind
5
5
  Project-URL: Homepage, https://docs.tutor.edly.io/
6
6
  Project-URL: Documentation, https://docs.tutor.edly.io/
@@ -111,14 +111,20 @@ def mounts_add(context: click.Context, mounts: list[str]) -> None:
111
111
 
112
112
 
113
113
  @click.command(name="remove")
114
+ @click.option("-a", "--all", "remove_all", is_flag=True, help="Remove all bind-mounts")
114
115
  @click.argument("mounts", metavar="mount", type=MountParamType(), nargs=-1)
115
116
  @click.pass_context
116
- def mounts_remove(context: click.Context, mounts: list[str]) -> None:
117
+ def mounts_remove(context: click.Context, remove_all: bool, mounts: list[str]) -> None:
117
118
  """
118
119
  Remove a bind-mounted folder
119
120
 
120
- The bind-mounted folder will be removed from the ``MOUNTS`` project setting.
121
+ The bind-mounted folder will be removed from the ``MOUNTS`` project setting. Pass
122
+ ``--all`` to remove all bind-mounted folders at once.
121
123
  """
124
+ if remove_all:
125
+ if mounts:
126
+ raise exceptions.TutorError("Cannot pass both --all and mount arguments")
127
+ mounts = bindmount.get_mounts(tutor_config.load(context.obj.root))
122
128
  removed_mounts = []
123
129
  for mount in mounts:
124
130
  if not bindmount.parse_explicit_mount(mount):
@@ -0,0 +1,23 @@
1
+ #! /bin/sh
2
+ set -e
3
+ uid="$1"
4
+ gid="$2"
5
+ path="$3"
6
+
7
+ current_gid="$(stat -c '%g' "$path")"
8
+ if [ "$current_gid" = "$gid" ]; then
9
+ echo "$path: group already $gid, nothing to do"
10
+ exit 0
11
+ fi
12
+
13
+ echo "$path: group is $current_gid, expected $gid; fixing ownership"
14
+ # chown -R processes children before the directory itself (verified: it is a
15
+ # post-order walk), so if the timeout below kills it partway through, $path's
16
+ # own group is the last thing that would have been updated. A partial failure
17
+ # therefore still reads as "not done" above on the next restart, instead of
18
+ # silently looking complete while some descendant is left unfixed.
19
+ if timeout 60 chown --recursive "$uid:$gid" "$path"; then
20
+ echo "$path: ownership fixed"
21
+ else
22
+ echo "$path: failed to fix ownership (error or timed out); continuing anyway" >&2
23
+ fi
@@ -0,0 +1,28 @@
1
+ FROM docker.io/alpine:3.13.6
2
+ LABEL maintainer="Overhang.io <contact@overhang.io>"
3
+
4
+ COPY ./setowner.sh /usr/local/bin/setowner
5
+ RUN chmod a+x /usr/local/bin/setowner
6
+
7
+ # Grants busybox the ability to chown files it doesn't own, without running as
8
+ # root. Kubernetes does not propagate added capabilities into a non-root
9
+ # container's effective set (no ambient capability support, see
10
+ # kubernetes/kubernetes#56374), so capabilities.add in a pod's securityContext
11
+ # alone is silently dropped at execve.
12
+ #
13
+ # This must be set on /bin/busybox itself, not a dedicated copy used only for
14
+ # the chown step: with allowPrivilegeEscalation: false, a file capability can
15
+ # only elevate a process up to what it already had in ITS OWN pre-exec
16
+ # permitted set - and that's empty for anything except the container's single
17
+ # direct entrypoint exec (confirmed empirically: capabilities.add populates
18
+ # the bounding set correctly, but not permitted/effective/inheritable, for a
19
+ # non-root process). fix-volume-permissions.sh runs as a shell script, so
20
+ # `sh` is that one direct exec, and chown is a later, separate exec from
21
+ # inside it - scoping the capability to a different file than the one `sh`
22
+ # itself runs as means that later exec can't be granted anything. Setting it
23
+ # on busybox directly means `sh`, `timeout` and `chown` are all the same
24
+ # already-capable file, so the capability carries through the whole chain
25
+ # (verified on an actual cluster, both ways).
26
+ RUN apk add --no-cache libcap && setcap cap_chown=ep /bin/busybox
27
+
28
+ ENTRYPOINT ["setowner"]
@@ -21,11 +21,12 @@ fi
21
21
  # Create the courseware content index
22
22
  ./manage.py cms reindex_course --active
23
23
 
24
- # Load default policies for the Open edX Authorization framework
24
+ # Load default policies and static role/permission definitions for the Open edX Authorization framework
25
25
  # Check if openedx-authz package is installed if not skip loading policies and exit
26
26
  if python -c "import pkg_resources; pkg_resources.require('openedx-authz')" 2>/dev/null; then
27
27
  ./manage.py cms load_policies
28
+ ./manage.py cms load_authz_schema
28
29
  else
29
- echo "openedx-authz package is not installed, skipping loading default policies"
30
+ echo "openedx-authz package is not installed, skipping loading default policies and authorization schema"
30
31
  exit 1
31
32
  fi
@@ -92,11 +92,12 @@ fi
92
92
  # Completion tracking: add green ticks to every completed unit
93
93
  (./manage.py lms waffle_switch --list | grep completion.enable_completion_tracking) || ./manage.py lms waffle_switch --create completion.enable_completion_tracking on
94
94
 
95
- # Load default policies for the Open edX Authorization framework
95
+ # Load default policies and static role/permission definitions for the Open edX Authorization framework
96
96
  # Check if openedx-authz package is installed if not skip loading policies and exit
97
97
  if python -c "import pkg_resources; pkg_resources.require('openedx-authz')" 2>/dev/null; then
98
98
  ./manage.py lms load_policies
99
+ ./manage.py lms load_authz_schema
99
100
  else
100
- echo "openedx-authz package is not installed, skipping loading default policies"
101
+ echo "openedx-authz package is not installed, skipping loading default policies and authorization schema"
101
102
  exit 1
102
103
  fi
@@ -302,6 +302,23 @@ spec:
302
302
  runAsGroup: 1000
303
303
  fsGroup: 1000
304
304
  fsGroupChangePolicy: "OnRootMismatch"
305
+ initContainers:
306
+ - name: fix-permissions
307
+ image: {{ DOCKER_IMAGE_PERMISSIONS }}
308
+ command: ["sh", "/scripts/fix-volume-permissions.sh", "1000", "1000", "/meili_data"]
309
+ securityContext:
310
+ runAsUser: 1000
311
+ runAsGroup: 1000
312
+ runAsNonRoot: true
313
+ allowPrivilegeEscalation: false
314
+ capabilities:
315
+ add: ["CHOWN"]
316
+ drop: ["ALL"]
317
+ volumeMounts:
318
+ - mountPath: /meili_data
319
+ name: data
320
+ - mountPath: /scripts
321
+ name: fix-permissions-script
305
322
  containers:
306
323
  - name: meilisearch
307
324
  image: {{ DOCKER_IMAGE_MEILISEARCH }}
@@ -319,6 +336,9 @@ spec:
319
336
  - name: data
320
337
  persistentVolumeClaim:
321
338
  claimName: meilisearch
339
+ - name: fix-permissions-script
340
+ configMap:
341
+ name: fix-permissions
322
342
  {% endif %}
323
343
  {% if RUN_MONGODB %}
324
344
  ---
@@ -344,6 +364,23 @@ spec:
344
364
  runAsGroup: 999
345
365
  fsGroup: 999
346
366
  fsGroupChangePolicy: "OnRootMismatch"
367
+ initContainers:
368
+ - name: fix-permissions
369
+ image: {{ DOCKER_IMAGE_PERMISSIONS }}
370
+ command: ["sh", "/scripts/fix-volume-permissions.sh", "999", "999", "/data/db"]
371
+ securityContext:
372
+ runAsUser: 999
373
+ runAsGroup: 999
374
+ runAsNonRoot: true
375
+ allowPrivilegeEscalation: false
376
+ capabilities:
377
+ add: ["CHOWN"]
378
+ drop: ["ALL"]
379
+ volumeMounts:
380
+ - mountPath: /data/db
381
+ name: data
382
+ - mountPath: /scripts
383
+ name: fix-permissions-script
347
384
  containers:
348
385
  - name: mongodb
349
386
  image: {{ DOCKER_IMAGE_MONGODB }}
@@ -359,6 +396,9 @@ spec:
359
396
  - name: data
360
397
  persistentVolumeClaim:
361
398
  claimName: mongodb
399
+ - name: fix-permissions-script
400
+ configMap:
401
+ name: fix-permissions
362
402
  {% endif %}
363
403
  {% if RUN_MYSQL %}
364
404
  ---
@@ -384,6 +424,23 @@ spec:
384
424
  runAsGroup: 999
385
425
  fsGroup: 999
386
426
  fsGroupChangePolicy: "OnRootMismatch"
427
+ initContainers:
428
+ - name: fix-permissions
429
+ image: {{ DOCKER_IMAGE_PERMISSIONS }}
430
+ command: ["sh", "/scripts/fix-volume-permissions.sh", "999", "999", "/var/lib/mysql"]
431
+ securityContext:
432
+ runAsUser: 999
433
+ runAsGroup: 999
434
+ runAsNonRoot: true
435
+ allowPrivilegeEscalation: false
436
+ capabilities:
437
+ add: ["CHOWN"]
438
+ drop: ["ALL"]
439
+ volumeMounts:
440
+ - mountPath: /var/lib/mysql
441
+ name: data
442
+ - mountPath: /scripts
443
+ name: fix-permissions-script
387
444
  containers:
388
445
  - name: mysql
389
446
  image: {{ DOCKER_IMAGE_MYSQL }}
@@ -407,6 +464,9 @@ spec:
407
464
  - name: data
408
465
  persistentVolumeClaim:
409
466
  claimName: mysql
467
+ - name: fix-permissions-script
468
+ configMap:
469
+ name: fix-permissions
410
470
  {% endif %}
411
471
  {% if RUN_SMTP %}
412
472
  ---
@@ -458,6 +518,23 @@ spec:
458
518
  runAsGroup: 1000
459
519
  fsGroup: 1000
460
520
  fsGroupChangePolicy: "OnRootMismatch"
521
+ initContainers:
522
+ - name: fix-permissions
523
+ image: {{ DOCKER_IMAGE_PERMISSIONS }}
524
+ command: ["sh", "/scripts/fix-volume-permissions.sh", "1000", "1000", "/openedx/redis/data"]
525
+ securityContext:
526
+ runAsUser: 1000
527
+ runAsGroup: 1000
528
+ runAsNonRoot: true
529
+ allowPrivilegeEscalation: false
530
+ capabilities:
531
+ add: ["CHOWN"]
532
+ drop: ["ALL"]
533
+ volumeMounts:
534
+ - mountPath: /openedx/redis/data
535
+ name: data
536
+ - mountPath: /scripts
537
+ name: fix-permissions-script
461
538
  containers:
462
539
  - name: redis
463
540
  image: {{ DOCKER_IMAGE_REDIS }}
@@ -479,5 +556,8 @@ spec:
479
556
  - name: data
480
557
  persistentVolumeClaim:
481
558
  claimName: redis
559
+ - name: fix-permissions-script
560
+ configMap:
561
+ name: fix-permissions
482
562
  {% endif %}
483
563
  {{ patch("k8s-deployments") }}
@@ -76,6 +76,9 @@ configMapGenerator:
76
76
  labels:
77
77
  app.kubernetes.io/name: redis
78
78
  {% endif %}
79
+ - name: fix-permissions
80
+ files:
81
+ - apps/permissions/fix-volume-permissions.sh
79
82
  {{ patch("kustomization-configmapgenerator") }}
80
83
 
81
84
  {%- if patch("k8s-override") or patch("kustomization-patches") %}
@@ -1,7 +0,0 @@
1
- FROM docker.io/alpine:3.13.6
2
- LABEL maintainer="Overhang.io <contact@overhang.io>"
3
-
4
- COPY ./setowner.sh /usr/local/bin/setowner
5
- RUN chmod a+x /usr/local/bin/setowner
6
-
7
- ENTRYPOINT ["setowner"]