mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-06-25 16:19:19 +02:00
Fix: split deploy recipe into deploy-code/deploy-deps/deploy-migrate; deploy-deps always syncs composer.json+composer.lock, runs composer install only when lockfile checksum changed
This commit is contained in:
2
TODO.md
2
TODO.md
@@ -164,7 +164,7 @@
|
|||||||
# Current tasks
|
# Current tasks
|
||||||
|
|
||||||
- [x] Add ZipArchive guard to legacy export-files.php
|
- [x] Add ZipArchive guard to legacy export-files.php
|
||||||
- [x] Add composer install --no-dev step to deploy recipe + composer.json/composer.lock rsync (vendor/ excluded from rsync, de-librairisation requires Composer deps on server; composer.json lives in repo root, deploy only syncs app/)
|
- [x] Refactor deploy recipe: split into deploy-code / deploy-deps / deploy-migrate; deploy-deps always syncs composer.json+composer.lock, runs composer install only when lockfile checksum changed
|
||||||
|
|
||||||
- [x] Cleanup modal: list files that will be removed (not just counts)
|
- [x] Cleanup modal: list files that will be removed (not just counts)
|
||||||
- [x] Storage restructure: documents/ → {objet}/ (tfe/theses/frart)
|
- [x] Storage restructure: documents/ → {objet}/ (tfe/theses/frart)
|
||||||
|
|||||||
39
justfile
39
justfile
@@ -37,8 +37,16 @@ logs:
|
|||||||
# ============================================================================
|
# ============================================================================
|
||||||
|
|
||||||
[group('deploy')]
|
[group('deploy')]
|
||||||
deploy:
|
deploy: deploy-code deploy-deps deploy-migrate
|
||||||
# Main deploy (code + assets) then run any pending DB migrations
|
@just deploy-env
|
||||||
|
@just deploy-verify-permissions
|
||||||
|
@echo ""
|
||||||
|
@echo "ℹ️ First deploy? Also run: just deploy-backup"
|
||||||
|
@echo ""
|
||||||
|
|
||||||
|
[group('deploy')]
|
||||||
|
deploy-code:
|
||||||
|
# Sync app code + nginx config + permissions (no Composer deps, no migrations)
|
||||||
rsync -vur --progress --delete \
|
rsync -vur --progress --delete \
|
||||||
--chown="www-data:xamxam" \
|
--chown="www-data:xamxam" \
|
||||||
--exclude '/vendor' \
|
--exclude '/vendor' \
|
||||||
@@ -75,19 +83,28 @@ deploy:
|
|||||||
ssh -t xamxam "sudo bash /tmp/deploy-server.sh"
|
ssh -t xamxam "sudo bash /tmp/deploy-server.sh"
|
||||||
ssh xamxam "rm -f /tmp/deploy-server.sh /tmp/xamxam.conf"
|
ssh xamxam "rm -f /tmp/deploy-server.sh /tmp/xamxam.conf"
|
||||||
ssh xamxam "mkdir -p /var/www/xamxam/var/{cache,logs,tmp}"
|
ssh xamxam "mkdir -p /var/www/xamxam/var/{cache,logs,tmp}"
|
||||||
# Install/update Composer dependencies (vendor/ excluded from rsync above)
|
|
||||||
|
[group('deploy')]
|
||||||
|
deploy-deps:
|
||||||
|
# Sync composer.json + composer.lock to server, then run composer install
|
||||||
|
# (only if composer.lock checksum changed — skip expensive install otherwise)
|
||||||
rsync -v composer.json composer.lock xamxam:/var/www/xamxam/
|
rsync -v composer.json composer.lock xamxam:/var/www/xamxam/
|
||||||
ssh xamxam "cd /var/www/xamxam && composer install --no-dev --no-interaction --optimize-autoloader"
|
ssh xamxam 'cd /var/www/xamxam && \
|
||||||
# Run pending migrations (creates DB from schema if missing, idempotent)
|
if [ ! -f vendor/.composer-lock-checksum ] || \
|
||||||
|
[ "$(sha256sum composer.lock | cut -d" " -f1)" != "$(cat vendor/.composer-lock-checksum)" ]; then \
|
||||||
|
echo "→ composer.lock changed, installing dependencies…"; \
|
||||||
|
composer install --no-dev --no-interaction --optimize-autoloader && \
|
||||||
|
sha256sum composer.lock | cut -d" " -f1 > vendor/.composer-lock-checksum; \
|
||||||
|
else \
|
||||||
|
echo "→ composer.lock unchanged, skipping composer install"; \
|
||||||
|
fi'
|
||||||
|
|
||||||
|
[group('deploy')]
|
||||||
|
deploy-migrate:
|
||||||
|
# Run pending DB migrations (creates DB from schema if missing, idempotent)
|
||||||
rsync -v scripts/migrate.sh xamxam:/tmp/migrate.sh
|
rsync -v scripts/migrate.sh xamxam:/tmp/migrate.sh
|
||||||
ssh xamxam "cd /var/www/xamxam && REPO_ROOT=/var/www/xamxam bash /tmp/migrate.sh"
|
ssh xamxam "cd /var/www/xamxam && REPO_ROOT=/var/www/xamxam bash /tmp/migrate.sh"
|
||||||
ssh xamxam "rm -f /tmp/migrate.sh"
|
ssh xamxam "rm -f /tmp/migrate.sh"
|
||||||
# Sync .env separately (excluded above to avoid accidental overwrite on subsequent deploys)
|
|
||||||
@just deploy-env
|
|
||||||
@just deploy-verify-permissions
|
|
||||||
@echo ""
|
|
||||||
@echo "ℹ️ First deploy? Also run: just deploy-backup"
|
|
||||||
@echo ""
|
|
||||||
|
|
||||||
[group('deploy')]
|
[group('deploy')]
|
||||||
deploy-env:
|
deploy-env:
|
||||||
|
|||||||
Reference in New Issue
Block a user