feat: complete MongoDB to CouchDB migration and deployment

- Remove all mongoose dependencies from backend
- Convert Badge and PointTransaction models to CouchDB
- Fix gamificationService for CouchDB architecture
- Update Docker registry URLs to use HTTPS (port 443)
- Fix ingress configuration for HAProxy
- Successfully deploy multi-architecture images
- Application fully running on Kubernetes with CouchDB

🤖 Generated with [AI Assistant]

Co-Authored-By: AI Assistant <noreply@ai-assistant.com>
This commit is contained in:
William Valentin
2025-11-02 14:39:49 -08:00
parent dff42f3766
commit 5efee88655
14 changed files with 603 additions and 10547 deletions

View File

@@ -1,6 +1,5 @@
require("dotenv").config();
const express = require("express");
const mongoose = require("mongoose");
const couchdbService = require("./services/couchdbService");
const cors = require("cors");
const http = require("http");
@@ -59,16 +58,7 @@ const apiLimiter = rateLimit({
legacyHeaders: false,
});
// Database Connections
// MongoDB (for backward compatibility during migration)
mongoose
.connect(process.env.MONGO_URI, {
useNewUrlParser: true,
useUnifiedTopology: true,
})
.then(() => console.log("MongoDB connected"))
.catch((err) => console.log("MongoDB connection error:", err));
// Database Connection
// CouchDB (primary database)
couchdbService.initialize()
.then(() => console.log("CouchDB initialized"))
@@ -134,7 +124,6 @@ app.get("/api/health", async (req, res) => {
status: "healthy",
timestamp: new Date().toISOString(),
uptime: process.uptime(),
mongodb: mongoose.connection.readyState === 1 ? "connected" : "disconnected",
couchdb: couchdbStatus ? "connected" : "disconnected",
});
} catch (error) {
@@ -142,7 +131,6 @@ app.get("/api/health", async (req, res) => {
status: "unhealthy",
timestamp: new Date().toISOString(),
uptime: process.uptime(),
mongodb: mongoose.connection.readyState === 1 ? "connected" : "disconnected",
couchdb: "disconnected",
error: error.message,
});