Merge branch 'fix-laravel-app-root'

This commit is contained in:
Yisroel Baum 2026-05-09 22:29:15 +03:00
commit 069d62b5d9
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9

View file

@ -139,29 +139,24 @@ in
}; };
script = '' script = ''
set -eu set -eu
# Copy the immutable store package into a writable app root.
# Symlinking would defeat Laravel's __DIR__ based path
# resolution: PHP's __DIR__ follows symlinks back to the
# read only store, breaking storage/ and bootstrap/cache/
# writes even when those subtrees are themselves symlinked
# into a writable state dir.
rm -rf ${appRoot} rm -rf ${appRoot}
mkdir -p ${appRoot} mkdir -p ${appRoot}
for entry in ${cfg.backendPackage}/share/php/tide-backend/*; do cp -rL ${cfg.backendPackage}/share/php/tide-backend/. ${appRoot}/
name="$(basename "$entry")" chmod -R u+w ${appRoot}
case "$name" in
storage|bootstrap) # Redirect the two mutable subtrees to /var/lib/tide/state
;; # so they survive activations and don't accumulate inside
*) # the disposable app root copy.
ln -s "$entry" "${appRoot}/$name" rm -rf ${appRoot}/storage ${appRoot}/bootstrap/cache
;;
esac
done
# bootstrap dir: symlink everything from the store
# except cache/ which must be writable.
mkdir -p ${appRoot}/bootstrap
for entry in ${cfg.backendPackage}/share/php/tide-backend/bootstrap/*; do
name="$(basename "$entry")"
if [ "$name" != "cache" ]; then
ln -sf "$entry" "${appRoot}/bootstrap/$name"
fi
done
ln -sfn ${stateRoot}/bootstrap-cache ${appRoot}/bootstrap/cache
ln -sfn ${stateRoot}/storage ${appRoot}/storage ln -sfn ${stateRoot}/storage ${appRoot}/storage
ln -sfn ${stateRoot}/bootstrap-cache ${appRoot}/bootstrap/cache
chown -R ${cfg.user}:${cfg.group} ${appRoot} ${stateRoot} chown -R ${cfg.user}:${cfg.group} ${appRoot} ${stateRoot}
''; '';