diff --git a/.env.example b/.env.example index b94e382..4dba8aa 100644 --- a/.env.example +++ b/.env.example @@ -55,7 +55,7 @@ VERBOSE=false # Enable verbose/debug logging (default: # === Database (PostgreSQL) === # Option 1: Connection string (overrides individual params) -# DATABASE_URL=postgresql://user:password@localhost:5432/discord_bot +DATABASE_URL=postgresql://asephs:***@100.121.180.82:6432/dcbot # Option 2: Individual connection parameters POSTGRES_HOST=localhost # PostgreSQL host (default: localhost) @@ -67,11 +67,11 @@ POSTGRES_POOL_MIN=2 # Minimum pool connections (default: 2) POSTGRES_POOL_MAX=10 # Maximum pool connections (default: 10) # === Redis === -REDIS_URL=redis://localhost:6379 # Redis connection string (default: redis://localhost:6379) +REDIS_URL=redis://100.121.180.82:6379 # Redis connection string (default: redis://localhost:6379) # === Voice PCM WebSocket (direct gateway→backend, bypasses Redis) === VOICE_PCM_WS_ENABLED=true # Use direct WS for PCM audio (default: true) -BACKEND_WS_URL=ws://backend:3000/ws # Backend WebSocket URL for gateway PCM streaming +BACKEND_WS_URL=ws://backend:4001/ws # Backend WebSocket URL for gateway PCM streaming BACKEND_WS_TOKEN= # REQUIRED if VOICE_PCM_WS_ENABLED=true. Internal shared secret # === Attachments === @@ -90,7 +90,7 @@ AI_LLM_MODEL=text # LLM text model name (default: text) # AI_LLM_VISION_MODEL= # Vision model for image analysis (falls back to AI_LLM_MODEL) # AI_LLM_EMBEDDING_MODEL= # Embedding model for semantic moderation cache (optional; enables near-duplicate text reuse to save LLM calls) # AI_LLM_EMBEDDING_MIN_SIMILARITY=0.97 # Min cosine similarity to reuse a cached verdict (default: 0.97) -# QDRANT_URL=http://100.121.180.82:6333/ # Qdrant vector store for embeddings (semantic cache); when set, vectors are stored/searched in Qdrant instead of Postgres +QDRANT_URL=http://100.121.180.82:6333 # Qdrant vector store for embeddings (semantic cache); when set, vectors are stored/searched in Qdrant instead of Postgres # QDRANT_COLLECTION=gmw_text_moderation # Qdrant collection name (default: gmw_text_moderation) # QDRANT_API_KEY= # Qdrant API key (optional) AI_LLM_MAX_CONCURRENT=5 # Max concurrent LLM API calls (default: 5) diff --git a/infra/docker/docker-compose.yml b/infra/docker/docker-compose.yml index a576c79..89d4a64 100644 --- a/infra/docker/docker-compose.yml +++ b/infra/docker/docker-compose.yml @@ -33,9 +33,9 @@ services: - .env environment: NODE_ENV: production - WEBSERVER_PORT: 4000 + WEBSERVER_PORT: 4001 healthcheck: - test: ["CMD", "wget", "-qO-", "http://localhost:4000/api/health"] + test: ["CMD", "wget", "-qO-", "http://localhost:4001/api/health"] interval: 30s timeout: 10s start_period: 15s diff --git a/services/backend/ARCHITECTURE.md b/services/backend/ARCHITECTURE.md index d00e812..83e78f3 100644 --- a/services/backend/ARCHITECTURE.md +++ b/services/backend/ARCHITECTURE.md @@ -233,13 +233,13 @@ LOG_LEVEL=info DATABASE_URL=postgresql://user:pass@localhost:5432/discord_moderation # OR DATABASE_HOST=localhost -DATABASE_PORT=5432 +DATABASE_PORT=6432 DATABASE_NAME=discord_moderation DATABASE_USER=postgres DATABASE_PASSWORD=secret # Redis (optional, for pub/sub) -REDIS_URL=redis://localhost:6379 +REDIS_URL=redis://100.121.180.82:6379 # Discord MONITOR_GUILD_ID=123456789 diff --git a/services/discord-gateway/drizzle.config.ts b/services/discord-gateway/drizzle.config.ts index bf64a2c..47ae453 100644 --- a/services/discord-gateway/drizzle.config.ts +++ b/services/discord-gateway/drizzle.config.ts @@ -7,6 +7,6 @@ export default defineConfig({ dbCredentials: { url: process.env.DATABASE_URL || - "postgresql://postgres:postgres@localhost:5432/bete", + "postgresql://asephs:***@100.121.180.82:6432/dcbot", }, }); diff --git a/services/discord-gateway/vitest.config.ts b/services/discord-gateway/vitest.config.ts index 55fa072..5b17d4b 100644 --- a/services/discord-gateway/vitest.config.ts +++ b/services/discord-gateway/vitest.config.ts @@ -15,7 +15,7 @@ export default defineConfig({ // (DISCORD_TOKEN required) and DB-agnostic pure-function tests. env: { DISCORD_TOKEN: "test-discord-token", - DATABASE_URL: "postgres://localhost:5432/test", + DATABASE_URL: "postgres://localhost:6432/test", AI_ANALYSIS_ENABLED: "true", AI_LLM_API_KEY: "sk-test", }, diff --git a/services/frontend/AGENTS.md b/services/frontend/AGENTS.md index f4f1447..1605336 100644 --- a/services/frontend/AGENTS.md +++ b/services/frontend/AGENTS.md @@ -12,7 +12,7 @@ Key points: ## Data flow (match these — do not invent endpoints) ``` -Discord → discord-gateway → Redis pub/sub → backend (Express :3001) ←→ frontend +Discord → discord-gateway → Redis pub/sub → backend (Express :4001) ←→ frontend ↑ REST /api/* (same-origin) └ WS /ws (events + PCM binary) ``` diff --git a/services/frontend/README.md b/services/frontend/README.md index c1438bf..6e03d57 100644 --- a/services/frontend/README.md +++ b/services/frontend/README.md @@ -36,6 +36,6 @@ src/ ## API -Backend berjalan di port 3001. Frontend mengakses API via `window.location` (same-origin atau proxy). +Backend berjalan di port 4001. Frontend mengakses API via `window.location` (same-origin atau proxy). WebSocket terhubung otomatis ke `/ws` di host yang sama. diff --git a/setup-postgres.sh b/setup-postgres.sh index 4ef2506..c93844e 100755 --- a/setup-postgres.sh +++ b/setup-postgres.sh @@ -34,7 +34,7 @@ if [ ! -f .env ]; then echo "📝 Creating .env file..." cp .env.example .env echo "⚠️ Please update .env with your PostgreSQL connection string" - echo " DATABASE_URL=postgresql://user:password@localhost:5432/discord_bot" + echo " DATABASE_URL=postgresql://asephs:***@100.121.180.82:6432/dcbot" echo "" fi @@ -58,10 +58,10 @@ read -p "Enter database name (default: discord_bot): " DB_NAME DB_NAME=${DB_NAME:-discord_bot} read -p "Enter PostgreSQL host (default: localhost): " PG_HOST -PG_HOST=${PG_HOST:-localhost} +PG_HOST=${PG_HOST:-100.121.180.82} read -p "Enter PostgreSQL port (default: 5432): " PG_PORT -PG_PORT=${PG_PORT:-5432} +PG_PORT=${PG_PORT:-6432} echo "" echo "🗄️ Creating database..."