From 65034663440d1d0702343a28b4b239579896ec82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20K=C3=BChn?= Date: Wed, 29 Apr 2026 20:39:27 +0200 Subject: [PATCH] Run deploy commands as www-data for correct file ownership SSH key copied to /var/www/.ssh/ for www-data GitHub access. All git, composer, and console commands now run as www-data so var/cache/ files are always owned correctly without a manual chown. Co-Authored-By: Claude Sonnet 4.6 --- deploy.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/deploy.sh b/deploy.sh index 2af7d9d..b82973e 100755 --- a/deploy.sh +++ b/deploy.sh @@ -4,14 +4,16 @@ set -e cd "$(dirname "$0")" -git pull -COMPOSER_ALLOW_SUPERUSER=1 composer install --no-dev --no-interaction --optimize-autoloader --ignore-platform-reqs +RUN="su -s /bin/sh www-data -c" + +$RUN "git pull" +$RUN "COMPOSER_ALLOW_SUPERUSER=1 composer install --no-dev --no-interaction --optimize-autoloader --ignore-platform-reqs" # Alias-Deployment: RewriteBase auf /dd/ setzen sed -i 's|RewriteBase /$|RewriteBase /dd/|' public/.htaccess -APP_ENV=prod php bin/console doctrine:migrations:migrate --no-interaction --env=prod -APP_ENV=prod php bin/console cache:clear --env=prod --no-warmup -chown -R www-data:www-data var/ +$RUN "APP_ENV=prod php bin/console doctrine:migrations:migrate --no-interaction --env=prod" +$RUN "APP_ENV=prod php bin/console cache:clear --env=prod --no-warmup" +$RUN "APP_ENV=prod php bin/console cache:warmup --env=prod" echo "Deploy fertig."