# yaml-language-server: $schema=https://schema.zeabur.app/template.json
apiVersion: zeabur.com/v1
kind: Template
metadata:
    name: LangFlow
spec:
    description: Langflow is a new, visual framework for building multi-agent and RAG applications.
    coverImage: https://github.com/langflow-ai/langflow/raw/main/docs/static/img/hero.png
    icon: https://cdn.zeabur.com/langflow.svg
    variables:
        - key: PUBLIC_DOMAIN
          type: DOMAIN
          name: Domain
          description: The domain name of your LangFlow website.
        - key: LANGFLOW_SUPERUSER
          type: STRING
          name: Superuser
          description: The username of your LangFlow superuser.
        - key: LANGFLOW_SUPERUSER_PASSWORD
          type: STRING
          name: Superuser Password
          description: The password of your LangFlow superuser.
    tags:
        - Tool
        - Website
    readme: |-
        ## Description

        Langflow is a low-code app builder for RAG and multi-agent AI applications. It’s Python-based and agnostic to any model, API, or database.

        ## Core features
        - Python-based and agnostic to models, APIs, data sources, or databases.
        - Visual IDE for drag-and-drop building and testing of workflows.
        - Playground to immediately test and iterate workflows with step-by-step control.
        - Multi-agent orchestration and conversation management and retrieval.
        - Free cloud service to get started in minutes with no setup.
        - Publish as an API or export as a Python application.
        - Observability with LangSmith, LangFuse, or LangWatch integration.
        - Enterprise-grade security and scalability with free DataStax Langflow cloud service.
        - Customize workflows or create flows entirely just using Python.
        - Ecosystem integrations as reusable components for any model, API or database.
    services:
        - name: postgresql
          icon: https://cdn.zeabur.com/marketplace/postgresql.svg
          template: PREBUILT
          spec:
            source:
                image: postgres:17
                command:
                    - docker-entrypoint.sh
                    - -c
                    - config_file=/etc/postgresql/postgresql.conf
            ports:
                - id: database
                  port: 5432
                  type: TCP
            volumes:
                - id: data
                  dir: /var/lib/postgresql/data
            instructions:
                - title: Connection String
                  content: postgresql://${POSTGRES_USERNAME}:${POSTGRES_PASSWORD}@${PORT_FORWARDED_HOSTNAME}:${DATABASE_PORT_FORWARDED_PORT}/${POSTGRES_DATABASE}
                - title: PostgreSQL Connect Command
                  content: psql "postgresql://${POSTGRES_USERNAME}:${POSTGRES_PASSWORD}@${PORT_FORWARDED_HOSTNAME}:${DATABASE_PORT_FORWARDED_PORT}/${POSTGRES_DATABASE}"
                - title: PostgreSQL username
                  content: ${POSTGRES_USERNAME}
                - title: PostgresSQL password
                  content: ${POSTGRES_PASSWORD}
                - title: PostgresSQL database
                  content: ${POSTGRES_DATABASE}
                - title: PostgreSQL host
                  content: ${PORT_FORWARDED_HOSTNAME}
                - title: PostgreSQL port
                  content: ${DATABASE_PORT_FORWARDED_PORT}
            env:
                PGDATA:
                    default: /var/lib/postgresql/data/pgdata
                POSTGRES_CONNECTION_STRING:
                    default: postgresql://${POSTGRES_USERNAME}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DATABASE}
                    expose: true
                POSTGRES_DATABASE:
                    default: ${POSTGRES_DB}
                    expose: true
                POSTGRES_DB:
                    default: zeabur
                POSTGRES_HOST:
                    default: ${CONTAINER_HOSTNAME}
                    expose: true
                POSTGRES_PASSWORD:
                    default: ${PASSWORD}
                    expose: true
                POSTGRES_PORT:
                    default: ${DATABASE_PORT}
                    expose: true
                POSTGRES_URI:
                    default: ${POSTGRES_CONNECTION_STRING}
                    expose: true
                POSTGRES_USER:
                    default: root
                POSTGRES_USERNAME:
                    default: ${POSTGRES_USER}
                    expose: true
            configs:
                - path: /etc/postgresql/postgresql.conf
                  template: |
                    # https://github.com/postgres/postgres/blob/master/src/backend/utils/misc/postgresql.conf.sample
                    listen_addresses = '*'
                    max_connections = 100
                    shared_buffers = 128MB
                    dynamic_shared_memory_type = posix
                    max_wal_size = 1GB
                    min_wal_size = 80MB
                    log_timezone = 'Etc/UTC'
                    datestyle = 'iso, mdy'
                    timezone = 'Etc/UTC'
                    lc_messages = 'en_US.utf8'
                    lc_monetary = 'en_US.utf8'
                    lc_numeric = 'en_US.utf8'
                    lc_time = 'en_US.utf8'
                    default_text_search_config = 'pg_catalog.english'
                  permission: null
                  envsubst: null
        - name: LangFlow
          icon: https://cdn.zeabur.com/langflow.svg
          template: PREBUILT
          spec:
            source:
                image: langflowai/langflow:latest
            ports:
                - id: web
                  port: 7860
                  type: HTTP
            instructions:
                - title: Default username
                  content: ${LANGFLOW_SUPERUSER}
                - title: Default password
                  content: ${LANGFLOW_SUPERUSER_PASSWORD}
            env:
                LANGFLOW_AUTO_LOGIN:
                    default: "False"
                LANGFLOW_DATABASE_URL:
                    default: ${POSTGRES_CONNECTION_STRING}
                LANGFLOW_LOG_LEVEL:
                    default: debug
                LANGFLOW_NEW_USER_IS_ACTIVE:
                    default: "False"
                LANGFLOW_SECRET_KEY:
                    default: ${PASSWORD}
                LANGFLOW_SUPERUSER:
                    default: ${USERNAME}
          domainKey: PUBLIC_DOMAIN
