From 2faa10b54cec2889d7f654ca3b4a6f9dd274cafb Mon Sep 17 00:00:00 2001 From: isaacclad Date: Sat, 6 Jun 2026 21:46:12 +0000 Subject: [PATCH] Ensure shared bootstrap-cache is writable during composer install. Normalize deploy/www-data ownership on shared paths so package:discover can run in CI. Co-authored-by: Cursor --- deploy/deploy.sh | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/deploy/deploy.sh b/deploy/deploy.sh index 4f46fac..610d618 100755 --- a/deploy/deploy.sh +++ b/deploy/deploy.sh @@ -47,6 +47,23 @@ ensure_writable_paths() { fi } +normalize_shared_permissions() { + local owner="${LADILL_DEPLOY_USER:-deploy}" + local group="${LADILL_DEPLOY_GROUP:-www-data}" + local shared_paths=("$SHARED_DIR/storage" "$SHARED_DIR/bootstrap-cache") + + id -u "$owner" >/dev/null 2>&1 || return 0 + getent group "$group" >/dev/null 2>&1 || return 0 + + if chown -R "$owner:$group" "${shared_paths[@]}" 2>/dev/null; then + : + elif command -v sudo >/dev/null 2>&1; then + sudo -n chown -R "$owner:$group" "${shared_paths[@]}" 2>/dev/null || true + fi + + ensure_writable_paths "${shared_paths[@]}" +} + run_artisan() { local command="$1" @@ -123,7 +140,7 @@ chmod -R u+rwX "$NEW_RELEASE" 2>/dev/null || true log "Linking shared paths" mkdir -p "$SHARED_DIR/storage/"{app/public,app/private,framework/{cache/data,sessions,testing,views},logs} mkdir -p "$SHARED_DIR/bootstrap-cache" -ensure_writable_paths "$SHARED_DIR/storage" "$SHARED_DIR/bootstrap-cache" +normalize_shared_permissions if bootstrap_shared_env; then ln -sfn "$SHARED_DIR/.env" "$NEW_RELEASE/.env" @@ -137,7 +154,7 @@ ln -sfn "$SHARED_DIR/storage" "$NEW_RELEASE/storage" mkdir -p "$NEW_RELEASE/bootstrap" rm -rf "$NEW_RELEASE/bootstrap/cache" ln -sfn "$SHARED_DIR/bootstrap-cache" "$NEW_RELEASE/bootstrap/cache" -ensure_writable_paths "$NEW_RELEASE/storage" "$NEW_RELEASE/bootstrap/cache" +normalize_shared_permissions if uses_sqlite; then log "Preparing shared sqlite database"