Ensure shared bootstrap-cache is writable during composer install.
Deploy Ladill QR Plus / deploy (push) Failing after 16s
Deploy Ladill QR Plus / deploy (push) Failing after 16s
Normalize deploy/www-data ownership on shared paths so package:discover can run in CI. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+19
-2
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user