# yaml-language-server: $schema=https://schema.zeabur.app/template.json
apiVersion: zeabur.com/v1
kind: Template
metadata:
    name: Node-RED
spec:
    description: A low-code programming tool for event-driven applications.
    coverImage: https://camo.githubusercontent.com/fd858c2c9103ef598aff5ca1f4c818d912093009a94879b7d4a90e8357f7a421/68747470733a2f2f6e6f64657265642e6f72672f696d616765732f6e6f64652d7265642d73637265656e73686f742e706e67
    icon: https://avatars.githubusercontent.com/u/5375661
    variables:
        - key: PUBLIC_DOMAIN
          type: DOMAIN
          name: Public Domain
          description: Set a public domain for your Node-RED instance.
        - key: TIME_ZONE
          type: STRING
          name: Time Zone
          description: Set the timezone for the container, e.g., Asia/Shanghai. If left blank, the container will default to UTC.
    tags:
        - IoT
        - Automation
        - Low-code
        - Node.js
    readme: |-
        # Node-RED on Zeabur

        This is a one-click deployment template for Node-RED on Zeabur.

        Node-RED is a programming tool for wiring together hardware devices, APIs and online services in new and interesting ways. It provides a browser-based editor that makes it easy to wire together flows using the wide range of nodes in the palette that can be deployed to its runtime in a single-click.

        ## Features
        - Uses the official `nodered/node-red:latest` image.
        - Exposes port `1880` for the web UI.
        - Persists the `/data` directory for user data (flows, node modules, etc.).

        ## Configuration
        - **Public Domain**: Set a domain for HTTPS access.
        - **Time Zone**: Specify a timezone (e.g., `Asia/Shanghai`). If you leave this field blank during deployment, the Node-RED container will default to UTC.

        After deployment, you can access the Node-RED editor via the domain you set (it will be HTTPS if a domain is configured) or the Zeabur-provided URL.
    services:
        - name: node-red
          icon: https://avatars.githubusercontent.com/u/5375661
          template: PREBUILT
          spec:
            id: node-red
            source:
                image: nodered/node-red:latest
            ports:
                - id: web
                  port: 1880
                  type: HTTP
            volumes:
                - id: node-red-data
                  dir: /data
            instructions:
                - title: Accessing Your Node-RED
                  content: You can access your Node-RED instance at https://${PUBLIC_DOMAIN} (if a domain is set) or via the Zeabur-provided URL.
                - title: User Data
                  content: Your Node-RED flows and installed nodes will be persisted in the 'node-red-data' volume.
                - title: Default Credentials
                  content: By default, the Node-RED editor is not password protected. Consider securing your editor in production environments. Refer to the official Node-RED documentation for guidance on securing Node-RED.
            env:
                TZ:
                    default: ${TIME_ZONE}
          domainKey: PUBLIC_DOMAIN
