Update dashboard and Docker compose
Some checks failed
CI/CD Pipeline / Security Scanning (push) Has been cancelled
CI/CD Pipeline / Tests (3.11) (push) Has been cancelled
CI/CD Pipeline / Tests (3.12) (push) Has been cancelled
CI/CD Pipeline / Build Docker Image (push) Has been cancelled
CI/CD Pipeline / Code Quality Checks (push) Has been cancelled

This commit is contained in:
2026-01-24 19:14:00 +01:00
parent a5811113f0
commit 574a07d127
17 changed files with 838 additions and 252 deletions

View File

@@ -68,38 +68,38 @@ EOF
# Set up development environment
setup_dev() {
print_status "Setting up development environment..."
# Check Python version
if ! command_exists python3; then
print_error "Python 3 is required but not installed"
exit 1
fi
python_version=$(python3 -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')")
if [[ $(echo "$python_version < 3.11" | bc -l) -eq 1 ]]; then
print_warning "Python 3.11+ is recommended, you have $python_version"
fi
# Install dependencies
print_status "Installing dependencies..."
pip install -e ".[dev,monitoring]"
# Set up pre-commit hooks
if command_exists pre-commit; then
print_status "Installing pre-commit hooks..."
pre-commit install
fi
# Copy environment file if it doesn't exist
if [[ ! -f .env ]]; then
print_status "Creating .env file from template..."
cp .env.example .env
print_warning "Please edit .env file with your configuration"
fi
# Create data directories
mkdir -p data logs
print_success "Development environment setup complete!"
print_status "Next steps:"
echo " 1. Edit .env file with your Discord bot token and other settings"
@@ -110,86 +110,89 @@ setup_dev() {
# Run tests
run_tests() {
print_status "Running tests with coverage..."
export GUARDDEN_DISCORD_TOKEN="test_token_12345678901234567890123456789012345"
export GUARDDEN_DATABASE_URL="sqlite+aiosqlite:///:memory:"
export GUARDDEN_AI_PROVIDER="none"
export GUARDDEN_LOG_LEVEL="DEBUG"
pytest --cov=src/guardden --cov-report=term-missing --cov-report=html
print_success "Tests completed! Coverage report saved to htmlcov/"
}
# Run linting
run_lint() {
print_status "Running code quality checks..."
echo "🔍 Running ruff (linting)..."
ruff check src tests
echo "🎨 Checking code formatting..."
ruff format src tests --check
echo "🔤 Running mypy (type checking)..."
mypy src
print_success "Code quality checks completed!"
}
# Format code
format_code() {
print_status "Formatting code..."
echo "🎨 Formatting with ruff..."
ruff format src tests
echo "🔧 Fixing auto-fixable issues..."
ruff check src tests --fix
print_success "Code formatting completed!"
}
# Run security scans
run_security() {
print_status "Running security scans..."
echo "🔒 Checking dependencies for vulnerabilities..."
safety check --json --output safety-report.json || true
echo "🛡️ Running security linting..."
bandit -r src/ -f json -o bandit-report.json || true
print_success "Security scans completed! Reports saved as *-report.json"
}
# Build Docker images
build_docker() {
print_status "Building Docker images..."
echo "🐳 Building base image..."
docker build -t guardden:latest .
echo "Building dashboard image..."
docker build -f dashboard/Dockerfile -t guardden-dashboard:latest .
echo "🧠 Building image with AI dependencies..."
docker build --build-arg INSTALL_AI=true -t guardden:ai .
echo "🔧 Building development image..."
docker build --target development -t guardden:dev .
print_success "Docker images built successfully!"
}
# Start development environment
start_dev() {
print_status "Starting development environment..."
if [[ ! -f .env ]]; then
print_error ".env file not found. Run '$0 setup' first."
exit 1
fi
docker-compose -f docker-compose.yml -f docker-compose.dev.yml up -d
print_success "Development environment started!"
echo "📊 Services available:"
echo " - Bot: Running in development mode"
@@ -220,20 +223,20 @@ show_logs() {
# Clean up
clean_up() {
print_status "Cleaning up development artifacts..."
# Python cache
find . -type f -name "*.pyc" -delete
find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true
# Test artifacts
rm -rf .coverage htmlcov/ .pytest_cache/
# Build artifacts
rm -rf build/ dist/ *.egg-info/
# Security reports
rm -f *-report.json
print_success "Cleanup completed!"
}
@@ -335,4 +338,4 @@ case "${1:-help}" in
"help"|*)
show_help
;;
esac
esac