first commit
This commit is contained in:
127
api/config/development.yaml
Normal file
127
api/config/development.yaml
Normal file
@@ -0,0 +1,127 @@
|
||||
# Development Configuration for Code of Conquest
|
||||
|
||||
app:
|
||||
name: "Code of Conquest"
|
||||
version: "0.1.0"
|
||||
environment: "development"
|
||||
debug: true
|
||||
|
||||
server:
|
||||
host: "0.0.0.0"
|
||||
port: 5000
|
||||
workers: 1
|
||||
|
||||
redis:
|
||||
host: "localhost"
|
||||
port: 6379
|
||||
db: 0
|
||||
max_connections: 50
|
||||
|
||||
rq:
|
||||
queues:
|
||||
- "ai_tasks"
|
||||
- "combat_tasks"
|
||||
- "marketplace_tasks"
|
||||
worker_timeout: 600
|
||||
job_timeout: 300
|
||||
|
||||
ai:
|
||||
timeout: 30
|
||||
max_retries: 3
|
||||
cost_alert_threshold: 100.00
|
||||
|
||||
models:
|
||||
free:
|
||||
provider: "replicate"
|
||||
model: "meta/meta-llama-3-70b-instruct"
|
||||
max_tokens: 256
|
||||
temperature: 0.7
|
||||
|
||||
standard:
|
||||
provider: "anthropic"
|
||||
model: "claude-3-5-haiku-20241022"
|
||||
max_tokens: 512
|
||||
temperature: 0.8
|
||||
|
||||
premium:
|
||||
provider: "anthropic"
|
||||
model: "claude-3-5-sonnet-20241022"
|
||||
max_tokens: 1024
|
||||
temperature: 0.9
|
||||
|
||||
rate_limiting:
|
||||
enabled: true
|
||||
storage_url: "redis://localhost:6379/1"
|
||||
|
||||
tiers:
|
||||
free:
|
||||
requests_per_minute: 30
|
||||
ai_calls_per_day: 50
|
||||
custom_actions_per_day: 10
|
||||
custom_action_char_limit: 150
|
||||
basic:
|
||||
requests_per_minute: 60
|
||||
ai_calls_per_day: 200
|
||||
custom_actions_per_day: 50
|
||||
custom_action_char_limit: 300
|
||||
premium:
|
||||
requests_per_minute: 120
|
||||
ai_calls_per_day: 1000
|
||||
custom_actions_per_day: -1 # Unlimited
|
||||
custom_action_char_limit: 500
|
||||
elite:
|
||||
requests_per_minute: 300
|
||||
ai_calls_per_day: -1 # Unlimited
|
||||
custom_actions_per_day: -1 # Unlimited
|
||||
custom_action_char_limit: 500
|
||||
|
||||
session:
|
||||
timeout_minutes: 30
|
||||
auto_save_interval: 5
|
||||
min_players: 1
|
||||
max_players_by_tier:
|
||||
free: 1
|
||||
basic: 2
|
||||
premium: 6
|
||||
elite: 10
|
||||
|
||||
auth:
|
||||
# Authentication cookie settings
|
||||
cookie_name: "coc_session"
|
||||
duration_normal: 86400 # 24 hours (seconds)
|
||||
duration_remember_me: 2592000 # 30 days (seconds)
|
||||
http_only: true
|
||||
secure: false # Set to true in production (HTTPS only)
|
||||
same_site: "Lax"
|
||||
path: "/"
|
||||
|
||||
# Password requirements
|
||||
password_min_length: 8
|
||||
password_require_uppercase: true
|
||||
password_require_lowercase: true
|
||||
password_require_number: true
|
||||
password_require_special: true
|
||||
|
||||
# User input validation
|
||||
name_min_length: 3
|
||||
name_max_length: 50
|
||||
email_max_length: 255
|
||||
|
||||
marketplace:
|
||||
auction_check_interval: 300 # 5 minutes
|
||||
max_listings_by_tier:
|
||||
premium: 10
|
||||
elite: 25
|
||||
|
||||
cors:
|
||||
origins:
|
||||
- "http://localhost:8000"
|
||||
- "http://127.0.0.1:8000"
|
||||
|
||||
logging:
|
||||
level: "DEBUG"
|
||||
format: "json"
|
||||
handlers:
|
||||
- "console"
|
||||
- "file"
|
||||
file_path: "logs/app.log"
|
||||
126
api/config/production.yaml
Normal file
126
api/config/production.yaml
Normal file
@@ -0,0 +1,126 @@
|
||||
# Production Configuration for Code of Conquest
|
||||
|
||||
app:
|
||||
name: "Code of Conquest"
|
||||
version: "0.1.0"
|
||||
environment: "production"
|
||||
debug: false
|
||||
|
||||
server:
|
||||
host: "0.0.0.0"
|
||||
port: 5000
|
||||
workers: 4
|
||||
|
||||
redis:
|
||||
host: "redis" # Docker service name or production host
|
||||
port: 6379
|
||||
db: 0
|
||||
max_connections: 100
|
||||
|
||||
rq:
|
||||
queues:
|
||||
- "ai_tasks"
|
||||
- "combat_tasks"
|
||||
- "marketplace_tasks"
|
||||
worker_timeout: 600
|
||||
job_timeout: 300
|
||||
|
||||
ai:
|
||||
timeout: 30
|
||||
max_retries: 3
|
||||
cost_alert_threshold: 500.00
|
||||
|
||||
models:
|
||||
free:
|
||||
provider: "replicate"
|
||||
model: "meta/meta-llama-3-70b-instruct"
|
||||
max_tokens: 256
|
||||
temperature: 0.7
|
||||
|
||||
standard:
|
||||
provider: "anthropic"
|
||||
model: "claude-3-5-haiku-20241022"
|
||||
max_tokens: 512
|
||||
temperature: 0.8
|
||||
|
||||
premium:
|
||||
provider: "anthropic"
|
||||
model: "claude-3-5-sonnet-20241022"
|
||||
max_tokens: 1024
|
||||
temperature: 0.9
|
||||
|
||||
rate_limiting:
|
||||
enabled: true
|
||||
storage_url: "redis://redis:6379/1"
|
||||
|
||||
tiers:
|
||||
free:
|
||||
requests_per_minute: 30
|
||||
ai_calls_per_day: 50
|
||||
custom_actions_per_day: 10
|
||||
custom_action_char_limit: 150
|
||||
basic:
|
||||
requests_per_minute: 60
|
||||
ai_calls_per_day: 200
|
||||
custom_actions_per_day: 50
|
||||
custom_action_char_limit: 300
|
||||
premium:
|
||||
requests_per_minute: 120
|
||||
ai_calls_per_day: 1000
|
||||
custom_actions_per_day: -1 # Unlimited
|
||||
custom_action_char_limit: 500
|
||||
elite:
|
||||
requests_per_minute: 300
|
||||
ai_calls_per_day: -1 # Unlimited
|
||||
custom_actions_per_day: -1 # Unlimited
|
||||
custom_action_char_limit: 500
|
||||
|
||||
session:
|
||||
timeout_minutes: 30
|
||||
auto_save_interval: 5
|
||||
min_players: 1
|
||||
max_players_by_tier:
|
||||
free: 1
|
||||
basic: 2
|
||||
premium: 6
|
||||
elite: 10
|
||||
|
||||
auth:
|
||||
# Authentication cookie settings
|
||||
cookie_name: "coc_session"
|
||||
duration_normal: 86400 # 24 hours (seconds)
|
||||
duration_remember_me: 2592000 # 30 days (seconds)
|
||||
http_only: true
|
||||
secure: true # HTTPS only in production
|
||||
same_site: "Lax"
|
||||
path: "/"
|
||||
|
||||
# Password requirements
|
||||
password_min_length: 8
|
||||
password_require_uppercase: true
|
||||
password_require_lowercase: true
|
||||
password_require_number: true
|
||||
password_require_special: true
|
||||
|
||||
# User input validation
|
||||
name_min_length: 3
|
||||
name_max_length: 50
|
||||
email_max_length: 255
|
||||
|
||||
marketplace:
|
||||
auction_check_interval: 300 # 5 minutes
|
||||
max_listings_by_tier:
|
||||
premium: 10
|
||||
elite: 25
|
||||
|
||||
cors:
|
||||
origins:
|
||||
- "https://yourdomain.com" # Replace with actual production domain
|
||||
|
||||
logging:
|
||||
level: "INFO"
|
||||
format: "json"
|
||||
handlers:
|
||||
- "console"
|
||||
- "file"
|
||||
file_path: "/var/log/coc/app.log"
|
||||
77
api/config/rq_config.py
Normal file
77
api/config/rq_config.py
Normal file
@@ -0,0 +1,77 @@
|
||||
"""
|
||||
RQ Worker Configuration
|
||||
|
||||
This module provides configuration settings for RQ workers.
|
||||
Workers can be started with these settings using the start_workers.sh script.
|
||||
|
||||
Usage:
|
||||
# In worker startup
|
||||
from config.rq_config import WORKER_CONFIG
|
||||
|
||||
worker = Worker(
|
||||
queues=WORKER_CONFIG['queues'],
|
||||
connection=redis_conn,
|
||||
**WORKER_CONFIG['worker_kwargs']
|
||||
)
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
from app.tasks import ALL_QUEUES, QUEUE_AI_TASKS, QUEUE_COMBAT_TASKS, QUEUE_MARKETPLACE_TASKS
|
||||
|
||||
|
||||
# Redis URL for workers
|
||||
REDIS_URL = os.getenv('REDIS_URL', 'redis://localhost:6379/0')
|
||||
|
||||
|
||||
# Worker configuration
|
||||
WORKER_CONFIG = {
|
||||
# Queues to listen on (in priority order)
|
||||
'queues': ALL_QUEUES,
|
||||
|
||||
# Worker behavior settings
|
||||
'worker_kwargs': {
|
||||
'name': None, # Auto-generated if None
|
||||
'default_result_ttl': 3600, # 1 hour
|
||||
'default_worker_ttl': 420, # 7 minutes
|
||||
'job_monitoring_interval': 5, # Check job status every 5 seconds
|
||||
'disable_default_exception_handler': False,
|
||||
'log_job_description': True,
|
||||
},
|
||||
|
||||
# Burst mode (process jobs then exit)
|
||||
'burst': False,
|
||||
|
||||
# Logging
|
||||
'logging_level': os.getenv('LOG_LEVEL', 'INFO'),
|
||||
}
|
||||
|
||||
|
||||
# Scheduler configuration (for periodic tasks)
|
||||
SCHEDULER_CONFIG = {
|
||||
'interval': 60, # Check for scheduled jobs every 60 seconds
|
||||
}
|
||||
|
||||
|
||||
# Job retry configuration
|
||||
RETRY_CONFIG = {
|
||||
'max_retries': 3,
|
||||
'retry_delays': [60, 300, 900], # 1 min, 5 min, 15 min
|
||||
}
|
||||
|
||||
|
||||
# Queue-specific worker settings (for specialized workers)
|
||||
SPECIALIZED_WORKERS = {
|
||||
'ai_worker': {
|
||||
'queues': [QUEUE_AI_TASKS],
|
||||
'description': 'Dedicated worker for AI generation tasks',
|
||||
},
|
||||
'combat_worker': {
|
||||
'queues': [QUEUE_COMBAT_TASKS],
|
||||
'description': 'Dedicated worker for combat processing',
|
||||
},
|
||||
'marketplace_worker': {
|
||||
'queues': [QUEUE_MARKETPLACE_TASKS],
|
||||
'description': 'Dedicated worker for marketplace tasks',
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user