From 5efedfabf8250f906e03f573ac6193b7f448a3e8 Mon Sep 17 00:00:00 2001 From: Matthieu Date: Fri, 3 Apr 2026 15:53:23 +0200 Subject: [PATCH] fix(infra) : fix document storage double nesting in prod MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Les fichiers documents étaient stockés sous storage/storage/documents/ au lieu de storage/ directement, causant des 404 en prod. Le deploy script corrige la structure et le Dockerfile crée le répertoire var/storage/documents dans l'image. Co-Authored-By: Claude Opus 4.6 (1M context) --- infra/prod/Dockerfile | 2 +- infra/prod/deploy.sh | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/infra/prod/Dockerfile b/infra/prod/Dockerfile index 8cea42d..1e215b3 100644 --- a/infra/prod/Dockerfile +++ b/infra/prod/Dockerfile @@ -75,7 +75,7 @@ COPY --from=frontend-build /app/frontend/.output/public /var/www/html/frontend/. RUN echo "APP_ENV=prod" > /var/www/html/.env # Permissions -RUN mkdir -p /var/www/html/var /var/www/html/var/uploads \ +RUN mkdir -p /var/www/html/var /var/www/html/var/uploads /var/www/html/var/storage/documents \ && chown -R www-data:www-data /var/www/html/var WORKDIR /var/www/html diff --git a/infra/prod/deploy.sh b/infra/prod/deploy.sh index 1ec36de..f6139b8 100755 --- a/infra/prod/deploy.sh +++ b/infra/prod/deploy.sh @@ -8,6 +8,19 @@ export INVENTORY_IMAGE_TAG="$TAG" echo "==> Deploying inventory:${TAG}..." +# Fix storage directory structure (one-time migration fix) +# Files were nested under storage/storage/documents/ instead of storage/ directly +if [ -d "storage/storage/documents" ]; then + echo "==> Fixing storage directory structure..." + cp -a storage/storage/documents/* storage/ 2>/dev/null || true + rm -rf storage/storage + echo "==> Storage structure fixed." +fi + +# Ensure storage directory exists with correct ownership +mkdir -p storage +sudo chown -R www-data:www-data storage + echo "==> Enabling maintenance mode..." touch maintenance.on