Spaces:
Sleeping
Sleeping
root commited on
Commit ·
991924e
1
Parent(s): 544859c
Fix: Upgrade OS to Bullseye to fix DNS issues
Browse files- Dockerfile +12 -9
- adapters/sensory-bridge/src/main.py +10 -33
Dockerfile
CHANGED
|
@@ -1,26 +1,29 @@
|
|
| 1 |
-
#
|
| 2 |
-
|
|
|
|
| 3 |
|
| 4 |
-
# 2. Set folder kerja di dalam server
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
-
#
|
| 8 |
RUN apt-get update && apt-get install -y \
|
| 9 |
build-essential \
|
| 10 |
curl \
|
| 11 |
git \
|
|
|
|
|
|
|
|
|
|
| 12 |
&& rm -rf /var/lib/apt/lists/*
|
| 13 |
|
| 14 |
-
#
|
|
|
|
|
|
|
| 15 |
COPY requirements.txt .
|
| 16 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 17 |
|
| 18 |
-
# 5. Salin seluruh tubuh Xarvionex ke dalam server
|
| 19 |
COPY . .
|
| 20 |
|
| 21 |
-
#
|
| 22 |
EXPOSE 7860
|
| 23 |
|
| 24 |
-
#
|
| 25 |
-
# Nexus v1.2 Anda sudah pintar, dia akan otomatis pakai mode Cloud
|
| 26 |
CMD ["python", "nexus.py"]
|
|
|
|
| 1 |
+
# GANTI DARI 'slim' KE 'bullseye' (Full Version)
|
| 2 |
+
# Ini memperbaiki masalah DNS/Glibc yang hilang
|
| 3 |
+
FROM python:3.10-bullseye
|
| 4 |
|
|
|
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
+
# Install utility jaringan dasar untuk stabilitas
|
| 8 |
RUN apt-get update && apt-get install -y \
|
| 9 |
build-essential \
|
| 10 |
curl \
|
| 11 |
git \
|
| 12 |
+
iputils-ping \
|
| 13 |
+
dnsutils \
|
| 14 |
+
ca-certificates \
|
| 15 |
&& rm -rf /var/lib/apt/lists/*
|
| 16 |
|
| 17 |
+
# Update Certificate Authority (Agar SSL tidak error)
|
| 18 |
+
RUN update-ca-certificates
|
| 19 |
+
|
| 20 |
COPY requirements.txt .
|
| 21 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 22 |
|
|
|
|
| 23 |
COPY . .
|
| 24 |
|
| 25 |
+
# Port Hugging Face
|
| 26 |
EXPOSE 7860
|
| 27 |
|
| 28 |
+
# Jalankan Nexus
|
|
|
|
| 29 |
CMD ["python", "nexus.py"]
|
adapters/sensory-bridge/src/main.py
CHANGED
|
@@ -1,35 +1,11 @@
|
|
| 1 |
import os
|
| 2 |
import sys
|
| 3 |
-
import socket
|
| 4 |
import logging
|
| 5 |
from telegram import Update
|
| 6 |
from telegram.ext import Application, CommandHandler, MessageHandler, filters, ContextTypes
|
| 7 |
from telegram.request import HTTPXRequest
|
| 8 |
|
| 9 |
-
#
|
| 10 |
-
# ☢️ NUCLEAR OPTION: DNS BYPASS SYSTEM
|
| 11 |
-
# ==========================================
|
| 12 |
-
# Kita cegat fungsi DNS Python.
|
| 13 |
-
# Jika dia bingung cari alamat Telegram, kita kasih IP-nya langsung.
|
| 14 |
-
# IP Telegram API (London): 149.154.167.220
|
| 15 |
-
# ==========================================
|
| 16 |
-
|
| 17 |
-
ORIGINAL_GETADDRINFO = socket.getaddrinfo
|
| 18 |
-
|
| 19 |
-
def patched_getaddrinfo(host, port, family=0, type=0, proto=0, flags=0):
|
| 20 |
-
# Jika yang dicari adalah api.telegram.org
|
| 21 |
-
if host == 'api.telegram.org':
|
| 22 |
-
# Kembalikan alamat IP Hardcoded (IPv4)
|
| 23 |
-
# Format: (family, type, proto, canonname, sockaddr)
|
| 24 |
-
return [(socket.AF_INET, socket.SOCK_STREAM, 6, '', ('149.154.167.220', port))]
|
| 25 |
-
|
| 26 |
-
# Untuk website lain (seperti Redis), gunakan cara normal
|
| 27 |
-
return ORIGINAL_GETADDRINFO(host, port, family, type, proto, flags)
|
| 28 |
-
|
| 29 |
-
# Terapkan Patch
|
| 30 |
-
socket.getaddrinfo = patched_getaddrinfo
|
| 31 |
-
# ==========================================
|
| 32 |
-
|
| 33 |
logging.basicConfig(
|
| 34 |
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
|
| 35 |
level=logging.INFO
|
|
@@ -38,11 +14,11 @@ logger = logging.getLogger(__name__)
|
|
| 38 |
|
| 39 |
async def start_command(update: Update, context: ContextTypes.DEFAULT_TYPE):
|
| 40 |
user = update.effective_user
|
| 41 |
-
await update.message.reply_text(f"
|
| 42 |
|
| 43 |
async def echo_message(update: Update, context: ContextTypes.DEFAULT_TYPE):
|
| 44 |
incoming_text = update.message.text
|
| 45 |
-
logger.info(f"Pesan
|
| 46 |
await update.message.reply_text(f"Copy: {incoming_text}")
|
| 47 |
|
| 48 |
def main():
|
|
@@ -51,13 +27,14 @@ def main():
|
|
| 51 |
logger.error("CRITICAL: Token Telegram tidak ditemukan!")
|
| 52 |
sys.exit(1)
|
| 53 |
|
| 54 |
-
print(
|
| 55 |
|
| 56 |
-
#
|
| 57 |
t_request = HTTPXRequest(
|
| 58 |
-
connect_timeout=
|
| 59 |
-
read_timeout=
|
| 60 |
-
http_version="1.1"
|
|
|
|
| 61 |
)
|
| 62 |
|
| 63 |
try:
|
|
@@ -68,7 +45,7 @@ def main():
|
|
| 68 |
print("--- POLLING STARTED ---")
|
| 69 |
application.run_polling(drop_pending_updates=True)
|
| 70 |
except Exception as e:
|
| 71 |
-
logger.error(f"FATAL
|
| 72 |
sys.exit(1)
|
| 73 |
|
| 74 |
if __name__ == "__main__":
|
|
|
|
| 1 |
import os
|
| 2 |
import sys
|
|
|
|
| 3 |
import logging
|
| 4 |
from telegram import Update
|
| 5 |
from telegram.ext import Application, CommandHandler, MessageHandler, filters, ContextTypes
|
| 6 |
from telegram.request import HTTPXRequest
|
| 7 |
|
| 8 |
+
# Konfigurasi Logging
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
logging.basicConfig(
|
| 10 |
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
|
| 11 |
level=logging.INFO
|
|
|
|
| 14 |
|
| 15 |
async def start_command(update: Update, context: ContextTypes.DEFAULT_TYPE):
|
| 16 |
user = update.effective_user
|
| 17 |
+
await update.message.reply_text(f"✅ Xarvionex Stabil (OS Bullseye). Siap perintah, Komandan {user.first_name}!")
|
| 18 |
|
| 19 |
async def echo_message(update: Update, context: ContextTypes.DEFAULT_TYPE):
|
| 20 |
incoming_text = update.message.text
|
| 21 |
+
logger.info(f"Pesan: {incoming_text}")
|
| 22 |
await update.message.reply_text(f"Copy: {incoming_text}")
|
| 23 |
|
| 24 |
def main():
|
|
|
|
| 27 |
logger.error("CRITICAL: Token Telegram tidak ditemukan!")
|
| 28 |
sys.exit(1)
|
| 29 |
|
| 30 |
+
print("--- SENSORY BRIDGE STARTING (FULL OS MODE) ---")
|
| 31 |
|
| 32 |
+
# Settingan Koneksi "Badak"
|
| 33 |
t_request = HTTPXRequest(
|
| 34 |
+
connect_timeout=60.0, # Timeout 1 menit
|
| 35 |
+
read_timeout=60.0,
|
| 36 |
+
http_version="1.1", # Wajib HTTP/1.1 untuk stabilitas
|
| 37 |
+
keep_alive_timeout=20 # Jaga koneksi tetap hidup
|
| 38 |
)
|
| 39 |
|
| 40 |
try:
|
|
|
|
| 45 |
print("--- POLLING STARTED ---")
|
| 46 |
application.run_polling(drop_pending_updates=True)
|
| 47 |
except Exception as e:
|
| 48 |
+
logger.error(f"FATAL ERROR: {e}")
|
| 49 |
sys.exit(1)
|
| 50 |
|
| 51 |
if __name__ == "__main__":
|