Skip to content

feat: add docker support#3560

Closed
uprightbass360 wants to merge 1 commit intoazerothcore:masterfrom
uprightbass360:feat/docker-container-squashed
Closed

feat: add docker support#3560
uprightbass360 wants to merge 1 commit intoazerothcore:masterfrom
uprightbass360:feat/docker-container-squashed

Conversation

@uprightbass360
Copy link
Copy Markdown

Docker Containerization

This implementation enables Keira3 to be deployed as a containerized web application alongside existing AzerothCore instances for database administration, while maintaining 100% backward compatibility with existing Electron functionality. I utilized claude code to help speedrun the development, but as a devops dev and a 10 year c# engineer I was able to wire together something I hope you are happy with. Check out uprightbass360/keira3 on dockerhub for a look and https://github.com/uprightbass360/acore-compose for an integrated version. I am going to be using this at home. Thank you for your hard work!

Core Architecture

Hybrid Database Connection System

  • Electron Environment: Direct mysql2 connections (preserved, unchanged)
  • Docker/Web Environment: HTTP API proxy with connection pooling (new)
  • Automatic environment detection and transparent interface

Multi-Service Container Architecture

  • Angular Frontend (nginx, port 8080)
  • Database API Service (Node.js/Express, port 3001)
  • External MySQL Database connectivity
  • Reverse proxy integration with security and performance optimization

Complete Implementation (63 files, 12,042 additions)

Core Docker Infrastructure

  • Multi-stage Dockerfile with production optimizations
  • Docker Compose configurations for various deployment scenarios
  • Complete environment variable management and templates
  • Production-grade startup orchestration scripts

Database API Service (646 lines)

  • Express.js REST API with comprehensive MySQL2 connection pooling
  • HTTP endpoints: /api/database/connect, /api/database/query, /api/database/state
  • Error handling with proper HTTP status codes and categorization
  • Request validation, sanitization, and security measures
  • Graceful shutdown handling and resource cleanup

Enhanced MysqlService Integration

  • Environment-aware dual implementation (Electron + Docker)
  • Transparent API interface - same functionality across all environments
  • Connection pooling and performance optimizations
  • Error handling and retry mechanisms

Comprehensive Testing Suite (1,394 lines)

  • Unit Tests: Core API service functionality (361 lines)
  • Integration Tests: End-to-end API endpoints (588 lines)
  • Connection Pool Tests: Database connectivity and lifecycle (445 lines)
  • Docker-specific Jest configuration and test environment
  • Coverage reporting and CI/CD integration

Production Security & Performance

  • nginx reverse proxy with security headers and CORS configuration
  • Non-root container execution with dedicated user accounts
  • Resource limits, health monitoring, and graceful shutdown
  • Multi-platform builds (AMD64/ARM64) and registry support

CI/CD & Deployment Automation

  • Complete GitHub Actions workflow for Docker builds and deployment
  • Multi-registry support (GitHub Container Registry + DockerHub)
  • Automated testing, security scanning, and health validation
  • Manual workflow dispatch with environment selection
  • Container health check fixes (IPv6/IPv4 localhost resolution)

Key Features Delivered

AzerothCore Integration Ready

  • External MySQL database connectivity for existing AC instances
  • Web-based administration interface accessible from any device
  • Seamless integration with existing Docker infrastructure
  • Production-grade deployment with monitoring and scaling

Developer Experience

  • Zero breaking changes to existing Electron functionality
  • Comprehensive documentation and deployment guides
  • Enhanced testing framework with full coverage
  • Modern CI/CD pipelines with automated workflows

Enterprise Production Ready

  • Security hardened containers with best practices
  • Resource management and performance optimization
  • Health monitoring and observability integration
  • Horizontal scaling and load balancing support

Files Added/Modified

Docker Infrastructure

  • docker/Dockerfile, docker-compose.yml, .dockerignore
  • docker/api/database-api.js, database-api.types.js
  • docker/config/nginx.conf, docker-start.sh
  • docker/scripts/build.sh, deploy.sh
  • docker/.env.example, README.md, STRUCTURE.md

Enhanced Core Services

  • libs/shared/db-layer/src/mysql.service.ts (enhanced)
  • libs/shared/config/src/app.config.ts (extended)
  • apps/keira/src/environments/environment.docker.ts (new)

Testing & Quality Assurance

  • docker/tests/ (complete test suite with Jest configuration)
  • 3 comprehensive test files with full coverage
  • CI/CD integration and coverage reporting

CI/CD & Automation

  • .github/workflows/docker-build-deploy-dockerhub.yml
  • Makefile for build automation
  • Enhanced package.json with Docker dependencies

Documentation

  • Complete documentation suite in docs/
  • Deployment guides, architecture documentation
  • Troubleshooting and configuration references

Migration & Compatibility

  • 100% Backward Compatible: All existing Electron functionality preserved
  • Zero Breaking Changes: Existing configs and workflows continue unchanged
  • Additive Architecture: New Docker capabilities without modification
  • Environment Detection: Automatic switching between Electron and Docker modes

Deployment Scenarios

  1. Standalone Container: Simple docker run with environment variables
  2. Docker Compose: Full orchestration with networking and volumes
  3. AzerothCore Integration: External database connectivity for AC administration
  4. Production Deployment: Multi-container scaling with load balancing

This implementation transforms Keira3 from an Electron-only desktop application
into a flexible, deployable web application while preserving all existing
functionality and adding powerful new deployment capabilities for AzerothCore
database administration.

Ready for production deployment!

@uprightbass360
Copy link
Copy Markdown
Author

Merging requires existing changes for workflow. Closing to PR from fork master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant