diff --git a/base/resources/nextcloud/resources/ConfigMap-plugins.yaml b/base/resources/nextcloud/resources/ConfigMap-plugins.yaml new file mode 100644 index 0000000..c648113 --- /dev/null +++ b/base/resources/nextcloud/resources/ConfigMap-plugins.yaml @@ -0,0 +1,30 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: script-config-plugins +data: + poststart-plugins.sh: | + #!/bin/sh + + NEXTCLOUD_READY=0 + MAX_RETRIES=30 + RETRY_INTERVAL=10 + + touch /etc/script/plugins.txt + + for i in $(seq 1 $MAX_RETRIES); do + if curl -fsS "http://localhost/status.php" > /dev/null; then + NEXTCLOUD_READY=1 + break + else + echo "En attente de Nextcloud (tentative $i/$MAX_RETRIES)..." >> /etc/script/plugins.txt + sleep $RETRY_INTERVAL + fi + done + + if [ $NEXTCLOUD_READY -eq 0 ]; then + echo "Nextcloud n'est pas prêt après $MAX_RETRIES tentatives. Abandon de l'initialisation des plugins." >> /etc/script/plugins.txt + exit 1 + fi + + su -s /bin/sh -c "/var/www/html/occ app:install calendar" www-data