- Add migration 041_node_local_endpoints.sql - Add get_node_endpoints() to repo_city.py - Update routes_city.py to use DB endpoints instead of hardcoded URLs - Update node-guardian-loop.py to use NODE_SWAPPER_URL/NODE_ROUTER_URL env vars - Update launchd plist for NODE2 with router URL
31 lines
1.0 KiB
SQL
31 lines
1.0 KiB
SQL
-- Migration: Add local endpoint URLs for each node
|
|
-- Purpose: Allow each node to have its own Swapper and Router URLs for proper isolation
|
|
|
|
-- Add endpoint columns to node_cache
|
|
ALTER TABLE node_cache
|
|
ADD COLUMN IF NOT EXISTS router_url text,
|
|
ADD COLUMN IF NOT EXISTS swapper_url text;
|
|
|
|
COMMENT ON COLUMN node_cache.router_url IS 'Full URL of DAGI Router for this node';
|
|
COMMENT ON COLUMN node_cache.swapper_url IS 'Full URL of Swapper Service for this node';
|
|
|
|
-- Set default values for NODE1 (Docker-based)
|
|
UPDATE node_cache
|
|
SET
|
|
router_url = 'http://dagi-router:9102',
|
|
swapper_url = 'http://swapper-service:8890'
|
|
WHERE node_id = 'node-1-hetzner-gex44'
|
|
AND router_url IS NULL;
|
|
|
|
-- Set default values for NODE2 (localhost-based)
|
|
UPDATE node_cache
|
|
SET
|
|
router_url = 'http://localhost:9102',
|
|
swapper_url = 'http://localhost:8890'
|
|
WHERE node_id = 'node-2-macbook-m4max'
|
|
AND router_url IS NULL;
|
|
|
|
-- Create index for faster lookups
|
|
CREATE INDEX IF NOT EXISTS idx_node_cache_endpoints ON node_cache (node_id) WHERE router_url IS NOT NULL;
|
|
|