xcad 6 mesi fa
parent
commit
9ac05fd8f4

+ 3 - 1
cli/core/display/__init__.py

@@ -50,7 +50,9 @@ class DisplayManager:
         # Create specialized display components
         self.status = StatusDisplay(self.settings, quiet, self.base)
         self.variables = VariableDisplay(self.settings, self.base)
-        self.templates = TemplateDisplay(self.settings, self.base, self.variables)
+        self.templates = TemplateDisplay(
+            self.settings, self.base, self.variables, self.status
+        )
         self.tables = TableDisplay(self.settings, self.base)
 
     # ===== Delegate to base display =====

+ 45 - 1
cli/core/display/display_status.py

@@ -3,7 +3,10 @@ from __future__ import annotations
 import logging
 from typing import TYPE_CHECKING
 
-from rich.console import Console
+from rich import box
+from rich.console import Console, ConsoleOptions, RenderResult
+from rich.markdown import Heading, Markdown
+from rich.panel import Panel
 
 from .display_icons import IconManager
 from .display_settings import DisplaySettings
@@ -15,6 +18,37 @@ logger = logging.getLogger(__name__)
 console_err = Console(stderr=True)  # Keep for error output
 
 
+class LeftAlignedHeading(Heading):
+    """Custom Heading element with left alignment and no extra spacing."""
+
+    def __rich_console__(
+        self, console: Console, options: ConsoleOptions
+    ) -> RenderResult:
+        text = self.text
+        text.justify = "left"  # Override center justification
+        if self.tag == "h1":
+            # Draw a border around h1s (left-aligned)
+            yield Panel(
+                text,
+                box=box.HEAVY,
+                style="markdown.h1.border",
+            )
+        else:
+            # Styled text for h2 and beyond (no blank line before h2)
+            yield text
+
+
+class LeftAlignedMarkdown(Markdown):
+    """Custom Markdown renderer with left-aligned headings."""
+
+    def __init__(self, markup: str, **kwargs):
+        """Initialize with custom heading element."""
+        super().__init__(markup, **kwargs)
+
+        # Replace heading element to use left alignment
+        self.elements["heading_open"] = LeftAlignedHeading
+
+
 class StatusDisplay:
     """Status messages and error display.
 
@@ -140,3 +174,13 @@ class StatusDisplay:
             self.base.text(f"\n{icon} {message} (skipped - {reason})", style="dim")
         else:
             self.base.text(f"\n{icon} {message} (skipped)", style="dim")
+
+    def markdown(self, content: str) -> None:
+        """Render markdown content with left-aligned headings.
+
+        Args:
+            content: Markdown-formatted text to render
+        """
+        if not self.quiet:
+            console = Console()
+            console.print(LeftAlignedMarkdown(content))

+ 6 - 1
cli/core/display/display_template.py

@@ -9,6 +9,7 @@ from .display_settings import DisplaySettings
 if TYPE_CHECKING:
     from ..template import Template
     from .display_base import BaseDisplay
+    from .display_status import StatusDisplay
     from .display_variable import VariableDisplay
 
 
@@ -24,6 +25,7 @@ class TemplateDisplay:
         settings: DisplaySettings,
         base: BaseDisplay,
         variables: VariableDisplay,
+        status: StatusDisplay,
     ):
         """Initialize TemplateDisplay.
 
@@ -31,10 +33,12 @@ class TemplateDisplay:
             settings: Display settings for formatting
             base: BaseDisplay instance
             variables: VariableDisplay instance for rendering variables
+            status: StatusDisplay instance for markdown rendering
         """
         self.settings = settings
         self.base = base
         self.variables = variables
+        self.status = status
 
     def render_template(self, template: Template, template_id: str) -> None:
         """Display template information panel and variables table.
@@ -82,7 +86,8 @@ class TemplateDisplay:
             f"{template_name} ({template_id} - [cyan]{version}[/cyan] - [magenta]schema {schema}[/magenta]) {library_display}",
             style=settings.STYLE_HEADER,
         )
