feat: add agent zones
This commit is contained in:
1 parent
d8cd7ad058
commit
82309db79a
29 files changed
+2242
-255
No files matched your search
@@ -40,6 +40,54 @@ ON CONFLICT (id) DO UPDATE SET
|
||||
description = EXCLUDED.description,
|
||||
updated_at = now();
|
||||
|
||||
INSERT INTO agent_zones (id, site_id, name, description, is_enabled)
|
||||
VALUES (
|
||||
'd0000000-0000-4000-8000-000000000201',
|
||||
'd0000000-0000-4000-8000-000000000001',
|
||||
'Demo Operations Network',
|
||||
'Synthetic development-only Agent reachability Zone.',
|
||||
true
|
||||
)
|
||||
ON CONFLICT (id) DO UPDATE SET
|
||||
site_id = EXCLUDED.site_id,
|
||||
name = EXCLUDED.name,
|
||||
description = EXCLUDED.description,
|
||||
is_enabled = EXCLUDED.is_enabled,
|
||||
updated_at = now();
|
||||
|
||||
INSERT INTO agent_zone_network_ranges (
|
||||
id, agent_zone_id, network
|
||||
) VALUES (
|
||||
'd0000000-0000-4000-8000-000000000202',
|
||||
'd0000000-0000-4000-8000-000000000201',
|
||||
'192.0.2.0/24'::cidr
|
||||
)
|
||||
ON CONFLICT (id) DO UPDATE SET
|
||||
agent_zone_id = EXCLUDED.agent_zone_id,
|
||||
network = EXCLUDED.network;
|
||||
|
||||
INSERT INTO minerops_site_agents (
|
||||
agent_id, site_id, agent_zone_id, site_name, hostname, version,
|
||||
last_checkin_at, last_payload
|
||||
) VALUES (
|
||||
'plexus-windows-agent',
|
||||
'd0000000-0000-4000-8000-000000000001',
|
||||
'd0000000-0000-4000-8000-000000000201',
|
||||
'Demo Mining Site',
|
||||
'demo-agent',
|
||||
'development-fixture',
|
||||
now(),
|
||||
jsonb_build_object('control_available', true, 'synthetic', true)
|
||||
)
|
||||
ON CONFLICT (agent_id) DO UPDATE SET
|
||||
site_id = EXCLUDED.site_id,
|
||||
agent_zone_id = EXCLUDED.agent_zone_id,
|
||||
site_name = EXCLUDED.site_name,
|
||||
hostname = EXCLUDED.hostname,
|
||||
version = EXCLUDED.version,
|
||||
last_checkin_at = EXCLUDED.last_checkin_at,
|
||||
last_payload = EXCLUDED.last_payload;
|
||||
|
||||
INSERT INTO rooms (id, site_id, name, description, sort_order)
|
||||
VALUES
|
||||
(
|
||||
@@ -94,7 +142,7 @@ WITH demo_miners AS (
|
||||
FROM generate_series(1, 30) AS series(i)
|
||||
)
|
||||
INSERT INTO miners (
|
||||
id, site_id, room_id, asset_tag, current_mac, current_ip, hostname,
|
||||
id, site_id, agent_zone_id, room_id, asset_tag, current_mac, current_ip, hostname,
|
||||
miner_sn, power_sn, control_board_sn, model, miner_type, api_version,
|
||||
firmware_version, platform, chip, status, lifecycle_status, notes,
|
||||
first_seen_at, last_seen_at, created_at, updated_at
|
||||
@@ -102,6 +150,7 @@ INSERT INTO miners (
|
||||
SELECT
|
||||
id,
|
||||
'd0000000-0000-4000-8000-000000000001',
|
||||
'd0000000-0000-4000-8000-000000000201',
|
||||
room_id,
|
||||
format('DEMO-MIN-%s', lpad(i::text, 3, '0')),
|
||||
mac,
|
||||
@@ -126,6 +175,7 @@ SELECT
|
||||
FROM demo_miners
|
||||
ON CONFLICT (id) DO UPDATE SET
|
||||
site_id = EXCLUDED.site_id,
|
||||
agent_zone_id = EXCLUDED.agent_zone_id,
|
||||
room_id = EXCLUDED.room_id,
|
||||
asset_tag = EXCLUDED.asset_tag,
|
||||
current_mac = EXCLUDED.current_mac,
|
||||
|
||||
@@ -26,6 +26,8 @@ WITH expected(table_name) AS (
|
||||
('miner_pool_snapshots'),
|
||||
('miner_api3_enrichment_snapshots'),
|
||||
('miner_api3_hashboard_snapshots'),
|
||||
('agent_zones'),
|
||||
('agent_zone_network_ranges'),
|
||||
('minerops_site_agents'),
|
||||
('minerops_agent_snapshots'),
|
||||
('minerops_agent_command_results'),
|
||||
|
||||
Reference in new issue
Block a user