Skip to content

Instantly share code, notes, and snippets.

@ERPedersen
Created June 29, 2020 07:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ERPedersen/8e58bcb8afb750b9cd56363933f6c3d1 to your computer and use it in GitHub Desktop.
Save ERPedersen/8e58bcb8afb750b9cd56363933f6c3d1 to your computer and use it in GitHub Desktop.
Laravel Envoyer - Log ACL
# Laravel Envoyer - Fix Log Permissions:
# ---
# Sets up access control restrictions, so both the deployment user 'forge'
# and the web-server's user 'www-data' can access generated log files.
PROJECT_DIRS="storage"
RELEASE_DIRS="bootstrap/cache"
cd {{ project }}
for i in $PROJECT_DIRS; do
if [ -d $i ]; then
HAS_ACL=`getfacl -p $i | grep "^user:www-data:.*w" | wc -l`
if [ $HAS_ACL -eq 0 ]; then
echo "ACL set for directory {{project}}/$i"
setfacl -L -R -m u:www-data:rwX -m u:forge:rwX $i
setfacl -dL -R -m u:www-data:rwX -m u:forge:rwX $i
fi
fi
done
cd {{ release }}
for i in $RELEASE_DIRS; do
if [ -d $i ]; then
HAS_ACL=`getfacl -p $i | grep "^user:www-data:.*w" | wc -l`
if [ $HAS_ACL -eq 0 ]; then
echo "ACL set for directory {{project}}/$i"
setfacl -L -R -m u:www-data:rwX -m u:forge:rwX $i
setfacl -dL -R -m u:www-data:rwX -m u:forge:rwX $i
fi
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment