Skip to content

Commit

Permalink
german language pack (#72)
Browse files Browse the repository at this point in the history
* add german language pack to docker image
* add option to disallow moodle egress, so testing for RZ is easier
* only download language pack during image build, install has to be done later so as not to confuse the bitnami installer with existing files and dirs
  • Loading branch information
JannikBadenhop authored Nov 11, 2024
1 parent be3d94e commit e8daafb
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 4 deletions.
3 changes: 2 additions & 1 deletion charts/dbp-moodle/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ The Chart can be deployed without any modification but it is advised to set own
| backup-cronjob.serviceAccount.create | bool | `false` | |
| backup-cronjob.serviceAccount.name | string | `"moodle-backup-job"` | |
| backup-cronjob.tolerations | list | `[]` | |
| dbpMoodle.allowInternalNetworkingOnly | bool | `false` | disallows all egress from release namespace for the moodle deployment |
| dbpMoodle.backup | object | `{"cluster_name":"","enabled":false,"endpoint":"","gpg_key_names":"","gpgkeys":{"existingSecret":"","gpgkey.dbpinfra.pub.asc":"","gpgkey.dbpinfra.sec.asc":""},"max_full_backup_age":"1W","retention_time":"6M","rules":[{"apiGroups":["apps"],"resources":["deployments"],"verbs":["get","patch","list","watch"]},{"apiGroups":["batch"],"resources":["cronjobs","jobs"],"verbs":["get","patch"]}],"s3_bucket_name":"","secrets":{"existingSecret":"","s3_access_key":"","s3_access_secret":"","s3_endpoint_url":""}}` | Backup configuration. Set enabled=true to enable the backup-cronjob. Also set s3 location credentials |
| dbpMoodle.backup.gpgkeys.existingSecret | string | `""` | Existing secret for gpg keys |
| dbpMoodle.backup.max_full_backup_age | string | `"1W"` | Defines the maximum age of a full backup before a new full backup is created. The backups in between are incremental |
Expand Down Expand Up @@ -233,7 +234,7 @@ The Chart can be deployed without any modification but it is advised to set own
| moodle.image.pullPolicy | string | `"Always"` | |
| moodle.image.registry | string | `"ghcr.io"` | |
| moodle.image.repository | string | `"dbildungsplattform/moodle"` | |
| moodle.image.tag | string | `"4.1.13-debian-12-r2-dbp1"` | The dbp-moodle image which is build for this helm chart |
| moodle.image.tag | string | `"4.1.14-debian-12-r0-dbp2"` | The dbp-moodle image which is build for this helm chart |
| moodle.ingress.annotations."cert-manager.io/cluster-issuer" | string | `"sc-cert-manager-clusterissuer-letsencrypt"` | |
| moodle.ingress.annotations."nginx.ingress.kubernetes.io/proxy-body-size" | string | `"200M"` | |
| moodle.ingress.annotations."nginx.ingress.kubernetes.io/proxy-connect-timeout" | string | `"30s"` | |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{ if .Values.dbpMoodle.allowInternalNetworkingOnly }}
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: moodle-allow-internal-only
namespace: "{{ .Release.Namespace }}"
spec:
podSelector:
matchLabels:
app.kubernetes.io/name: moodle
policyTypes:
- Egress
egress:
- to:
- namespaceSelector: {}
{{ end }}
5 changes: 4 additions & 1 deletion charts/dbp-moodle/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ dbpMoodle:
update_migration:
enabled: false

# -- disallows all egress from release namespace for the moodle deployment
allowInternalNetworkingOnly: false

phpConfig:
# -- Extended php logging
extendedLogging: false
Expand Down Expand Up @@ -215,7 +218,7 @@ moodle:
registry: ghcr.io
repository: dbildungsplattform/moodle
# -- The dbp-moodle image which is build for this helm chart
tag: "4.1.13-debian-12-r2-dbp1"
tag: "4.1.14-debian-12-r0-dbp2"
pullPolicy: Always
# -- Debug mode for more detailed moodle installation and log output
debug: false
Expand Down
3 changes: 3 additions & 0 deletions moodle/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ RUN apt-get update && apt-get upgrade -y && \
# Install redis-php which is required for moodle to use redis
RUN /phpRedisInstall.sh

RUN MAJOR_MINOR=$(echo "$MOODLE_VERSION" | cut -d. -f1,2) && \
curl -L https://download.moodle.org/download.php/direct/langpack/${MAJOR_MINOR}/de.zip --output /tmp/de.zip

RUN chown 1001:root -R /opt/bitnami
RUN chown 1001:root -R /plugins

Expand Down
8 changes: 7 additions & 1 deletion moodle/scripts/init/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,13 @@ upgrade_if_pending
MODULE=dbp info "Replacing config files with ours"
/bin/cp -p /moodleconfig/config.php /bitnami/moodle/config.php
/bin/cp /moodleconfig/php.ini /opt/bitnami/php/etc/conf.d/php.ini

if [ -f "/tmp/de.zip" ] && [ ! -d /bitnami/moodledata/lang/de ]; then \
MODULE=dbp info "Installing german language pack"
mkdir -p /bitnami/moodledata/lang
unzip -q /tmp/de.zip -d /bitnami/moodledata/lang
fi

upgrade_if_pending

if [[ ! -f "$update_failed_path" ]] && [[ ! -f "$plugin_state_failed_path" ]]; then
Expand All @@ -119,6 +126,5 @@ else
MODULE=dbp warn "Update or Plugin check failed previously. Skipping plugin check..."
fi


MODULE=dbp info "Finished all preparations! Starting Webserver"
/opt/bitnami/scripts/moodle/run.sh
2 changes: 1 addition & 1 deletion moodle/scripts/init/updateCheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ main() {
image_version="$APP_VERSION"

if [[ -z "$installed_version" ]]; then
MODULE="dbp-update" info "No installed Moodle version detected, continuing with bitnami fresh install"
MODULE="dbp-update" info "No installed Moodle version detected, continuing with Bitnami fresh install"
exit 0
fi
comp_result="$(compare_semver "$installed_version" "$image_version")"
Expand Down

0 comments on commit e8daafb

Please sign in to comment.