@meru2802/aux-server
v1.0.14
Published
Nexus EPM auxillary server to facilitate additional functionality required by Scogo Iceberg
Readme
Nexus EPM Auxiliary Server
Nexus EPM auxiliary server to facilitate additional functionality required by Scogo Iceberg.
Features
- MeshCentral integration for remote device management
- Device group management
- Download link generation for mesh agents
- Connection URL generation for remote access (control, terminal, file system)
- Health monitoring and status endpoints
- WebSocket connectivity for real-time communication
- PostgreSQL database integration
API Documentation
The server includes comprehensive API documentation using Swagger/OpenAPI 3.0.
Accessing API Documentation
Once the server is running, you can access the interactive API documentation at:
- Swagger UI:
http://localhost:3003/docs - OpenAPI JSON Spec:
http://localhost:3003/docs/json
The Swagger UI provides:
- Interactive API testing
- Detailed endpoint documentation
- Request/response schema definitions
- Example requests and responses
- Authentication information
Available Endpoints
Health Endpoints
GET /health- Basic health check for load balancersGET /status- Detailed service status including connections and uptime
API Endpoints
POST /api/generate-download-link- Generate download link for MeshCentral agentPOST /api/generate-connect-urls- Generate authenticated URLs for device access
Core Endpoints
POST /core/create-device-group- Create a new device group in MeshCentralPOST /core/add-user-to-group- Add multiple users to a device group
Development
Prerequisites
- Node.js (v18 or higher)
- pnpm
- PostgreSQL database
- MeshCentral server
Installation
# Install dependencies
pnpm install
# Build the project
pnpm run build
# Start the server
pnpm run start
# Development mode with auto-reload
pnpm run dev:watchEnvironment Setup
Ensure you have the proper configuration in config.json with:
- MeshCentral server credentials and encryption keys
- Database connection settings
- Iceberg integration endpoints
- Logging configuration
Database Setup
Run the schema.sql file against your PostgreSQL database to set up the required tables:
pnpm run setup:dbConfiguration
The server uses a JSON configuration file (config.json) with the following structure:
meshcentralConfig: MeshCentral server connection and encryption settingsdbConfig: PostgreSQL database connection settingsicebergConfig: Iceberg integration endpointslogging: Logging configuration for file rotation and levels
Usage
Getting a Download Link
curl -X POST http://localhost:3003/api/generate-download-link \
-H "Content-Type: application/json" \
-d '{"deviceGroupName": "production-servers"}'Getting Connection URLs
curl -X POST http://localhost:3003/api/generate-connect-urls \
-H "Content-Type: application/json" \
-d '{"meshNodeId": "node//abc123", "userId": "john.doe"}'Creating a Device Group
curl -X POST http://localhost:3003/core/create-device-group \
-H "Content-Type: application/json" \
-d '{"deviceGroupName": "new-group", "description": "My new device group"}'Adding Users to a Device Group
curl -X POST http://localhost:3003/core/add-user-to-group \
-H "Content-Type: application/json" \
-d '{"deviceGroupName": "production-servers", "users": ["john.doe", "jane.smith"]}'Architecture
The server follows a modular architecture with:
- Controllers: Handle HTTP request/response logic
- Services: Business logic and external integrations
- Routes: API endpoint definitions and middleware
- Middleware: Request processing, error handling, and validation
- Types: TypeScript type definitions
Health Monitoring
The server provides comprehensive health monitoring:
- Basic Health Check:
/health- Quick status for load balancers - Detailed Status:
/status- Complete service information including:- Service version and uptime
- MeshCentral connection status
- Database connection status
- External service connectivity
Error Handling
All endpoints return standardized error responses with:
- HTTP status codes
- Error messages
- Timestamps
- Request correlation information
Security
The server implements:
- CORS configuration
- Helmet security headers
- Request validation
- Encrypted cookie handling for MeshCentral integration
- Database connection pooling with proper error handling
