loreal-global-kickoff/server-setup.sh
DJP 62f46b15b3 Add server setup script to fix production issues
Created server-setup.sh to fix server environment:
- Creates logs/ directory with proper permissions
- Sets file permissions (755 for dirs, 644 for config, 600 for JWT)
- Tests ApplicationLogger functionality
- Provides instructions for installing PHP zip extension

Issues Found on Server:
1. logs/ directory missing (causing ApplicationLogger to fail)
2. PHP zip extension missing (needed for download-all-csv.php)
3. Vendor directory not writable (minor issue)

Run on server:
  chmod +x server-setup.sh
  ./server-setup.sh
  sudo apt-get install php-zip
  sudo systemctl restart apache2

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 11:22:59 -05:00

58 lines
1.6 KiB
Bash
Executable file

#!/bin/bash
# Server Setup Script for L'Oréal OMG Assistant Global
echo "========================================="
echo "L'Oréal OMG Assistant - Server Setup"
echo "========================================="
echo ""
# Create logs directory
echo "Creating logs directory..."
mkdir -p logs
chmod 755 logs
touch logs/.gitkeep
echo "✓ logs/ directory created"
# Set proper permissions
echo ""
echo "Setting file permissions..."
chmod -R 755 .
chmod 644 config.php
chmod 600 43984435_77m2ujl3_config.json 2>/dev/null || echo "⚠ Box JWT config not found (will be added separately)"
echo "✓ Permissions set"
# Check for zip extension
echo ""
echo "Checking PHP zip extension..."
if php -m | grep -q "zip"; then
echo "✓ ZIP extension is installed"
else
echo "❌ ZIP extension is MISSING"
echo ""
echo "To install ZIP extension on Ubuntu/Debian:"
echo " sudo apt-get update"
echo " sudo apt-get install php-zip"
echo " sudo systemctl restart apache2"
echo ""
fi
# Test application logger
echo ""
echo "Testing ApplicationLogger..."
if php -r "require 'vendor/autoload.php'; require 'ApplicationLogger.php'; new ApplicationLogger();" 2>/dev/null; then
echo "✓ ApplicationLogger works"
else
echo "❌ ApplicationLogger failed"
fi
echo ""
echo "========================================="
echo "Setup Complete!"
echo "========================================="
echo ""
echo "Next steps:"
echo "1. If ZIP extension is missing, install it (see instructions above)"
echo "2. Run: composer install (if not done already)"
echo "3. Verify server-check.php shows all green checkmarks"
echo "4. Test the application!"
echo ""