SJS-HUB
Claude
commited on
Commit
·
e60ed62
1
Parent(s):
76d7c67
Fix SSL/TLS certificate handling for MongoDB Atlas connection
Browse files- Add openssl package explicitly to Docker image
- Run update-ca-certificates after installation to ensure cert store is populated
- Add explicit SSL options to MongoClient (ssl=True, ssl_cert_reqs='CERT_REQUIRED')
- This fixes tlsv1 alert internal error on HF Spaces
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Dockerfile +2 -0
- database_mongo.py +4 -1
Dockerfile
CHANGED
|
@@ -10,6 +10,8 @@ RUN apt-get update && apt-get install -y \
|
|
| 10 |
curl \
|
| 11 |
ca-certificates \
|
| 12 |
libssl-dev \
|
|
|
|
|
|
|
| 13 |
&& rm -rf /var/lib/apt/lists/*
|
| 14 |
|
| 15 |
# Copy requirements first for better caching
|
|
|
|
| 10 |
curl \
|
| 11 |
ca-certificates \
|
| 12 |
libssl-dev \
|
| 13 |
+
openssl \
|
| 14 |
+
&& update-ca-certificates \
|
| 15 |
&& rm -rf /var/lib/apt/lists/*
|
| 16 |
|
| 17 |
# Copy requirements first for better caching
|
database_mongo.py
CHANGED
|
@@ -54,7 +54,10 @@ class MongoDBManager:
|
|
| 54 |
serverSelectionTimeoutMS=10000,
|
| 55 |
connectTimeoutMS=10000,
|
| 56 |
socketTimeoutMS=10000,
|
| 57 |
-
retryWrites=True
|
|
|
|
|
|
|
|
|
|
| 58 |
)
|
| 59 |
|
| 60 |
# Test connection with proper error messaging
|
|
|
|
| 54 |
serverSelectionTimeoutMS=10000,
|
| 55 |
connectTimeoutMS=10000,
|
| 56 |
socketTimeoutMS=10000,
|
| 57 |
+
retryWrites=True,
|
| 58 |
+
ssl=True,
|
| 59 |
+
ssl_cert_reqs='CERT_REQUIRED',
|
| 60 |
+
tlsAllowInvalidHostnames=False
|
| 61 |
)
|
| 62 |
|
| 63 |
# Test connection with proper error messaging
|