diff --git a/TODO.md b/TODO.md index 9520012..39acae9 100644 --- a/TODO.md +++ b/TODO.md @@ -32,6 +32,13 @@ - [x] Exclude `storage/theses/` from rsync (not sent locally, not deleted remotely) - [x] Exclude `storage/covers/` from rsync (not sent locally, not deleted remotely) +## Deploy — Rename deploy path to /var/www/xamxam + +- [x] Update rsync destination in `justfile` (`deploy`, `deploy-db` recipes) +- [x] Update all `/var/www/posterg` paths in `scripts/deploy-server.sh` +- [x] Update `root` directive in `nginx/posterg.conf` +- [x] Update `STORAGE_ROOT` production path in `app/bootstrap.php` + ## File Display in Forms & Recaps - [x] Add live file preview to `file-field.php` partial (`data-preview` attribute + `.file-preview-list` container) diff --git a/app/bootstrap.php b/app/bootstrap.php index 2ecf7b4..ba25c7c 100644 --- a/app/bootstrap.php +++ b/app/bootstrap.php @@ -14,7 +14,7 @@ define('APP_ROOT', __DIR__); // absolute path outside the webroot. define('STORAGE_ROOT', php_sapi_name() === 'cli-server' ? __DIR__ . '/storage' - : '/var/www/posterg/storage' + : '/var/www/xamxam/storage' ); // Error reporting diff --git a/justfile b/justfile index 00878e1..98297f6 100644 --- a/justfile +++ b/justfile @@ -48,8 +48,8 @@ deploy: --exclude 'storage/docs' \ --exclude 'var/cache/*' \ --exclude 'var/logs/*' \ - app/ posterg:/var/www/posterg/ - ssh posterg "mkdir -p /var/www/posterg/var/{cache,logs,tmp}" + app/ posterg:/var/www/xamxam/ + ssh posterg "mkdir -p /var/www/xamxam/var/{cache,logs,tmp}" [group('deploy')] setup-server: @@ -82,9 +82,9 @@ deploy-nginx: [group('deploy')] deploy-db: - @ssh posterg '[ ! -f /var/www/posterg/storage/posterg.db ]' || (echo "ERROR: remote database already exists. Remove it manually if you intend to overwrite." && exit 1) - rsync -v --progress app/storage/posterg.db posterg:/var/www/posterg/storage/posterg.db - ssh posterg "chown www-data:posterg /var/www/posterg/storage/posterg.db && chmod 660 /var/www/posterg/storage/posterg.db" + @ssh posterg '[ ! -f /var/www/xamxam/storage/posterg.db ]' || (echo "ERROR: remote database already exists. Remove it manually if you intend to overwrite." && exit 1) + rsync -v --progress app/storage/posterg.db posterg:/var/www/xamxam/storage/posterg.db + ssh posterg "chown www-data:posterg /var/www/xamxam/storage/posterg.db && chmod 660 /var/www/xamxam/storage/posterg.db" # ============================================================================ # Testing diff --git a/nginx/posterg.conf b/nginx/posterg.conf index 7bb9fcf..bbb2086 100644 --- a/nginx/posterg.conf +++ b/nginx/posterg.conf @@ -18,7 +18,7 @@ server { server_name posterg.erg.be www.posterg.erg.be; # Document root points to /public (only web-accessible files) - # Deployed structure: /var/www/posterg/ + # Deployed structure: /var/www/xamxam/ # /public - Web root ← THIS DIRECTORY # /admin - Admin interface # /assets - CSS, fonts, icons @@ -28,7 +28,7 @@ server { # /tests - Test suites (outside webroot) # /bootstrap.php - Application entry point # /router.php - Dev server URL rewriter - root /var/www/posterg/public; + root /var/www/xamxam/public; # Add index.php to the list index index.php index.html index.htm; diff --git a/scripts/deploy-server.sh b/scripts/deploy-server.sh index 6e8d8b3..dea18a6 100755 --- a/scripts/deploy-server.sh +++ b/scripts/deploy-server.sh @@ -27,25 +27,25 @@ printf "==================================\n\n" printf "📋 Step 1: Fixing file permissions...\n" echo "--------------------------------------" -chown -R www-data:posterg /var/www/posterg/ +chown -R www-data:posterg /var/www/xamxam/ ok "Ownership: www-data:posterg" -find /var/www/posterg -type d -exec chmod 2775 {} \; +find /var/www/xamxam -type d -exec chmod 2775 {} \; ok "Directories: 2775 (setgid)" -find /var/www/posterg -type f -exec chmod 664 {} \; +find /var/www/xamxam -type f -exec chmod 664 {} \; ok "Files: 664" -if [ -d "/var/www/posterg/storage" ]; then - chmod 2775 /var/www/posterg/storage - find /var/www/posterg/storage -name "*.db" -exec chmod 660 {} \; +if [ -d "/var/www/xamxam/storage" ]; then + chmod 2775 /var/www/xamxam/storage + find /var/www/xamxam/storage -name "*.db" -exec chmod 660 {} \; ok "Storage: 2775, databases: 660" fi # Ensure writable cache subdirectories exist for php-fpm (www-data) -mkdir -p /var/www/posterg/storage/cache/rate_limit -chown -R www-data:posterg /var/www/posterg/storage/cache -chmod -R 2775 /var/www/posterg/storage/cache +mkdir -p /var/www/xamxam/storage/cache/rate_limit +chown -R www-data:posterg /var/www/xamxam/storage/cache +chmod -R 2775 /var/www/xamxam/storage/cache ok "Cache dirs: created and owned by www-data:posterg" # ── Step 2: Nginx config ──────────────────────────────────────────────────────