Compare commits

..

9 Commits

Author SHA1 Message Date
gitea-actions
c64b125047 chore : bump version to v1.9.15
All checks were successful
Auto Tag Develop / tag (push) Successful in 8s
Build & Push Docker Image / build (push) Successful in 39s
2026-04-04 09:23:14 +00:00
85c7c97dc3 feat(infra) : add pull-prod-db script and make target
Some checks failed
Auto Tag Develop / tag (push) Has been cancelled
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 11:22:34 +02:00
gitea-actions
1705a3688b chore : bump version to v1.9.14
All checks were successful
Auto Tag Develop / tag (push) Successful in 8s
Build & Push Docker Image / build (push) Successful in 2m2s
2026-04-03 14:23:58 +00:00
Matthieu
34b36f5d14 fix(infra) : add qpdf to production Docker image
All checks were successful
Auto Tag Develop / tag (push) Successful in 9s
qpdf was only installed in dev Dockerfile, causing the PDF compressor
to silently skip compression in production.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 16:23:47 +02:00
gitea-actions
d6b74f01f9 chore : bump version to v1.9.13
All checks were successful
Auto Tag Develop / tag (push) Successful in 7s
Build & Push Docker Image / build (push) Successful in 37s
2026-04-03 13:53:38 +00:00
Matthieu
5efedfabf8 fix(infra) : fix document storage double nesting in prod
Some checks failed
Auto Tag Develop / tag (push) Has been cancelled
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) <noreply@anthropic.com>
2026-04-03 15:53:23 +02:00
gitea-actions
d0aba111b3 chore : bump version to v1.9.12
All checks were successful
Auto Tag Develop / tag (push) Successful in 10s
Build & Push Docker Image / build (push) Successful in 45s
2026-04-03 12:05:38 +00:00
6eaefdbbbf Merge branch 'feat/empty-slot-highlight' into develop
Some checks failed
Auto Tag Develop / tag (push) Has been cancelled
2026-04-03 14:05:23 +02:00
gitea-actions
3cf9db8829 chore : bump version to v1.9.11
All checks were successful
Auto Tag Develop / tag (push) Successful in 8s
Build & Push Docker Image / build (push) Successful in 41s
2026-04-02 12:36:04 +00:00
5 changed files with 71 additions and 3 deletions

View File

@@ -1,2 +1,2 @@
parameters:
app.version: '1.9.10'
app.version: '1.9.15'

View File

@@ -42,7 +42,7 @@ FROM php:8.4-fpm AS production
RUN apt-get update && apt-get install -y \
libicu-dev libpq-dev libpng-dev libzip-dev libxml2-dev \
nginx supervisor \
nginx supervisor qpdf \
&& docker-php-ext-install -j$(nproc) intl pdo_pgsql zip gd opcache \
&& rm -rf /var/lib/apt/lists/*
@@ -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

View File

@@ -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

View File

@@ -157,6 +157,10 @@ fixtures-load:
$(DOCKER_COMPOSE) exec -T db psql -U $(POSTGRES_USER) -d $(POSTGRES_DB) -c "SET session_replication_role = DEFAULT;"
@echo "Fixtures loaded!"
pull-prod-db:
@echo "Pulling production database..."
./scripts/pull-prod-db.sh
fixtures-reset:
@echo "Resetting database and loading fixtures..."
$(DOCKER_COMPOSE) exec -T db psql -U $(POSTGRES_USER) -d $(POSTGRES_DB) -c "DO \$$\$$ DECLARE r RECORD; BEGIN FOR r IN (SELECT tablename FROM pg_tables WHERE schemaname = 'public' AND tablename != 'doctrine_migration_versions') LOOP EXECUTE 'TRUNCATE TABLE ' || quote_ident(r.tablename) || ' CASCADE'; END LOOP; END \$$\$$;"

51
scripts/pull-prod-db.sh Executable file
View File

@@ -0,0 +1,51 @@
#!/usr/bin/env bash
set -euo pipefail
# ============================================================
# pull-prod-db.sh — Importe la BDD inventory_prod de prod en local
# ============================================================
#
# Usage : ./scripts/pull-prod-db.sh [SSH_HOST]
#
# SSH_HOST : alias ou adresse du serveur prod (default: prod)
#
# Prérequis :
# - Accès SSH au serveur de prod
# - Docker en cours sur la prod (conteneur "postgres", user "admin")
# - Docker compose Inventory en cours en local (make start)
SSH_HOST="${1:-matt@prod.malio-dev.fr}"
PROD_CONTAINER="postgres"
PROD_DB="inventory_prod"
PROD_USER="admin"
LOCAL_COMPOSE="docker compose --env-file infra/dev/.env.docker"
LOCAL_DB_SERVICE="db"
LOCAL_DB="inventory"
LOCAL_USER="root"
DUMP_FILE="/tmp/inventory_prod_dump.sql"
echo "==> Dump de ${PROD_DB} depuis ${SSH_HOST}..."
ssh "${SSH_HOST}" "docker exec ${PROD_CONTAINER} pg_dump -U ${PROD_USER} -d ${PROD_DB} \
--no-owner --no-privileges --clean --if-exists" > "${DUMP_FILE}"
DUMP_SIZE=$(du -h "${DUMP_FILE}" | cut -f1)
echo "==> Dump recu : ${DUMP_FILE} (${DUMP_SIZE})"
echo "==> Reset de la BDD locale (${LOCAL_DB})..."
${LOCAL_COMPOSE} exec -T ${LOCAL_DB_SERVICE} psql -U ${LOCAL_USER} -d postgres -c \
"SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname='${LOCAL_DB}' AND pid <> pg_backend_pid();" > /dev/null 2>&1 || true
${LOCAL_COMPOSE} exec -T ${LOCAL_DB_SERVICE} psql -U ${LOCAL_USER} -d postgres -c \
"DROP DATABASE IF EXISTS ${LOCAL_DB};"
${LOCAL_COMPOSE} exec -T ${LOCAL_DB_SERVICE} psql -U ${LOCAL_USER} -d postgres -c \
"CREATE DATABASE ${LOCAL_DB};"
echo "==> Import du dump dans la BDD locale..."
${LOCAL_COMPOSE} exec -T ${LOCAL_DB_SERVICE} psql -U ${LOCAL_USER} -d ${LOCAL_DB} < "${DUMP_FILE}"
echo "==> Nettoyage..."
rm -f "${DUMP_FILE}"
echo ""
echo "Done! BDD locale '${LOCAL_DB}' synchronisee avec '${PROD_DB}' de prod."