Features: - SQLite database with better-sqlite3 for guild configurations - Auto-registration when bot joins new guilds with welcome messages - Soft delete system preserves settings when bot is removed - Dynamic configuration via /config slash command with subcommands - Automatic migration from config.json to database on first run - Support for scheduled events with timezone preservation Technical Implementation: - Node.js 20 for better SQLite compatibility in Docker - Full Debian base image with npm for reliable native module compilation - Database persistence via Docker volume (./data) - Hybrid configuration system (database primary, file fallback) - JSON storage for complex schedule objects with timezone support Database Schema: - guilds table with soft delete (is_active flag) - scheduled_events table with JSON schedule storage - bot_config table for global settings - Auto-initialization and seeding from existing config Admin Features: - /config show - View current server settings - /config subcommands - Update prefix, volume, features, etc. - Administrator permissions required for configuration changes - Graceful handling of missing or malformed data 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
65 lines
1.5 KiB
YAML
65 lines
1.5 KiB
YAML
version: '3.8'
|
|
|
|
services:
|
|
discord-bot:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
container_name: discord-bot
|
|
restart: unless-stopped
|
|
volumes:
|
|
# Configuration files (read-only)
|
|
- ./config.json:/app/config.json:ro
|
|
- ./conf:/app/conf:ro
|
|
|
|
# Sound effects directory (read-only)
|
|
- ./sfx:/app/sfx:ro
|
|
|
|
# Database persistence
|
|
- ./data:/app/data
|
|
|
|
# Optional: Mount logs directory if you want persistent logs
|
|
# - ./logs:/app/logs
|
|
|
|
# Optional: Environment variables
|
|
environment:
|
|
- NODE_ENV=production
|
|
# - DEBUG=true # Uncomment for debug mode
|
|
|
|
# Optional: Resource limits
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
memory: 512M
|
|
reservations:
|
|
memory: 256M
|
|
|
|
# Optional: Health check
|
|
healthcheck:
|
|
test: ["CMD", "node", "-e", "process.exit(0)"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 40s
|
|
|
|
# Optional: Add a volume backup service
|
|
# backup:
|
|
# image: alpine:latest
|
|
# container_name: ghbot-backup
|
|
# volumes:
|
|
# - ./config.json:/backup/config.json:ro
|
|
# - ./conf:/backup/conf:ro
|
|
# - ./sfx:/backup/sfx:ro
|
|
# command: |
|
|
# sh -c "
|
|
# echo 'Creating backup...'
|
|
# tar czf /backup/ghbot-backup-$(date +%Y%m%d_%H%M%S).tar.gz -C /backup config.json conf sfx
|
|
# echo 'Backup complete'
|
|
# "
|
|
# profiles:
|
|
# - backup
|
|
|
|
# Optional: Create named volumes for persistent data
|
|
# volumes:
|
|
# ghbot_logs:
|
|
# driver: local |