From a2d588223a2c93935c6071ed84bc371f9ded82ab Mon Sep 17 00:00:00 2001 From: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> Date: Tue, 5 May 2026 19:01:29 -0300 Subject: [PATCH 1/4] fix(docker): fail fast when nextcloud install fails Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> --- .docker/scripts/entrypoint.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/.docker/scripts/entrypoint.sh b/.docker/scripts/entrypoint.sh index 8525685..b8732e1 100644 --- a/.docker/scripts/entrypoint.sh +++ b/.docker/scripts/entrypoint.sh @@ -22,16 +22,34 @@ mkdir -p apps-extra # Wait for database php /var/www/scripts/wait-for-db.php +install_cmd_status=0 + # Set configurations, if needed if [[ ! -f "config/config.php" && ${AUTOINSTALL} -eq 1 ]]; then echo "⌛️ Starting installation ..." chown -R www-data:www-data . if [[ ${DB_HOST} == 'mysql' ]]; then occ maintenance:install --verbose --database="${DB_HOST}" --database-name="${MYSQL_DATABASE}" --database-host="${DB_HOST}" --database-port= --database-user="${MYSQL_USER}" --database-pass="${MYSQL_PASSWORD}" --admin-user="${NEXTCLOUD_ADMIN_USER}" --admin-pass="${NEXTCLOUD_ADMIN_PASSWORD}" --admin-email="${NEXTCLOUD_ADMIN_EMAIL}" + install_cmd_status=$? elif [[ "${DB_HOST}" == 'pgsql' ]]; then occ maintenance:install --verbose --database="${DB_HOST}" --database-name="${POSTGRES_DB}" --database-host="${DB_HOST}" --database-port= --database-user="${POSTGRES_USER}" --database-pass="${POSTGRES_PASSWORD}" --admin-user="${NEXTCLOUD_ADMIN_USER}" --admin-pass="${NEXTCLOUD_ADMIN_PASSWORD}" --admin-email="${NEXTCLOUD_ADMIN_EMAIL}" + install_cmd_status=$? else occ maintenance:install --verbose --admin-user="${NEXTCLOUD_ADMIN_USER}" --admin-pass="${NEXTCLOUD_ADMIN_PASSWORD}" --admin-email="${NEXTCLOUD_ADMIN_EMAIL}" + install_cmd_status=$? + fi + + if [[ ${install_cmd_status} -ne 0 ]]; then + db_reset_hint="volumes/nextcloud/config and volumes/nextcloud/data" + if [[ ${DB_HOST} == 'mysql' ]]; then + db_reset_hint="volumes/mysql/data, ${db_reset_hint}" + elif [[ ${DB_HOST} == 'pgsql' ]]; then + db_reset_hint="volumes/postgres/data, ${db_reset_hint}" + fi + + echo "❌ Installation failed. Check the logs above for the exact reason." + echo " If this is a local reset issue, remove: ${db_reset_hint}" + exit ${install_cmd_status} fi echo "🔧 Making initial config ..." @@ -111,6 +129,11 @@ EOF echo "🥳 Setup completed !!!" fi +if ! occ status | grep -q 'installed: true'; then + echo "❌ Nextcloud is not installed. Skipping startup tasks and stopping container." + exit 1 +fi + # Run cron echo "📅 Running cron for the first time ..." exec busybox crond -f -l 0 -L /dev/stdout > /dev/null 2>&1 & From 3fb8200dc35ed1f0c47769d5dc788cef0c7fa0d3 Mon Sep 17 00:00:00 2001 From: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> Date: Tue, 5 May 2026 19:01:30 -0300 Subject: [PATCH 2/4] docs(faq): clarify full reset volume paths Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> --- docs/faq.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/faq.md b/docs/faq.md index 9ec877d..0c0d946 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -5,7 +5,7 @@ ### Reset entire setup? - Go down the containers -- Remove the folder volumes +- Remove persisted volumes (`volumes/mysql/data`, `volumes/nextcloud/config` and `volumes/nextcloud/data`) or remove the entire `volumes` folder - Go up the containers This will delete the database and Nextcloud volumes. Before do a backup of all that you don't want to lost, by example `volumes/nextcloud/config/config.php` From 293811566c2fa32aeb80c7562e5b721abceb2ba1 Mon Sep 17 00:00:00 2001 From: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> Date: Tue, 5 May 2026 19:06:04 -0300 Subject: [PATCH 3/4] fix(ci): address shellcheck warnings in helper scripts Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> --- .docker/bin/test-e2e | 3 +-- .docker/bin/test-e2e-headed | 2 +- .docker/bin/test-e2e-report | 2 +- .docker/bin/test-e2e-ui | 2 +- .docker/bin/trust-local-cert | 2 +- 5 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.docker/bin/test-e2e b/.docker/bin/test-e2e index 26d5355..dcf7780 100755 --- a/.docker/bin/test-e2e +++ b/.docker/bin/test-e2e @@ -10,7 +10,7 @@ elif [ -n "$1" ] && [ -d "volumes/nextcloud/$1" ]; then APP_PATH="volumes/nextcloud/$1" shift elif [ -n "$APP_PATH" ]; then - APP_PATH="$APP_PATH" + : elif [ -f "package.json" ] && [ -f "appinfo/info.xml" ]; then # We're inside an app directory APP_PATH="." @@ -49,7 +49,6 @@ else fi fi -CONTAINER="nextcloud-playwright" WORKSPACE="/var/www/html/$RELATIVE_PATH" GREEN='\033[0;32m' diff --git a/.docker/bin/test-e2e-headed b/.docker/bin/test-e2e-headed index 43b1809..19fc5c5 100755 --- a/.docker/bin/test-e2e-headed +++ b/.docker/bin/test-e2e-headed @@ -9,7 +9,7 @@ elif [ -n "$1" ] && [ -d "volumes/nextcloud/$1" ]; then APP_PATH="volumes/nextcloud/$1" shift elif [ -n "$APP_PATH" ]; then - APP_PATH="$APP_PATH" + : elif [ -f "package.json" ] && [ -f "appinfo/info.xml" ]; then APP_PATH="." else diff --git a/.docker/bin/test-e2e-report b/.docker/bin/test-e2e-report index a5bbfc4..6c003b5 100755 --- a/.docker/bin/test-e2e-report +++ b/.docker/bin/test-e2e-report @@ -10,7 +10,7 @@ elif [ -n "$1" ] && [ -d "volumes/nextcloud/$1" ]; then APP_PATH="volumes/nextcloud/$1" shift elif [ -n "$APP_PATH" ]; then - APP_PATH="$APP_PATH" + : elif [ -f "package.json" ] && [ -f "appinfo/info.xml" ]; then # We're inside an app directory APP_PATH="." diff --git a/.docker/bin/test-e2e-ui b/.docker/bin/test-e2e-ui index 8e2541c..7a8b1fa 100755 --- a/.docker/bin/test-e2e-ui +++ b/.docker/bin/test-e2e-ui @@ -9,7 +9,7 @@ elif [ -n "$1" ] && [ -d "volumes/nextcloud/$1" ]; then APP_PATH="volumes/nextcloud/$1" shift elif [ -n "$APP_PATH" ]; then - APP_PATH="$APP_PATH" + : elif [ -f "package.json" ] && [ -f "appinfo/info.xml" ]; then APP_PATH="." else diff --git a/.docker/bin/trust-local-cert b/.docker/bin/trust-local-cert index 6c5bf33..e9f22ad 100755 --- a/.docker/bin/trust-local-cert +++ b/.docker/bin/trust-local-cert @@ -2,7 +2,7 @@ set -eu -ROOT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")/../.." && pwd) +ROOT_DIR=$(CDPATH='' cd -- "$(dirname -- "$0")/../.." && pwd) cd "$ROOT_DIR" container_id=$(docker compose ps -q nginx) From ded3de5ca74905c561ea949642d4e77b3c9fb489 Mon Sep 17 00:00:00 2001 From: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> Date: Tue, 5 May 2026 19:09:43 -0300 Subject: [PATCH 4/4] fix(ci): avoid cross-workflow concurrency cancellation Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com> --- .github/workflows/docker-nginx.yml | 2 +- .github/workflows/docker-php.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker-nginx.yml b/.github/workflows/docker-nginx.yml index 5b0d3bd..2a3bbbe 100644 --- a/.github/workflows/docker-nginx.yml +++ b/.github/workflows/docker-nginx.yml @@ -9,7 +9,7 @@ on: - main concurrency: - group: push-to-registry-${{ github.head_ref || github.run_id }} + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} cancel-in-progress: true jobs: diff --git a/.github/workflows/docker-php.yml b/.github/workflows/docker-php.yml index 4ed574f..fcc1f8b 100644 --- a/.github/workflows/docker-php.yml +++ b/.github/workflows/docker-php.yml @@ -9,7 +9,7 @@ on: - main concurrency: - group: push-to-registry-${{ github.head_ref || github.run_id }} + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} cancel-in-progress: true jobs: