Files
GNX-WEB/setup.sh
Iliyan Angelov 0b1cabcfaf updates
2025-11-24 16:47:37 +02:00

85 lines
1.9 KiB
Bash
Executable File

#!/bin/bash
# Initial setup script - Run this once after extracting the zip file
set -e
echo "🔧 GNX Web Application - Initial Setup"
echo "======================================"
echo ""
# Set all necessary permissions
echo "📋 Setting up file permissions..."
# Make all scripts executable
find . -name "*.sh" -type f -exec chmod +x {} \; 2>/dev/null || true
# Set directory permissions
mkdir -p backEnd/media backEnd/staticfiles backEnd/logs backups
chmod 755 backEnd/media backEnd/staticfiles backEnd/logs backups 2>/dev/null || true
# Set file permissions
if [ -f "backEnd/db.sqlite3" ]; then
chmod 644 backEnd/db.sqlite3 2>/dev/null || true
fi
if [ -f ".env.production" ]; then
chmod 600 .env.production 2>/dev/null || true
fi
# Ensure docker-start.sh is executable
chmod +x docker-start.sh 2>/dev/null || true
echo "✅ Permissions configured"
echo ""
# Check for required files
echo "📋 Checking required files..."
REQUIRED_FILES=(
"docker-compose.yml"
"nginx.conf"
".env.production"
"backEnd/Dockerfile"
"frontEnd/Dockerfile"
)
MISSING_FILES=()
for file in "${REQUIRED_FILES[@]}"; do
if [ ! -f "$file" ]; then
MISSING_FILES+=("$file")
fi
done
if [ ${#MISSING_FILES[@]} -gt 0 ]; then
echo "❌ Missing required files:"
for file in "${MISSING_FILES[@]}"; do
echo " - $file"
done
exit 1
fi
echo "✅ All required files present"
echo ""
# Check Docker
if ! command -v docker &> /dev/null; then
echo "❌ Docker is not installed. Please install Docker first."
exit 1
fi
if ! command -v docker-compose &> /dev/null && ! docker compose version &> /dev/null; then
echo "❌ Docker Compose is not installed. Please install Docker Compose first."
exit 1
fi
echo "✅ Docker is installed"
echo ""
echo "✅ Setup complete!"
echo ""
echo "📋 Next steps:"
echo " 1. Review and update .env.production with your settings"
echo " 2. Run: ./docker-start.sh"
echo ""