{"id":46638295,"url":"https://github.com/tetherto/miningos-wrk-container-antspace","last_synced_at":"2026-03-08T02:13:24.365Z","repository":{"id":335332528,"uuid":"1129676649","full_name":"tetherto/miningos-wrk-container-antspace","owner":"tetherto","description":null,"archived":false,"fork":false,"pushed_at":"2026-01-29T17:18:30.000Z","size":88,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-30T05:17:40.340Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tetherto.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-01-07T12:29:22.000Z","updated_at":"2026-01-29T17:19:02.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/tetherto/miningos-wrk-container-antspace","commit_stats":null,"previous_names":["tetherto/miningos-wrk-container-antspace"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/tetherto/miningos-wrk-container-antspace","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tetherto%2Fminingos-wrk-container-antspace","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tetherto%2Fminingos-wrk-container-antspace/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tetherto%2Fminingos-wrk-container-antspace/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tetherto%2Fminingos-wrk-container-antspace/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tetherto","download_url":"https://codeload.github.com/tetherto/miningos-wrk-container-antspace/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tetherto%2Fminingos-wrk-container-antspace/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30242406,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-08T00:58:18.660Z","status":"online","status_checked_at":"2026-03-08T02:00:06.215Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-03-08T02:13:23.837Z","updated_at":"2026-03-08T02:13:24.345Z","avatar_url":"https://github.com/tetherto.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# miningos-wrk-container-antspace\n\nA worker service for managing Antspace cooling containers in MiningOS. This service provides APIs to monitor and control HK3 and Immersion cooling systems.\n\n## Table of Contents\n\n1. [Overview](#overview)\n2. [Object Model](#object-model)\n3. [Worker Types](#worker-types)\n4. [Requirements](#requirements)\n5. [Installation](#installation)\n6. [Configuration](#configuration)\n7. [Running the Worker](#running-the-worker)\n8. [API Documentation](#api-documentation)\n9. [Alert System](#alert-system)\n10. [Mock Server](#mock-server)\n11. [Testing](#testing)\n12. [Development](#development)\n13. [Troubleshooting](#troubleshooting)\n\n## Overview\n\nThe Antspace container worker provides a unified interface for managing different types of cooling containers used in cryptocurrency mining operations. It supports real-time monitoring, temperature control, and alert management for both HK3 and Immersion cooling systems.\n\n### Key Features\n\n- Real-time monitoring of cooling system parameters\n- Temperature control and system management\n- Comprehensive alert system for fault detection\n- Mock server for development and testing\n- Support for multiple container types\n\n## Object Model\n\nThe following is a fragment of [MiningOS object model](https://docs.mos.tether.io/) that contains the concrete class representing **Antspace Container workers** (highlighted in blue). The rounded nodes reprsent abstract classes and the square nodes represents a concrete classes:\n\n```mermaid\n---\ntitle: Object Model of MiningOS\n---\nflowchart RL\n    bfx-wrk-base@{ shape: stadium, label: \"*bfx-wrk-base*\" }\n\n\n    tether-wrk-base@{ shape: stadium, label: \"*tether-wrk-base*\" }\n    tether-wrk-base---\u003ebfx-wrk-base\n\n\n    miningos-tlp-wrk-thing@{ shape: stadium, label: \"*miningos-tlp-wrk-thing*\" }\n    miningos-tlp-wrk-thing---\u003etether-wrk-base\n\n\n    miningos-tpl-wrk-container@{ shape: stadium, label: \"*miningos-tpl-wrk-container*\" }\n    miningos-tpl-wrk-container---\u003eminingos-tlp-wrk-thing\n\n\n    miningos-wrk-container-antspace-base[\"miningos-wrk-container-antspace-base\"]\n    miningos-wrk-container-antspace-base---\u003eminingos-tpl-wrk-container\n\n    miningos-wrk-container-antspace-hk3[\"miningos-wrk-container-antspace-hk3\"]\n    miningos-wrk-container-antspace-hk3---\u003eminingos-wrk-container-antspace-base\n\n    miningos-wrk-container-antspace-immersion[\"miningos-wrk-container-antspace-immersion\"]\n    miningos-wrk-container-antspace-immersion---\u003eminingos-wrk-container-antspace-base\n\n\n    style miningos-wrk-container-antspace-base fill:#005,stroke-width:4px,color:white\n    style miningos-wrk-container-antspace-hk3 fill:#005,stroke-width:4px,color:white\n    style miningos-wrk-container-antspace-immersion fill:#005,stroke-width:4px,color:white\n```\n\nCheck out [miningos-tpl-wrk-container](https://github.com/tetherto/miningos-tpl-wrk-container) for more information about parent classes.\n\n## Worker Types\n\nThe system supports two container types (the two rightmost child classes highlighted in the diagram above):\n\n- **`wrk-container-rack-hk3`** - For HK3 cooling containers with cooling tower systems\n- **`wrk-container-rack-immersion`** - For immersion cooling containers with dry cooler systems\n\n## Requirements\n\n- Node.js \u003e= 20.0\n\n## Configuration\n\n### Configuration Files Structure\n\n```\nconfig/\n├── base.thing.json      # Container monitoring and alert configuration\n├── common.json          # Common settings (logging, debug)\n└── facs/               # Facility-specific configurations\n    ├── miningos-net.config.json\n    ├── net.config.json\n    └── store.config.json\n```\n\n### Key Configuration Parameters\n\n#### base.thing.json\n- `collectSnapTimeoutMs`: Timeout for collecting snapshots (default: 120000ms)\n- `collectSnapsItvMs`: Interval for collecting snapshots (default: 60000ms)\n- `logRotateMaxLength`: Maximum log file length before rotation (default: 10000)\n- `logKeepCount`: Number of log files to keep (default: 3)\n- `alerts`: Container-specific alert definitions with severity levels\n\n#### common.json\n- `dir_log`: Directory for log files (default: \"logs\")\n- `debug`: Debug level (0 = off, 1 = on)\n\n### Alert Severity Levels\n\n- **critical**: Immediate attention required (e.g., leakage, pump failures)\n- **high**: Significant issues requiring prompt attention\n- **medium**: Issues that need monitoring but not immediate action\n\n\n## Installation\n\n1. Clone the repository:\n```bash\ngit clone https://github.com/tetherto/miningos-wrk-container-antspace.git\ncd miningos-wrk-container-antspace\n```\n\n2. Install dependencies:\n```bash\nnpm install\n```\n\n3. Set up configuration files:\n```bash\n./setup-config.sh\n```\n\n## Running the Worker\n\n### Starting the Worker Service\n\nFor HK3 container:\n```bash\nnode worker.js --wtype wrk-container-rack-hk3 --env development --rack 1\n```\n\nFor Immersion container:\n```bash\nnode worker.js --wtype wrk-container-rack-immersion --env development --rack 2\n```\n\n### Registering a Container\n\nAfter starting the worker, register a container using the RPC client:\n\n```bash\nhp-rpc-cli -s wrk-as -m registerThing -d '{\"info\":{\"container\":\"bitmain-imm-1\"},\"opts\":{\"address\":\"127.0.0.1\",\"port\":8000}}'\n```\n\nParameters:\n- `info.container`: Container identifier\n- `opts.address`: IP address of the container\n- `opts.port`: Port number for container communication\n\n## API Documentation\n\nThe worker exposes several APIs for container management. See [docs/antspace.md](./docs/antspace.md) for detailed API documentation.\n\n### Core Functions\n\n#### Control Operations\n- `switchCoolingSystem(enabled)` - Enable/disable the cooling system\n- `resetCoolingSystem()` - Reset the cooling system\n- `setLiquidSupplyTemperature(temperature)` - Set target supply temperature\n\n#### Monitoring Operations\n- `getSystemData()` - Retrieve complete system data\n- `getMinerInfo()` - Get miner information\n- `getConfig()` - Get current configuration\n- `getInfo()` - Get container information\n- `getStats()` - Get current statistics\n- `getSnap()` - Get a complete snapshot of the container state\n\n### Notable Parameters Available in API Responses\n\n#### HK3 Container\nMonitors cooling tower systems with parameters including:\n- Supply/return liquid temperature and pressure\n- Cooling tower fan status (3 fans)\n- Spray pump and fluid infusion pump status\n- Liquid flow rates and levels\n\n#### Immersion Container\nMonitors dry cooler systems with parameters including:\n- Secondary circulation pump status\n- Dry cooler power frequency\n- Power distribution box temperature\n- Liquid level sensors\n\n### RPC API\n\nThe Antspace container worker exposes RPC methods through a multi-layered inheritance system. RPC functionality is inherited from `miningos-tpl-wrk-thing` through `miningos-tpl-wrk-container`.\n\n#### Architecture\n\n```\n┌─────────────┐     RPC      ┌──────────────┐     HTTP      ┌───────────────┐\n│  RPC Client ├─────────────►│    Worker    ├──────────────►│   Container   │\n│ (hp-rpc-cli)│              │   Service    │               │   Hardware    │\n└─────────────┘              └──────────────┘               └───────────────┘\n```\n\n#### Service Access\n\n- **Service name**: `wrk-as`\n- **Worker types**: \n  - `wrk-container-rack-hk3`\n  - `wrk-container-rack-immersion`\n\n#### RPC Methods\n\n##### Core Methods\n\n###### `registerThing`\nRegisters a container with the worker service.\n\n```bash\nhp-rpc-cli -s wrk-as -m registerThing -d '{\"info\":{\"container\":\"bitmain-imm-1\"},\"opts\":{\"address\":\"127.0.0.1\",\"port\":8000}}'\n```\n\n**Parameters:**\n- `info.container`: Container identifier\n- `opts.address`: Container IP address  \n- `opts.port`: Container port\n\n###### `listThings`\nLists all registered containers.\n\n```bash\nhp-rpc-cli -s wrk-as -m listThings -d '{\"status\":true}'\n```\n\n**Parameters:**\n- `status` (optional): Include last snapshot data\n- `offset` (optional): Pagination offset\n- `limit` (optional): Results limit (default: 100)\n\n###### `queryThing`\nExecutes a method on a specific container.\n\n```bash\nhp-rpc-cli -s wrk-as -m queryThing -d '{\"id\":\"bitmain-imm-1\",\"method\":\"getStats\",\"params\":[]}'\n```\n\n**Parameters:**\n- `id`: Container ID\n- `method`: Method name to execute\n- `params`: Method parameters\n\n###### `applyThings`\nExecutes the same action on multiple containers.\n\n```bash\nhp-rpc-cli -s wrk-as -m applyThings -d '{\"method\":\"resetCoolingSystem\",\"query\":{\"tags\":{\"$in\":[\"t-container\"]}}}'\n```\n\n**Parameters:**\n- `method`: Action to execute\n- `query` (optional): MongoDB-style filter\n- `params` (optional): Method parameters\n\n**Available Actions (Antspace-specific):**\n- `resetCoolingSystem`\n- `setLiquidSupplyTemperature`\n\n###### `updateThing`\nUpdates container configuration.\n\n```bash\nhp-rpc-cli -s wrk-as -m updateThing -d '{\"id\":\"bitmain-imm-1\",\"info\":{\"location\":\"rack-2\"}}'\n```\n\n**Parameters:**\n- `id`: Container ID\n- `info` (optional): Info to update\n- `opts` (optional): Options to update\n- `forceOverwrite` (optional): Replace instead of merge\n\n###### `forgetThings`\nRemoves containers from management.\n\n```bash\nhp-rpc-cli -s wrk-as -m forgetThings -d '{\"query\":{\"id\":{\"$in\":[\"bitmain-imm-1\"]}}}'\n```\n\n**Parameters:**\n- `query`: MongoDB-style filter\n- `all` (optional): Remove all containers\n\n##### Monitoring Methods\n\n#### `tailLog`\nRetrieves historical data logs.\n\n```bash\nhp-rpc-cli -s wrk-as -m tailLog -d '{\"key\":\"stat-5m\",\"tag\":\"t-container\",\"limit\":100}'\n```\n\n**Parameters:**\n- `key`: Log key (e.g., \"stat-5m\", \"stat-1h\")\n- `tag`: Tag to filter\n- `limit` (optional): Number of entries\n- `start` (optional): Start timestamp\n- `end` (optional): End timestamp\n\n###### `getRack`\nGets rack information.\n\n```bash\nhp-rpc-cli -s wrk-as -m getRack\n```\n\n**Returns:**\n- `id`: Rack identifier\n- `rpcPubKey`: RPC public key\n\n##### Utility Methods\n\n###### `echo`\nTests RPC connectivity.\n\n```bash\nhp-rpc-cli -s wrk-as -m echo -d '\"test\"'\n```\n\n#### Error Responses\n\nCommon errors:\n- `ERR_THING_NOTFOUND`: Container not registered\n- `ERR_METHOD_INVALID`: Invalid method name\n- `ERR_THING_NOT_INITIALIZED`: Container not connected\n- `ERR_SLAVE_BLOCK`: Operation not allowed on replica\n\n#### Example Workflow\n\n```bash\n# 1. Start worker\nnode worker.js --wtype wrk-container-rack-hk3 --env development --rack 1\n\n# 2. Register container\nhp-rpc-cli -s wrk-as -m registerThing -d '{\"info\":{\"container\":\"hk3-001\"},\"opts\":{\"address\":\"192.168.1.100\",\"port\":8000}}'\n\n# 3. List containers\nhp-rpc-cli -s wrk-as -m listThings\n\n# 4. Query specific container\nhp-rpc-cli -s wrk-as -m queryThing -d '{\"id\":\"hk3-001\",\"method\":\"getStats\",\"params\":[]}'\n\n# 5. Apply action to all HK3 containers\nhp-rpc-cli -s wrk-as -m applyThings -d '{\"method\":\"setLiquidSupplyTemperature\",\"params\":[22],\"query\":{\"tags\":{\"$in\":[\"t-container-rack-hk3\"]}}}'\n\n# 6. View historical data\nhp-rpc-cli -s wrk-as -m tailLog -d '{\"key\":\"stat-5m\",\"tag\":\"t-container\",\"limit\":10}'\n```\n\n## Alert System\n\nThe system includes comprehensive alert monitoring for various fault conditions:\n\n### Common Alerts\n- Power faults\n- Pump failures (circulating, spray, fluid infusion)\n- Fan malfunctions\n- Temperature anomalies\n- Pressure issues\n- Flow rate problems\n- Leakage detection\n\n### Container-Specific Alerts\n\n**HK3 Additional Alerts:**\n- Cooling tower liquid level\n- Freezing conditions\n- Cooling tower fan faults (3 fans)\n\n**Immersion Additional Alerts:**\n- Phase failures\n- Sensor faults (temperature, level, smoke)\n- Power distribution faults\n- Frequency conversion issues\n\n## Mock Server\n\nFor development and testing, use the mock server:\n\n```bash\n# Basic usage\nnode mock/server.js --type HK3 -p 8000 -h 0.0.0.0\n\n# With error simulation\nnode mock/server.js --type HK3 -p 8000 -h 0.0.0.0 --error\n```\n\n### Mock Server Options\n- `--type`: Container type (HK3 or IMMERSION) - **required**\n- `-p, --port`: Port number (default: 8000)\n- `-h, --host`: Host address (default: 127.0.0.1)\n- `--error`: Enable error response simulation\n- `--bulk`: Load multiple containers from a JSON file\n\n## Testing\n\nRun the test suite:\n```bash\nnpm run test\n```\n\n### Debug Mode\n\n```bash\nDEBUG=* node worker.js --wtype wrk-container-rack-hk3 --env development --rack 1\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftetherto%2Fminingos-wrk-container-antspace","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftetherto%2Fminingos-wrk-container-antspace","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftetherto%2Fminingos-wrk-container-antspace/lists"}