docs(cache): add comprehensive cache configuration and permission handling guides
- Introduce `cache-configuration.md` for detailed instructions on cache setup, permission troubleshooting, and best practices. - Add `cache-permissions-quick-fix.md` for concise resolutions to common permission errors. - Include a detailed `FILECACHE_PERMISSION_FIX_PLAN.md` outlining solutions for permission-related issues. - Enhance `docker-entrypoint.sh` with permission fixes for multi-user caches. - Update `Makefile` with cache clear commands for local and staging environments. - Improve `FileCache` for graceful degradation on permission errors, ensuring reliability under multi-user scenarios.
This commit is contained in:
74
docs/deployment/cache-permissions-quick-fix.md
Normal file
74
docs/deployment/cache-permissions-quick-fix.md
Normal file
@@ -0,0 +1,74 @@
|
||||
# Cache Permissions Quick Fix
|
||||
|
||||
## Problem
|
||||
|
||||
```
|
||||
chown: invalid user: 'appuser:appuser'
|
||||
```
|
||||
|
||||
Der User `appuser` existiert nicht im Container, oder es wird ein anderer User verwendet.
|
||||
|
||||
## L?sung: Dynamischer Fix
|
||||
|
||||
### Schritt 1: Ermittle den korrekten User
|
||||
|
||||
```bash
|
||||
# Pr?fe welcher User verwendet wird
|
||||
docker exec staging-app whoami
|
||||
docker exec staging-app id
|
||||
|
||||
# Pr?fe PHP-FPM Konfiguration
|
||||
docker exec staging-app grep "^user = " /usr/local/etc/php-fpm.d/*.conf
|
||||
```
|
||||
|
||||
### Schritt 2: Fix Berechtigungen (automatisch)
|
||||
|
||||
```bash
|
||||
# Automatisch - ermittle User aus PHP-FPM Config
|
||||
docker exec -it --user root staging-app bash -c '
|
||||
USER=$(grep "^user = " /usr/local/etc/php-fpm.d/*.conf 2>/dev/null | head -1 | cut -d"=" -f2 | tr -d " ;")
|
||||
[ -z "$USER" ] && USER="www-data"
|
||||
echo "Using user: $USER"
|
||||
chown -R $USER:$USER /var/www/html/storage/cache
|
||||
chmod -R 775 /var/www/html/storage/cache
|
||||
'
|
||||
```
|
||||
|
||||
### Schritt 3: Fix existierende Dateien
|
||||
|
||||
```bash
|
||||
docker exec -it --user root staging-app bash -c '
|
||||
USER=$(grep "^user = " /usr/local/etc/php-fpm.d/*.conf 2>/dev/null | head -1 | cut -d"=" -f2 | tr -d " ;")
|
||||
[ -z "$USER" ] && USER="www-data"
|
||||
find /var/www/html/storage/cache -type f -exec chmod 644 {} \;
|
||||
find /var/www/html/storage/cache -type d -exec chmod 775 {} \;
|
||||
chown -R $USER:$USER /var/www/html/storage/cache
|
||||
echo "Fixed permissions for user: $USER"
|
||||
'
|
||||
```
|
||||
|
||||
## Alternative: Manuelle Fix
|
||||
|
||||
Wenn du wei?t, welcher User verwendet wird:
|
||||
|
||||
**F?r `www-data` (Production):**
|
||||
```bash
|
||||
docker exec -it --user root staging-app chown -R www-data:www-data /var/www/html/storage/cache
|
||||
docker exec -it --user root staging-app chmod -R 775 /var/www/html/storage/cache
|
||||
```
|
||||
|
||||
**F?r `appuser` (Development/Staging):**
|
||||
```bash
|
||||
docker exec -it --user root staging-app chown -R appuser:appuser /var/www/html/storage/cache
|
||||
docker exec -it --user root staging-app chmod -R 775 /var/www/html/storage/cache
|
||||
```
|
||||
|
||||
## Verifikation
|
||||
|
||||
```bash
|
||||
# Pr?fe Berechtigungen
|
||||
docker exec staging-app ls -ld /var/www/html/storage/cache
|
||||
|
||||
# Pr?fe Owner
|
||||
docker exec staging-app ls -l /var/www/html/storage/cache | head -5
|
||||
```
|
||||
Reference in New Issue
Block a user