Skip to content

Latest commit

 

History

History

server

Folders and files

README.md

Kernel Images Server

A REST API server to start, stop, and download screen recordings.

🛠️ Prerequisites

Required Software

  • Go 1.27.3+ - Programming language runtime
  • ffmpeg - Video recording engine
    • macOS: brew install ffmpeg
    • Linux: sudo apt install ffmpeg or sudo yum install ffmpeg
  • pnpm - For OpenAPI code generation
    • npm install -g pnpm

System Requirements

  • macOS: Uses AVFoundation for screen capture
  • Linux: Uses X11 for screen capture
  • Windows: Not currently supported

🚀 Quick Start

Running the Server

make dev

The server will start on port 10001 by default and log its configuration.

Example use

# 1. Start a new recording
curl http://localhost:10001/recording/start -d {}

# (recording in progress)

# 2. Stop recording
curl http://localhost:10001/recording/stop -d {}

# 3. Download the recorded file
curl http://localhost:10001/recording/download --output recording.mp4

⚙️ Configuration

Configure the server using environment variables:

Variable Default Description
PORT 10001 HTTP server port
METRICS_PORT 10002 Prometheus metrics port (GET /metrics)
FRAME_RATE 10 Default recording framerate (fps)
DISPLAY_NUM 1 Display/screen number to capture
MAX_SIZE_MB 500 Default maximum file size (MB)
OUTPUT_DIR . Directory to save recordings
FFMPEG_PATH ffmpeg Path to the ffmpeg binary
KERNEL_METRO_API_BASE_URL Metro API base URL; answers the WebAuthn page hook (PUT /webauthn/hook)
KERNEL_INSTANCE_JWT Instance credential sent to the metro API and the OTLP relay

Example Configuration

export PORT=8080
export FRAME_RATE=30
export MAX_SIZE_MB=1000
export OUTPUT_DIR=/tmp/recordings
./bin/api

API Documentation

🔧 Development

Code Generation

The server uses OpenAPI code generation. After modifying openapi.yaml:

make oapi-generate

🧪 Testing

Running Tests

make test