highascg

🪐 HighAsCG: Virtual Project Walkthrough & System Guide

Welcome to the HighAsCG project virtual walkthrough! This document serves as a comprehensive, visual, and technical map of the project. It details how the code is organized, what individual files do, how the setup/startup sequence works, and why operators and users can safely and reliably run this system in high-pressure live production settings.


🛡️ Running HighAsCG Safely: Core Safety Design

Live broadcast and show-control servers must be extremely stable. HighAsCG is built around a “fail-safe” and “sandboxed” architecture to guarantee that manual operations, crashes, or double-clicks do not lock up high-end hardware, display ports, or standard system services.

1. Single-Instance Safety (Process Locking)

To prevent multiple instances from running at the same time and causing port conflicts (e.g., AMCP port 5250 or HTTP port 4200) or locking expensive PCI video cards (like Blackmagic Decklink), the Openbox autostart script employs a strict single-instance file lock:

exec 9>/tmp/caspar-openbox-autostart.lock
if ! flock -n 9; then
  exit 0
fi

[!IMPORTANT] Because of flock -n, if a background loop is already running, subsequent attempts to start the autostart script (manually or via desktop session restarts) will instantly and safely exit without spawning duplicate, conflicting processes.

2. Isolated Environment & Custom Libraries

To prevent interfering with the global operating system, HighAsCG relies on isolated local libraries rather than system-wide defaults. The /home/casparcg/highascg/run.sh script handles this seamlessly:

3. Graceful Automated Recovery (Self-Healing)

Live environments cannot afford downtime. In /home/casparcg/.config/openbox/autostart, the runner script is started with CASPAR_RESPAWN=1.

4. Deterministic CEF Cache Housekeeping

Chromium Embedded Framework (CEF) stores profiles and temporary caches that can easily become corrupted if the system experiences a sudden power loss or unclean shutdown. HighAsCG prevents cache corruption issues by cleanly wiping temporary data on startup:

rm -rf /home/casparcg/highascg/cef-cache/* 2>/dev/null

This guarantees that HTML overlays always load from a pristine, fresh state every time the application starts.

5. Non-Destructive User-Level Running

HighAsCG runs entirely within user space under /home/casparcg. It does not perform destructive actions on your operating system. System-level settings—such as updating GPU resolutions via xrandr or mounting backup drives—are strictly gated behind safe, passwordless sudo rules for specific files (see docs/HIGHASCG_PASSWORDLESS_SUDO.md), so the application cannot run arbitrary root commands.


🚀 Setup & Startup: The Ignition Sequence

For HighAsCG to orchestrate displays, media playout, and live graphics, a specific startup sequence takes place. Here is a breakdown of what runs and why:

1. The Openbox Desktop Autostart

File: /home/casparcg/.config/openbox/autostart

When the Linux graphical environment (usually managed by nodm and Openbox window manager) starts, it executes this script. Let’s look at the key steps:


2. The CasparCG Runner

File: /home/casparcg/highascg/run.sh

This shell script acts as a highly resilient daemon for the CasparCG server process:


3. Production Staged Startup (Optional)

File: tools/casparcg-staged-start.sh

In live environments, you might want the Node.js API and frontend to start before the rendering engine does, allowing you to tweak configuration parameters or upload new assets before “arming” the renderer:


📂 The HighAsCG Folder Structure Map

Here is a walk through the directory structure of the project, explaining what resides in each folder and how they power the system:

graph TD
    Root[highascg/] --> Config[config/]
    Root --> Src[src/ Backend]
    Root --> Web[web/ Frontend]
    Root --> Docs[docs/]
    Root --> Scripts[scripts/ & tools/]
    Root --> Data[data/ & media/]
    
    Config --> |JSON Configs| ConfigFiles[caspar_server.json, audio_routing.json, general.json...]
    Src --> |REST & WS| Core[bootstrap/, server/, api/]
    Src --> |Engine| Engine[engine/, caspar/, state/]
    Src --> |Peripherals| Ext[osc/, artnet/, streaming/, audio/]
    Web --> |Single Page App| SPA[index.html, app.js, styles.css]
    Web --> |Web Components| Components[client/components/...]

1. Root Folder Files


2. The Configuration Folder (config/)

All subsystem parameters are declared in /home/casparcg/highascg/config/:


3. The Backend Source (src/)

Divided into clean, modular domains inside /home/casparcg/highascg/src/:


4. The Frontend Source (client/)

HighAsCG features a premium, responsive Single Page Application (SPA) located in /home/casparcg/highascg/client/:


5. Auxiliary Directories


🛠️ Operational Cheat Sheet: How to Manage the Services

Start/Stop Commands

If you need to manage HighAsCG manually, use the standard Node/NPM scripts:

# To run in standard production mode:
npm start

# To run in developer mode with hot-reloads:
npm run dev

# To check if all APIs and systems are healthy (smoke tests):
npm run smoke -- 4200

Checking Active Outputs

You can inspect which ports are actively bound and running using common command line tools:

# Check if HighAsCG is listening on port 4200
ss -tlnp | grep 4200

# Check if CasparCG is listening on AMCP port 5250
ss -tlnp | grep 5250

Reading Logs

If something is not working as expected, logs are organized by domain:


[!TIP] Summary Recommendation for Operators: You can run HighAsCG with complete confidence. Thanks to robust file locks, self-healing process loops, environment isolation, and isolated library loading, the system is designed to handle glitches gracefully without affecting the underlying operating system.