-        self.base.text(description)
+        self.base.text("")
+        self.status.markdown(description)
 
     def render_file_tree(self, template: Template) -> None:
         """Display the file structure of a template.

+ 4 - 3
cli/core/module/base_commands.py

@@ -555,16 +555,17 @@ def generate_template(
             write_generated_files(output_dir, rendered_files, quiet, display)
 
         # Display next steps (not in quiet mode)
-        if template.metadata.next_steps and not quiet:
+        if template.metadata.next_steps and not quiet and not dry_run:
+            display.text("")
             display.heading("Next Steps")
             try:
                 next_steps_template = Jinja2Template(template.metadata.next_steps)
                 rendered_next_steps = next_steps_template.render(variable_values)
-                display.text(rendered_next_steps)
+                display.status.markdown(rendered_next_steps)
             except Exception as e:
                 logger.warning(f"Failed to render next_steps as template: {e}")
                 # Fallback to plain text if rendering fails
-                display.text(template.metadata.next_steps)
+                display.status.markdown(template.metadata.next_steps)
 
     except TemplateRenderError as e:
         display.error(str(e), context=f"template '{id}'")

+ 17 - 24
library/compose/n8n-server/template.yaml

@@ -3,38 +3,29 @@ kind: compose
 schema: "1.1"
 metadata:
   name: N8N Server
-  description: >
+  description: |
     N8n is a free and source-available workflow automation tool. It enables you to connect
     various apps and services to automate repetitive tasks without coding.
     With its user-friendly interface, you can create complex workflows by simply dragging
     and dropping nodes that represent different actions and triggers.
 
-
     This template provides the n8n server component with optional queue mode support.
     For scaled deployments, combine with the n8n-worker template.
 
-
-    **Queue Mode Benefits:**
-
-    - **Scalability**: Distribute workflow execution across multiple workers
-
-    - **Reliability**: Jobs are persisted in Redis, survive server restarts
-
-    - **Performance**: Separate web UI from workflow execution
-
-
-    **Deployment Options:**
-
-    - **Single Instance**: Enable queue mode with embedded worker (testing/small workloads)
-
-    - **Production**: Use external Redis + separate n8n-worker instances for true scaling
-
-
-    Project: https://n8n.io/
-
-    Documentation: https://docs.n8n.io/
-
-    GitHub: https://github.com/n8n-io/n8n
+    ## Database Backend
+    By default, n8n uses SQLite as its database, which is suitable for small-scale or
+    personal use. For production environments, it is recommended to use an external
+    database like PostgreSQL or MySQL for better performance and reliability. This is also
+    required when using Queue Mode.
+    ## Queue Mode
+    Queue mode allows n8n to handle a large number of workflows and tasks efficiently, by using
+    multiple Workers, and Redis as the queue backend. This is essential for high-availability
+    setups where multiple n8n instances work together. It also supports Queue Monitoring
+    (when Prometheus metrics are enabled).
+    ## Resources
+    - **Project**: https://n8n.io/
+    - **Documentation**: https://docs.n8n.io/
+    - **GitHub**: https://github.com/n8n-io/n8n
   version: 1.118.1
   author: Christian Lempa
   date: '2025-11-02'
@@ -71,6 +62,8 @@ spec:
   queue:
     title: "Queue Mode"
     description: "Enable queue mode with Redis for scaled deployments"
+    toggle: queue_enabled
+    needs: "database_enabled=true"
     vars:
       queue_enabled:
         type: bool

+ 28 - 12
library/compose/openwebui/template.yaml

@@ -2,18 +2,34 @@
 kind: compose
 metadata:
   name: Openwebui
-  description: >
-    OpenWebUI is an open-source web-based user interface for managing and interacting with AI models.
-    It provides a user-friendly platform to deploy, monitor, and utilize various AI models for tasks such as
-    image generation, text generation, and more. OpenWebUI supports integration with popular AI frameworks
-    and offers features like model management, user authentication, and real-time interaction.
-
-
-    Project: https://openwebui.io/
-
-    Documentation: https://docs.openwebui.io/
-
-    GitHub: https://github.com/openwebui/openwebui
+  description: |
+    # OpenWebUI
+    An **open-source web-based user interface** for managing and interacting with AI models.
+    ## Features
+    - User-friendly platform to deploy and monitor AI models
+    - Image generation and text generation support
+    - Integration with popular AI frameworks
+    - Model management and user authentication
+    - Real-time interaction
+    ## Resources
+    - **Project**: https://openwebui.io/
+    - **Documentation**: https://docs.openwebui.io/
+    - **GitHub**: https://github.com/openwebui/openwebui
+  next_steps: |
+    ## Post-Installation Steps
+    1. **Review the generated files**:
+       - Check `docker-compose.yml` for service configuration
+       - Verify environment variables in `.env`
+    2. **Start the service**:
+       ```bash
+       docker compose up -d
+       ```
+    3. **Access OpenWebUI**:
+       - Open your browser and navigate to the configured host
+       - Complete the initial setup wizard
+    4. **Configure AI models**:
+       - Add your AI model endpoints in the admin panel
+       - Set up user authentication if needed
   version: 0.6.33
   author: Christian Lempa
   date: '2025-10-08'

+ 27 - 10
library/compose/whoami/template.yaml

@@ -3,16 +3,33 @@ kind: compose
 schema: "1.1"
 metadata:
   name: Whoami
-  description: >
-    Whoami is a simple web application that displays information about the HTTP request it receives.
-    It is often used for testing and debugging purposes to verify that a web server or reverse proxy is functioning correctly.
-
-
-    Project: https://github.com/traefik/whoami
-
-    Documentation: https://traefik.io/docs/
-
-    GitHub: https://github.com/traefik/whoami
+  description: |
+    A **simple web application** that displays information about the HTTP request it receives.
+    ## Use Cases
+    - Testing reverse proxy configurations
+    - Debugging web server setups
+    - Verifying load balancer functionality
+    - Quick HTTP endpoint testing
+    ## Resources
+    - **Project**: https://github.com/traefik/whoami
+    - **Documentation**: https://traefik.io/docs/
+    - **GitHub**: https://github.com/traefik/whoami
+  next_steps: |
+    ## Post-Installation Steps
+    1. **Start the service**:
+       ```bash
+       docker compose up -d
+       ```
+    2. **Verify the service is running**:
+       ```bash
+       docker compose ps
+       ```
+    3. **Test the endpoint**:
+       - Visit the configured host in your browser
+       - Or use curl: `curl http://{{ traefik_host }}`
+    4. **Check Traefik dashboard** (if enabled):
+       - Verify the route is registered correctly
+       - Check middleware configuration
   version: 1.11.0
   author: Christian Lempa
   date: '2025-10-30'

+ 1 - 1
library/terraform/twingate-connector/template.yaml

@@ -4,7 +4,7 @@ schema: "1.0"
 metadata:
   name: Twingate Connector
   description: >
-    Twingate Connector deployment using Terraform. The Connector establishes secure connections between your 
+    Twingate Connector deployment using Terraform. The Connector establishes secure connections between your
     private network and Twingate service, enabling zero-trust network access.