Nginx config, working deploy, basic theme, repo cleanup

This commit is contained in:
Théophile Gervreau-Mercier
2026-02-05 17:33:10 +01:00
parent 2cb5436647
commit f23fbb481b
30 changed files with 4536 additions and 760 deletions

View File

@@ -12,11 +12,19 @@ default:
deploy-public:
rsync -vur --progress --exclude 'test.db' --exclude '*.db' --exclude 'tests/' --exclude 'cache/' --exclude '*.md' --exclude 'run-tests.php' ./apps/public/ posterg:/var/www/html/
rsync -vur --progress --exclude 'test.db' ./shared/ posterg:/var/www/html/shared/
@echo "Fixing shared library paths for production..."
ssh posterg "cd /var/www/html && find . -maxdepth 1 -name '*.php' -type f -exec sed -i \"s|__DIR__ \. '/\.\./\.\./shared/|__DIR__ . '/shared/|g\" {} \;"
@echo "Fixing permissions..."
ssh posterg "chgrp -R posterg /var/www/html/inc && chmod 755 /var/www/html/inc && chmod 644 /var/www/html/inc/*"
@echo "✓ Deployment complete"
[group('deploy')]
deploy-admin:
rsync -vur --progress --exclude 'test.db' --exclude '*.db' --exclude 'cache/' --exclude '*.md' ./apps/admin/ posterg:/var/www/html/formulaire/
rsync -vur --progress --exclude 'test.db' --exclude '*.db' --exclude 'cache/' --exclude '*.md' ./apps/admin/ posterg:/var/www/html/admin/
rsync -vur --progress --exclude 'test.db' ./shared/ posterg:/var/www/html/shared/
@echo "Fixing shared library paths for production (admin)..."
ssh posterg "cd /var/www/html/formulaire && find . -maxdepth 1 -name '*.php' -type f -exec sed -i \"s|__DIR__ \. '/\.\./\.\./shared/|__DIR__ . '/../shared/|g\" {} \;"
@echo "✓ Admin paths fixed"
[group('deploy')]
deploy: deploy-public deploy-admin
@@ -33,20 +41,39 @@ deploy-database:
[group('deploy')]
test-deploy:
@echo "⚠️ Deploying test database (will overwrite remote test.db)"
@echo "Creating database directory if needed..."
ssh posterg "mkdir -p /var/www/html/database"
rsync -vur --progress ./database/test.db posterg:/var/www/html/database/test.db
@echo "✅ Test database deployed"
@echo "Setting correct permissions..."
ssh posterg "chgrp posterg /var/www/html/database /var/www/html/database/test.db && chmod 775 /var/www/html/database && chmod 660 /var/www/html/database/test.db"
@echo "✅ Test database deployed and configured"
[group('deploy')]
deploy-nginx:
@echo "📋 Deploying nginx configuration..."
@echo "🚀 Deploying production nginx configuration..."
rsync -vur --progress ./nginx/posterg.conf posterg:/tmp/posterg.conf
@echo "⚠️ Configuration uploaded to /tmp/posterg.conf"
rsync -vur --progress ./nginx/deploy-production.sh posterg:/tmp/deploy-production.sh
@echo "✅ Files uploaded to server"
@echo ""
@echo "Next steps on the server:"
@echo " 1. sudo cp /tmp/posterg.conf /etc/nginx/sites-available/posterg"
@echo " 2. sudo ln -s /etc/nginx/sites-available/posterg /etc/nginx/sites-enabled/"
@echo " 3. sudo nginx -t"
@echo " 4. sudo systemctl reload nginx"
@echo " ssh posterg"
@echo " sudo bash /tmp/deploy-production.sh"
@echo ""
@echo "This will:"
@echo " • Fix file permissions (posterg group)"
@echo " • Install nginx configuration"
@echo " • Set up admin password (if needed)"
@echo " • Test and reload nginx"
[group('deploy')]
deploy-admin-tools:
@echo "📤 Uploading admin user management tools..."
rsync -vur --progress ./nginx/manage-admin-users.sh posterg:/tmp/manage-admin-users.sh
@echo "✅ Script uploaded"
@echo ""
@echo "To manage admin users on the server:"
@echo " ssh posterg"
@echo " sudo bash /tmp/manage-admin-users.sh"
# ============================================================================
# Public Site Development
@@ -54,9 +81,9 @@ deploy-nginx:
[group('public-dev')]
serve-public:
@echo "Starting public site on http://localhost:8000"
@echo "Starting public site on http://localhost:8002"
@echo "Press Ctrl+C to stop"
@cd apps/public && php -S 127.0.0.1:8000
@cd apps/public && php -S 127.0.0.1:8002
[group('public-dev')]
test-public: