Skip to content

Conversation

@rkoshy
Copy link

@rkoshy rkoshy commented Dec 28, 2025

Summary

This PR adds three related features that improve troubleshooting workflows and make Laminar more accessible to command-line tools and AI coding assistants.

Features

1. On-Disk Log Preservation (LAMINAR_ON_DISK_LOGS)

  • Problem: Logs are only stored compressed in SQLite database, making them inaccessible to standard Unix tools
  • Solution: Optional uncompressed log files alongside database storage
  • Configuration: LAMINAR_ON_DISK_LOGS=N environment variable
  • Behavior:
    • Writes logs to ${LAMINAR_HOME}/archive/JOB/RUN/log
    • Keeps N most recent logs per job with automatic rotation
    • Independent of LAMINAR_KEEP_RUNDIRS (important for remote build scenarios)
    • Backward compatible (disabled by default when N=0)

2. Configurable Default LAMINAR_HOME

  • Problem: Default LAMINAR_HOME is hardcoded to /var/lib/laminar, requiring manual configuration for custom installations
  • Solution: Use CMAKE_INSTALL_PREFIX to set intelligent default
  • Behavior:
    • Defaults to ${CMAKE_INSTALL_PREFIX}/var (e.g., /opt/laminar/var)
    • Falls back to /var/lib/laminar if not set
    • Enables self-contained installations without extra configuration

3. Log Output Command (laminarc output-log)

  • Problem: No simple way to view logs from command line for scripting/automation
  • Solution: New command to output logs to stdout
  • Usage: laminarc output-log JOB [RUN]
  • Features:
    • Defaults to latest run if RUN not specified
    • Shows header with actual run number
    • Outputs to stdout for piping to grep, less, etc.

Motivation

Command-Line CI/CD Workflows

When running builds from command line (not through web UI):

  • Database-only logs require SQL queries and decompression for access
  • Standard Unix tools (grep, tail, less) cannot be used directly
  • Troubleshooting requires either web UI or manual database extraction

AI Coding Assistant Integration

Modern AI coding assistants (Claude, GitHub Copilot, etc.) work best with:

  • Simple file access patterns
  • Standard command-line tools
  • Direct log output without intermediate processing

This PR makes Laminar logs accessible through standard patterns these tools understand.

Example Usage

Enable on-disk logs (in /etc/laminar.conf):

LAMINAR_ON_DISK_LOGS=4  # Keep 4 most recent logs per job

View logs from command line:

# View latest log
laminarc output-log my-build

# View specific run
laminarc output-log my-build 42

# Use with standard tools
laminarc output-log my-build | grep ERROR
laminarc output-log my-build | less

# Direct file access (if on-disk logs enabled)
grep -r "error" ${LAMINAR_HOME}/archive/my-build/

Custom installation path:

cmake .. -DCMAKE_INSTALL_PREFIX=/opt/laminar
make install
# Now /opt/laminar/var is the default LAMINAR_HOME

Implementation Details

  • Files Modified: 7 files, 87 insertions, 1 deletion
  • Breaking Changes: None - all features are opt-in
  • Performance Impact: Minimal (only when LAMINAR_ON_DISK_LOGS > 0)
  • Tested: Successfully tested with custom /opt/laminar installation

Benefits

✅ Direct log access with standard Unix tools
✅ Better troubleshooting workflow for CI/CD debugging
✅ Easier integration with log analysis tools and AI assistants
✅ More flexible installation options
✅ No breaking changes to existing deployments
✅ Self-contained installations without manual configuration

Related Discussion

This addresses the common need for easier log access in command-line workflows, particularly for:

  • Headless CI/CD servers
  • Remote troubleshooting scenarios
  • Integration with modern development tools
  • Automated log analysis

…tput command

This PR adds three related features that improve troubleshooting and
integration with command-line workflows:

1. On-Disk Log Preservation (LAMINAR_ON_DISK_LOGS)
   - Adds optional uncompressed log files alongside database storage
   - Controlled by LAMINAR_ON_DISK_LOGS=N environment variable
   - Writes logs to ${LAMINAR_HOME}/archive/JOB/RUN/log
   - Keeps N most recent logs per job with automatic rotation
   - Independent of LAMINAR_KEEP_RUNDIRS (for remote build scenarios)
   - Backward compatible (disabled by default when N=0)

2. Configurable Default LAMINAR_HOME
   - Uses CMAKE_INSTALL_PREFIX to set default LAMINAR_HOME
   - Enables self-contained installations (e.g., /opt/laminar)
   - Falls back to /var/lib/laminar if not set
   - Reduces configuration needed for non-standard installations

3. Log Output Command (laminarc output-log)
   - New command: laminarc output-log JOB [RUN]
   - Outputs build logs to stdout for command-line use
   - Defaults to latest run if RUN not specified
   - Shows header with actual run number
   - Enables integration with grep, less, AI coding assistants, etc.

Motivation:
- Database-only logs require SQL queries and decompression for access
- Standard Unix tools (grep, tail, less) cannot be used directly
- AI coding assistants and automated tools need simple log access
- Custom installation paths require manual LAMINAR_HOME configuration

Benefits:
- Direct log access with standard Unix tools
- Better troubleshooting workflow for CI/CD debugging
- Easier integration with log analysis tools and AI assistants
- More flexible installation options
- No breaking changes to existing deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants