From 8ed5bd4eb590852662e6d920d5ffe132f9854be1 Mon Sep 17 00:00:00 2001 From: Glenn Date: Sun, 5 May 2024 19:05:33 +0200 Subject: [PATCH 01/12] fix config for nginx --- nginx.conf.d/dav.conf | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/nginx.conf.d/dav.conf b/nginx.conf.d/dav.conf index cc89126..864e0c8 100644 --- a/nginx.conf.d/dav.conf +++ b/nginx.conf.d/dav.conf @@ -1,2 +1,15 @@ -rewrite ^/\.well-known/carddav https://$server_name/remote.php/dav/ permanent; -rewrite ^/\.well-known/caldav https://$server_name/remote.php/dav/ permanent; +location = /robots.txt { + allow all; + log_not_found off; + access_log off; +} + +location = /.well-known/carddav { + return 301 $scheme://$host/remote.php/dav; +} + +location = /.well-known/caldav { + return 301 $scheme://$host/remote.php/dav; +} + +location /.well-known/acme-challenge { } -- 2.43.4 From 9dafd4121326dbee4a2ac8568e80ae93d72552f9 Mon Sep 17 00:00:00 2001 From: Glenn Date: Sun, 5 May 2024 19:06:10 +0200 Subject: [PATCH 02/12] fix: add logging to postdeploy --- postdeploy.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/postdeploy.sh b/postdeploy.sh index f541f97..3cd411d 100755 --- a/postdeploy.sh +++ b/postdeploy.sh @@ -6,11 +6,14 @@ set -e cd /var/www/html echo "GYR:POSTDEPLOY:START ($(pwd))" find . -maxdepth 1 -php -d memory_limit=-1 occ maintenance:mode --on +echo "GYR:POSTDEPLOY:UPGRADE" php -d memory_limit=-1 occ upgrade +echo "GYR:POSTDEPLOY:DB" php -d memory_limit=-1 occ db:convert-filecache-bigint php -d memory_limit=-1 occ db:add-missing-indices +echo "GYR:POSTDEPLOY:HTACCESS" php -d memory_limit=-1 occ maintenance:update:htaccess +echo "GYR:POSTDEPLOY:MAINTENANCE:OFF" php -d memory_limit=-1 occ maintenance:mode --off php -d memory_limit=-1 occ maintenance:mode --off || true echo "GYR:POSTDEPLOY:END" -- 2.43.4 From e1069a8e38276175ca19ac27c179d4edb47bca18 Mon Sep 17 00:00:00 2001 From: Glenn Date: Sun, 5 May 2024 19:06:26 +0200 Subject: [PATCH 03/12] fix(dockerfile): improve readability --- Dockerfile | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 40340fe..0b11725 100644 --- a/Dockerfile +++ b/Dockerfile @@ -50,20 +50,22 @@ RUN apt-get update \ ## ## GMP Support (for bookmark extension) ## -RUN apt-get update && apt-get install -y libgmp3-dev \ +RUN apt-get update \ + && apt-get install -y libgmp3-dev \ && docker-php-ext-install gmp ## ## BZ2 Support (for nextcloud) ## -RUN apt-get update && apt-get install -y libbz2-dev \ +RUN apt-get update \ + && apt-get install -y libbz2-dev \ && docker-php-ext-install bz2 ## ## SVG and LibreSign support ## -RUN apt-get update && apt-get install -y \ - libmagickcore-6.q16-6-extra \ +RUN apt-get update \ + && apt-get install -y libmagickcore-6.q16-6-extra \ && rm -rf /var/lib/apt/lists/* RUN sed -i'' 's|.*|g' \ -- 2.43.4 From 2b745cf92a19f8ddbff6b390210888b77fbb90e0 Mon Sep 17 00:00:00 2001 From: Glenn Date: Sun, 5 May 2024 19:06:44 +0200 Subject: [PATCH 04/12] doc: add config lines for dokku --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 438afed..cd81c4a 100644 --- a/README.md +++ b/README.md @@ -18,3 +18,13 @@ * push image to local registry 4. +ssh dokku@buddha-apps.boldcode.io app-json:set cloud appjson-path /app/app.json # glenux/service-nextcloud:latest + +Run after install + + config:app:set --value '30' files_lock lock_timeout + +Add this in crontab + + dokku enter cloud web su -l -s /bin/bash - www-data -c "cd html && php -dmemory_limit=-1 ./occ app:update --all" + -- 2.43.4 From 9eb628314e49a3517d591f0259b301540bfc911d Mon Sep 17 00:00:00 2001 From: Glenn Date: Sun, 5 May 2024 19:14:14 +0200 Subject: [PATCH 05/12] fix: workdir may not be available at startup --- postdeploy.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/postdeploy.sh b/postdeploy.sh index 3cd411d..145f7b1 100755 --- a/postdeploy.sh +++ b/postdeploy.sh @@ -3,7 +3,15 @@ set -u set -e -cd /var/www/html +WORKDIR=/var/www/html +counter=0 +while [ ! -d "$WORKDIR" ] && [ "$counter" -lt 120 ]; do + echo "GYR:POSTDEPLOY:WAITING" + counter=$((counter+1)) + sleep 1 +done +cd "$WORKDIR" || exit 1 + echo "GYR:POSTDEPLOY:START ($(pwd))" find . -maxdepth 1 echo "GYR:POSTDEPLOY:UPGRADE" -- 2.43.4 From 32a3c9024eb425ce6e08294381fa6351151d20b4 Mon Sep 17 00:00:00 2001 From: Glenn Date: Sun, 5 May 2024 19:15:55 +0200 Subject: [PATCH 06/12] fix: workdir may not be available at startup --- app.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app.json b/app.json index 9c60d3c..577276f 100644 --- a/app.json +++ b/app.json @@ -1,7 +1,7 @@ { "scripts": { "dokku": { - "postdeploy": "su -l -s /bin/sh www-data -c /app/postdeploy.sh" + "postdeploy": "su -l -s /bin/sh www-data -c /app/postdeploy.sh" } } } -- 2.43.4 From 0f51b7ffc12b77fc240dc5cc9743eea7d86d5c8c Mon Sep 17 00:00:00 2001 From: Glenn Date: Sun, 5 May 2024 19:16:51 +0200 Subject: [PATCH 07/12] fix: workdir may not be available at startup --- Dockerfile | 4 ++-- app.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 05bb2be..72268cf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -96,8 +96,8 @@ RUN apt-get update && apt-get install -y \ && mkdir /var/log/supervisord /var/run/supervisord COPY supervisord.conf /etc/supervisord.conf -COPY app.json /app/app.json -COPY postdeploy.sh /app/postdeploy.sh +COPY app.json /app.json +COPY postdeploy.sh /dokku/postdeploy.sh ENV NEXTCLOUD_UPDATE=1 diff --git a/app.json b/app.json index 577276f..8994360 100644 --- a/app.json +++ b/app.json @@ -1,7 +1,7 @@ { "scripts": { "dokku": { - "postdeploy": "su -l -s /bin/sh www-data -c /app/postdeploy.sh" + "postdeploy": "su -l -s /bin/sh www-data -c /dokku/postdeploy.sh" } } } -- 2.43.4 From 56e1f73971caaabf5ae406c2fa1eee593222ad76 Mon Sep 17 00:00:00 2001 From: Glenn Date: Sun, 5 May 2024 19:22:06 +0200 Subject: [PATCH 08/12] fix: workdir may not be available at startup --- Dockerfile | 4 ++-- app.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 72268cf..8b7ca58 100644 --- a/Dockerfile +++ b/Dockerfile @@ -96,8 +96,8 @@ RUN apt-get update && apt-get install -y \ && mkdir /var/log/supervisord /var/run/supervisord COPY supervisord.conf /etc/supervisord.conf -COPY app.json /app.json -COPY postdeploy.sh /dokku/postdeploy.sh +COPY ./app.json /app.json +COPY ./postdeploy.sh /dokku/postdeploy.sh ENV NEXTCLOUD_UPDATE=1 diff --git a/app.json b/app.json index 8994360..072ba6f 100644 --- a/app.json +++ b/app.json @@ -1,7 +1,7 @@ { "scripts": { "dokku": { - "postdeploy": "su -l -s /bin/sh www-data -c /dokku/postdeploy.sh" + "postdeploy": "su -l -s /bin/sh www-data -c /dokku/postdeploy.sh" } } } -- 2.43.4 From e509d0eb288d3336a97d10884dd04fe65409ef4c Mon Sep 17 00:00:00 2001 From: Glenn Date: Sun, 5 May 2024 19:26:20 +0200 Subject: [PATCH 09/12] fix: workdir may not be available at startup --- Dockerfile | 18 +++++++++++------- app.json | 2 +- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8b7ca58..7370409 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,7 +22,8 @@ FROM nextcloud:29.0.0-apache # This is a stupid comment for a demo (remove later) RUN apt-get update \ - && apt-get install -y clamdscan nano ghostscript \ + && apt-get install -y --no-install-recommends \ + clamdscan nano ghostscript \ && apt-get clean # @@ -52,21 +53,24 @@ RUN apt-get update \ ## GMP Support (for bookmark extension) ## RUN apt-get update \ - && apt-get install -y libgmp3-dev \ + && apt-get install -y --no-install-recommends \ + libgmp3-dev \ && docker-php-ext-install gmp ## ## BZ2 Support (for nextcloud) ## RUN apt-get update \ - && apt-get install -y libbz2-dev \ + && apt-get install -y --no-install-recommends \ + libbz2-dev \ && docker-php-ext-install bz2 ## ## SVG and LibreSign support ## RUN apt-get update \ - && apt-get install -y libmagickcore-6.q16-6-extra \ + && apt-get install -y --no-install-recommends \ + libmagickcore-6.q16-6-extra \ && rm -rf /var/lib/apt/lists/* RUN sed -i'' 's|.*|g' \ @@ -90,14 +94,14 @@ RUN echo '[opcache]' > /usr/local/etc/php/conf.d/opcache.ini \ RUN echo '*/5 * * * * php -d memory_limit=1024M -f /var/www/html/cron.php' \ > /var/spool/cron/crontabs/www-data -RUN apt-get update && apt-get install -y \ +RUN apt-get update && apt-get install -y --no-install-recommends \ supervisor \ && rm -rf /var/lib/apt/lists/* \ && mkdir /var/log/supervisord /var/run/supervisord COPY supervisord.conf /etc/supervisord.conf -COPY ./app.json /app.json -COPY ./postdeploy.sh /dokku/postdeploy.sh +COPY ./app.json /app/app.json +COPY ./postdeploy.sh /app/postdeploy.sh ENV NEXTCLOUD_UPDATE=1 diff --git a/app.json b/app.json index 072ba6f..9c60d3c 100644 --- a/app.json +++ b/app.json @@ -1,7 +1,7 @@ { "scripts": { "dokku": { - "postdeploy": "su -l -s /bin/sh www-data -c /dokku/postdeploy.sh" + "postdeploy": "su -l -s /bin/sh www-data -c /app/postdeploy.sh" } } } -- 2.43.4 From b17f8bd0323d9cf66da58d2abeda3145280ba441 Mon Sep 17 00:00:00 2001 From: Glenn Date: Mon, 8 Jul 2024 21:12:45 +0200 Subject: [PATCH 10/12] feat: use internal postdeploy hook instead of dokku's --- Dockerfile | 4 ++-- app.json | 7 ------- postdeploy_hook.sh | 4 ++++ 3 files changed, 6 insertions(+), 9 deletions(-) delete mode 100644 app.json create mode 100755 postdeploy_hook.sh diff --git a/Dockerfile b/Dockerfile index 7370409..32e02a1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -100,8 +100,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ && mkdir /var/log/supervisord /var/run/supervisord COPY supervisord.conf /etc/supervisord.conf -COPY ./app.json /app/app.json -COPY ./postdeploy.sh /app/postdeploy.sh +COPY --chmod=755 ./postdeploy.sh /app/postdeploy.sh +COPY --chmod=755 ./postdeploy_hook.sh /docker-entrypoint-hooks.d/post-installation/postdeploy_hook.sh ENV NEXTCLOUD_UPDATE=1 diff --git a/app.json b/app.json deleted file mode 100644 index 9c60d3c..0000000 --- a/app.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "scripts": { - "dokku": { - "postdeploy": "su -l -s /bin/sh www-data -c /app/postdeploy.sh" - } - } -} diff --git a/postdeploy_hook.sh b/postdeploy_hook.sh new file mode 100755 index 0000000..226408b --- /dev/null +++ b/postdeploy_hook.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +su -l -s /bin/sh www-data -c /app/postdeploy.sh + -- 2.43.4 From 2bd0b79571ebb48ca622b706284214a840c210d5 Mon Sep 17 00:00:00 2001 From: Glenn Date: Mon, 8 Jul 2024 21:14:02 +0200 Subject: [PATCH 11/12] chore: bump to 29.0.3 --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 32e02a1..0b1c552 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,7 +17,7 @@ # FROM nextcloud:27.1.3-apache # FROM nextcloud:27.1.4-apache # FROM nextcloud:28.0.1-apache -FROM nextcloud:29.0.0-apache +FROM nextcloud:29.0.3-apache # This is a stupid comment for a demo (remove later) -- 2.43.4 From 6253e3138e8cdbefec033d0ffff7a97fdb972251 Mon Sep 17 00:00:00 2001 From: Glenn Date: Mon, 8 Jul 2024 21:47:41 +0200 Subject: [PATCH 12/12] ci: buildkit is required for this project --- .drone.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.drone.yml b/.drone.yml index 2e96203..22d4b22 100644 --- a/.drone.yml +++ b/.drone.yml @@ -18,6 +18,7 @@ steps: # path: /stupid environment: DOCKER_REPO: glenux/service-nextcloud + DOCKER_BUILDKIT: 1 settings: username: from_secret: DOCKERHUB_USERNAME @@ -33,6 +34,8 @@ steps: # volumes: # - name: cache # path: /stupid + environment: + DOCKER_BUILDKIT: 1 settings: username: from_secret: DOCKERHUB_USERNAME @@ -50,6 +53,8 @@ steps: - name: publish:latest image: plugins/docker + environment: + DOCKER_BUILDKIT: 1 settings: username: from_secret: DOCKERHUB_USERNAME -- 2.43.4