Major architectural improvements: - Auto-generate SSL certificates on first startup with OpenSSL - Dual HTTP (8081) + HTTPS (8443) backend API servers - Frontend auto-detects protocol and uses appropriate API endpoint - Fix database ORM initialization race condition with getDb() pattern - WebSocket authentication with JWT verification during handshake - Zero-config .env file generation for production deployment - Docker and nginx configurations for container deployment Technical fixes: - Eliminate module initialization race conditions in database access - Replace direct db imports with safer getDb() function calls - Automatic HTTPS frontend development server (npm run dev:https) - SSL certificate generation with termix.crt/termix.key - Cross-platform environment variable support with cross-env This enables seamless HTTP→HTTPS upgrade with zero manual configuration. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
44 lines
957 B
Docker
44 lines
957 B
Docker
# Termix Docker Image with Auto-SSL Configuration
|
|
FROM node:18-slim
|
|
|
|
# Install OpenSSL for SSL certificate generation
|
|
RUN apt-get update && apt-get install -y \
|
|
openssl \
|
|
curl \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Copy package files
|
|
COPY package*.json ./
|
|
|
|
# Install dependencies
|
|
RUN npm ci --only=production
|
|
|
|
# Copy application source
|
|
COPY . .
|
|
|
|
# Build the application
|
|
RUN npm run build:backend
|
|
|
|
# Create directories for SSL certificates and data
|
|
RUN mkdir -p /app/ssl /app/data
|
|
|
|
# Set proper permissions
|
|
RUN chown -R node:node /app
|
|
|
|
# Switch to non-root user
|
|
USER node
|
|
|
|
# Expose ports
|
|
EXPOSE 8080 8443
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
|
|
CMD curl -f -k https://localhost:8443/health 2>/dev/null || \
|
|
curl -f http://localhost:8080/health 2>/dev/null || \
|
|
exit 1
|
|
|
|
# Default command - SSL is auto-configured during startup
|
|
CMD ["npm", "start"] |