chore: finalize PostgreSQL migration and environment configuration#299
Open
yousefshaheen113-blip wants to merge 10 commits into
Open
chore: finalize PostgreSQL migration and environment configuration#299yousefshaheen113-blip wants to merge 10 commits into
yousefshaheen113-blip wants to merge 10 commits into
Conversation
…es Update, and Railway Optimization This commit includes: - Complete migration from MongoDB (motor) to PostgreSQL (asyncpg) - New database connection layer with connection pooling - PostgreSQL schema definitions for all collections - Updated environment variable handling (DATABASE_URL, TZ, LOG_LEVEL, MAX_CONCURRENT_TASKS) - Fixed deprecated packages (youtube_dl→yt-dlp, googletrans→google-trans-new) - Added missing pyrogram dependency - Railway deployment optimization (Dockerfile, pyproject.toml updates) - Fixed import errors and configuration issues - Session persistence strategy for Railway compatibility Files Added: - wbb/core/database.py (PostgreSQL connection and schema management) - wbb/utils/db_migrate.py (Database initialization and migration utilities) - .env.example (Complete environment variables template) - schema.sql (PostgreSQL schema) Files Modified: - wbb/__init__.py (Updated config loading, removed MongoDB, added TZ/LOG_LEVEL/MAX_CONCURRENT_TASKS) - wbb/utils/dbfunctions.py (PostgreSQL-based implementations) - wbb/utils/dbfeds.py (PostgreSQL-based federation system) - wbb/modules/mongo_backup.py (Removed - no longer needed) - sample_config.env (Updated with DATABASE_URL) - sample_config.py (Updated config loading) - pyproject.toml (Updated dependencies, added asyncpg, removed motor) - Dockerfile (Optimized for PostgreSQL) - docker-compose.yml (Added PostgreSQL service)
…t case, add Railway/Nixpacks config - Replace ARQ_API_KEY → ANTHROPIC_API_KEY in all files - Fix Python_ARQ import (case-sensitive on Linux) - Remove motor/MongoDB references from inlinefuncs.py and mongo_backup.py - Add railway.toml and nixpacks.toml for Railway deployment - Add requirements.txt for pip-based installs - Migrate mongo_backup.py to PostgreSQL pg_dump
- Fix googletrans import: replace from googletrans import Translator with from google_trans_new import google_translator (correct module name) - Add cryptography>=42.0.0 to requirements.txt (was missing) - Rebuild requirements.txt with >= version pins (more compatible than ~=) - Fix nixpacks.toml: explicit pip install into system Python - Fix railway.toml: remove invalid [[services]] stanza
- Rewrite sample_config.py: validate all required env vars before any int() conversion or Pyrogram init can throw a cryptic traceback - Collect every missing/invalid variable in one pass, print a labeled error table with Railway instructions, then sys.exit(1) cleanly - Detect SESSION_STRING vs PHONE_NUMBER requirement explicitly - Validate integer fields (API_ID, LOG_GROUP_ID, etc.) with human readable error if non-numeric value is supplied - Remove duplicate DATABASE_URL check from wbb/__init__.py (now caught earlier in sample_config.py with better message)
Root cause: nixpacks.toml was overriding uv auto-detection with pip install -r requirements.txt. Packages went into a venv that system 'python -m wbb' could not see -> ModuleNotFoundError: aiohttp. Changes: - nixpacks.toml: add uv to nixPkgs, run 'uv sync --no-dev --frozen' - railway.toml: start command -> 'uv run python -m wbb' - pyproject.toml: add cryptography>=42.0.0 as explicit dep - uv.lock: regenerated (adds cryptography v49.0.0, cffi, pycparser)
Replit-Commit-Author: Agent Replit-Commit-Session-Id: 0d8310bf-fd05-4cb9-8e27-ceef1e8ba8bf Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 0863ea63-f4c1-474b-9d8c-6ce597d73176 Replit-Helium-Checkpoint-Created: true
Refactors database interactions in `wbb/core/database.py` and `wbb/utils/dbfunctions.py` to address schema mismatches and improve compatibility. Updates `requirements.txt` and `replit.nix` for new dependencies and environment configurations. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 0d8310bf-fd05-4cb9-8e27-ceef1e8ba8bf Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: fb51d7fb-3444-4ba3-9d4b-d281739ada1f Replit-Helium-Checkpoint-Created: true
Translate UI elements, command help strings, and documentation into Arabic across numerous files, updating repository URLs and support links. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 0d8310bf-fd05-4cb9-8e27-ceef1e8ba8bf Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 4bfc641f-9a38-4069-8a17-703f779d33a7 Replit-Helium-Checkpoint-Created: true
Replit-Commit-Author: Agent Replit-Commit-Session-Id: a9bd5a05-0573-4d97-b99c-ba6254d55433 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 1c309820-94d3-42e0-b9bc-81d3a33db951 Replit-Helium-Checkpoint-Created: true
Fixes a ValueError in text splitting for welcome messages and a TypeError by adding a None check before unpacking results from keyb extraction. Replit-Commit-Author: Agent Replit-Commit-Session-Id: a9bd5a05-0573-4d97-b99c-ba6254d55433 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: fdd778ff-2ab8-4139-9eef-ccdeea70d597 Replit-Helium-Checkpoint-Created: true
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This pull request finalizes the transition from MongoDB to PostgreSQL and stabilizes the project environment for Railway deployment.
Key Changes
uvenvironment configuration.Testing