# yaml-language-server: $schema=https://schema.zeabur.app/template.json
apiVersion: zeabur.com/v1
kind: Template
metadata:
    name: Clickhouse
spec:
    description: An open-source column-oriented database management system that allows generating analytical data reports in real-time.
    coverImage: https://clickhouse.com/images/social_share.png
    icon: https://avatars.githubusercontent.com/u/54801242
    tags:
        - Database
        - OLAP
        - Clickhouse
        - Column-oriented
        - Analytics
    readme: "Clickhouse is an open-source column-oriented database management system that allows generating analytical data reports in real-time using SQL queries. It is capable of processing hundreds of millions to more than a billion rows and tens of gigabytes of data per single server per second. \n\n### Features\n\n- **Column-oriented storage**: Clickhouse stores data in columns rather than rows, which allows it to read only the necessary columns when executing a query. This results in faster query execution times.\n- **Real-time data analysis**: Clickhouse is designed to process analytical queries on large volumes of data in real-time. It can handle hundreds of millions to more than a billion rows and tens of gigabytes of data per single server per second.\n- **SQL support**: Clickhouse supports SQL queries, which makes it easy to use for developers and data analysts.\n"
    services:
        - name: clickhouse
          icon: https://avatars.githubusercontent.com/u/54801242
          template: PREBUILT
          spec:
            source:
                image: clickhouse/clickhouse-server:24-alpine
            ports:
                - id: http
                  port: 8123
                  type: HTTP
                - id: native
                  port: 9000
                  type: TCP
            volumes:
                - id: data
                  dir: /var/lib/clickhouse
            instructions:
                - title: Clickhouse HTTP interface URL
                  content: ${ZEABUR_HTTP_URL}
                - title: Clickhouse username
                  content: ${CLICKHOUSE_USER}
                - title: Clickhouse password
                  content: ${CLICKHOUSE_PASSWORD}
                - title: Clickhouse database
                  content: ${CLICKHOUSE_DB}
            env:
                CLICKHOUSE_DB:
                    default: zeabur
                    expose: true
                CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT:
                    default: "1"
                CLICKHOUSE_PASSWORD:
                    default: ${PASSWORD}
                    expose: true
                CLICKHOUSE_USER:
                    default: zeabur
                    expose: true
                PORT:
                    default: "8123"
            configs:
                - path: /etc/clickhouse-server/config.d/docker_related_config.xml
                  template: |-
                    <clickhouse>
                         <!-- Listen wildcard address to allow accepting connections from other containers and host network. -->
                        <listen_host>::</listen_host>
                        <listen_host>0.0.0.0</listen_host>
                        <listen_try>1</listen_try>

                        <logger>
                            <level>information</level>
                            <console>1</console>
                        </logger>
                    </clickhouse>
                  permission: null
                  envsubst: null
