chore: reorganize project structure and prepare for deployment
- Organize files into logical directories (docs/, scripts/, tests/) - Add comprehensive documentation (README, CONTRIBUTING, CHANGELOG) - Create deployment automation scripts - Add Docker production configuration - Update .gitignore and add .dockerignore - Remove temporary and test files from root - Improve settings.py with DEBUG from env variable Added: - README.md with project overview - CONTRIBUTING.md for contributors - CHANGELOG.md for version tracking - PROJECT_STATUS.md with current state - docker-compose.prod.yml for production - nginx.conf for production web server - scripts/deploy.sh for automated deployment - scripts/check-config.sh for configuration validation - scripts/setup-ssl.sh for SSL certificate setup - docs/DEPLOYMENT.md with detailed deployment guide - docs/ENV_VARIABLES.md with all environment variables Moved: - Documentation to docs/ - Scripts to scripts/ - Test files to tests/ Removed: - .history/ directory - Test response JSON files from root - settings_production.py (merged into settings.py) This commit prepares the project for: - Production deployment - Team collaboration - Docker containerization - Proper documentation
This commit is contained in:
102
scripts/check-config.sh
Executable file
102
scripts/check-config.sh
Executable file
@@ -0,0 +1,102 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Configuration check script for SmartSolTech
|
||||
|
||||
echo "🔍 Checking SmartSolTech configuration..."
|
||||
echo ""
|
||||
|
||||
# Color codes
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# Check if .env file exists
|
||||
if [ -f .env ]; then
|
||||
echo -e "${GREEN}✓${NC} .env file found"
|
||||
|
||||
# Check required variables
|
||||
required_vars=("SECRET_KEY" "POSTGRES_DB" "POSTGRES_USER" "POSTGRES_PASSWORD" "POSTGRES_HOST" "PGADMIN_DEFAULT_EMAIL" "PGADMIN_DEFAULT_PASSWORD")
|
||||
|
||||
for var in "${required_vars[@]}"; do
|
||||
if grep -q "^${var}=" .env; then
|
||||
value=$(grep "^${var}=" .env | cut -d '=' -f2)
|
||||
if [ -n "$value" ] && [ "$value" != "your-" ] && [[ ! "$value" =~ ^your- ]]; then
|
||||
echo -e "${GREEN}✓${NC} $var is set"
|
||||
else
|
||||
echo -e "${YELLOW}⚠${NC} $var needs to be configured"
|
||||
fi
|
||||
else
|
||||
echo -e "${RED}✗${NC} $var is missing"
|
||||
fi
|
||||
done
|
||||
else
|
||||
echo -e "${RED}✗${NC} .env file not found"
|
||||
echo -e "${YELLOW}→${NC} Copy .env.example to .env and configure it"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
|
||||
# Check Docker
|
||||
if command -v docker &> /dev/null; then
|
||||
echo -e "${GREEN}✓${NC} Docker is installed"
|
||||
docker --version
|
||||
else
|
||||
echo -e "${RED}✗${NC} Docker is not installed"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
|
||||
# Check Docker Compose
|
||||
if command -v docker-compose &> /dev/null; then
|
||||
echo -e "${GREEN}✓${NC} Docker Compose is installed"
|
||||
docker-compose --version
|
||||
else
|
||||
echo -e "${RED}✗${NC} Docker Compose is not installed"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
|
||||
# Check required files
|
||||
required_files=("Dockerfile" "docker-compose.yml" "requirements.txt" "wait-for-it.sh")
|
||||
|
||||
for file in "${required_files[@]}"; do
|
||||
if [ -f "$file" ]; then
|
||||
echo -e "${GREEN}✓${NC} $file exists"
|
||||
else
|
||||
echo -e "${RED}✗${NC} $file is missing"
|
||||
fi
|
||||
done
|
||||
|
||||
echo ""
|
||||
|
||||
# Check wait-for-it.sh is executable
|
||||
if [ -f "wait-for-it.sh" ] && [ -x "wait-for-it.sh" ]; then
|
||||
echo -e "${GREEN}✓${NC} wait-for-it.sh is executable"
|
||||
else
|
||||
echo -e "${YELLOW}⚠${NC} wait-for-it.sh is not executable (will be set in Docker)"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
|
||||
# Check Python version in requirements
|
||||
if [ -f "requirements.txt" ]; then
|
||||
echo -e "${GREEN}✓${NC} Python dependencies:"
|
||||
grep -E "^Django==|^psycopg2|^python-telegram-bot==" requirements.txt
|
||||
fi
|
||||
|
||||
echo ""
|
||||
|
||||
# Summary
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
echo "📋 Next steps:"
|
||||
echo ""
|
||||
if [ ! -f .env ]; then
|
||||
echo "1. Create .env file: cp .env.example .env"
|
||||
echo "2. Edit .env with your configuration: nano .env"
|
||||
fi
|
||||
echo "3. Generate SECRET_KEY:"
|
||||
echo ' python -c "from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())"'
|
||||
echo "4. Update ALLOWED_HOSTS and CSRF_TRUSTED_ORIGINS in .env"
|
||||
echo "5. Run deployment: ./deploy.sh"
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
Reference in New Issue
Block a user