# yaml-language-server: $schema=https://schema.zeabur.app/template.json
apiVersion: zeabur.com/v1
kind: Template
metadata:
    name: CouchDB
spec:
    description: An open-source document-oriented database
    coverImage: https://noviello.it/content/images/2020/01/couchdb-1.jpg
    icon: https://couchdb.apache.org/image/couch@2x.png
    tags:
        - Database
    readme: |
        ## CouchDB Introduction

        An open-source document-oriented, seamless multi-master syncing database with an intuitive HTTP/JSON API, designed for reliability

        CouchDB is Simmilar to MongoDB, but more lightweight and easier to use.

        ## Why CouchDB?

        Apache CouchDB lets you access your data where you need it. The **Couch Replication Protocol** is implemented in a variety of projects and products that span every imaginable computing environment from **globally distributed server-clusters**, over **mobile phones** to **web browsers**.

        Store your data **safely**, on your own servers, or with any leading cloud provider. Your web- and native applications love CouchDB, because it speaks **JSON natively** and supports **binary data** for all your data storage needs.

        **The Couch Replication Protocol** lets your data flow seamlessly between server clusters to mobile phones and web browsers, enabling a compelling **offline-first** user-experience while maintaining high performance and strong reliability. CouchDB comes with a **developer-friendly** query language, and optionally MapReduce for simple, efficient, and comprehensive data retrieval.

        ## **Comparison of CouchDB and MongoDB**

        Similarities:

        1. Both are No-SQL document-oriented databases that can directly store, aggregate, transform, and return document-type (JSON) data.
        2. Both support highly available distributed cluster deployments.
        3. Both are open-source projects that can either be self-hosted or used with cloud service providers' offerings.

        Main differences:

        1. CouchDB interacts via REST API, whereas MongoDB uses a database connection + its own query language.
        2. CouchDB focuses on availability (A) and partition tolerance (P), whereas MongoDB emphasizes consistency (C) and partition tolerance (P).
        3. CouchDB is an Apache project, and the official version does not offer commercial services; MongoDB provides commercial (MongoDB Enterprise) and cloud services (MongoDB Atlas).
        4. Current trend: MongoDB is more popular compared to CouchDB, and related support services are more robust.

        ## **Related Environment Variables**

        * `COUCHDB_USER`: The initial admin username
        * `COUCHDB_PASSWORD`: The initial admin password

        ## **Service Usage Process**

        When the service is started for the first time, initialization is required. It is recommended to use the built-in Fauxton management panel for configuration.

        ### **English**

        1. Access the built-in CouchDB browser management panel. The address is located in the **Service Status** page under `CouchDB built-in Fauxton admin webpage`. Log in with the initial username and password.
        2. Click the wrench icon on the left to begin initialization.
            1. Configure a Single Node \= Configure as a single-node setup.
            2. Configure a Cluster \= Configure as a cluster setup.
                You need to generate multiple CouchDB services in the project and modify port and password verification configurations.
                See the official documentation for details: [https://docs.couchdb.org/en/stable/setup/cluster.html](https://docs.couchdb.org/en/stable/setup/cluster.html)
        3. Once initialization is complete, you can start using it.

        ## **Managing the Database with the Integrated Fauxton Management Interface**

        Management interface documentation: [https://docs.couchdb.org/en/stable/fauxton/install.html#fauxton-visual-guide](https://docs.couchdb.org/en/stable/fauxton/install.html#fauxton-visual-guide)

        Management panel address: `Fauxton -- CouchDB built-in admin webpage` in the **Service Status** page.

        Log in with the username (`CouchDB username`) and password (`CouchDB password`) . The interface will allow you to manage database data and configurations.

        ## **Accessing the Database via REST API**

        API Documentation: [https://docs.couchdb.org/en/stable/api/index.html](https://docs.couchdb.org/en/stable/api/index.html)

        > The following example shows how to send a GET request to the `/` path. The database should return a welcome message.

        Use tools like `curl` to send HTTP REST requests.

        ```bash
        curl <the address copied above>
        ```

        The response will contain welcome data, including version features, version number, and more.

        ```json
        {
            "couchdb": "Welcome",
            "version": "3.4.2",
            "git_sha": "6e5ad2a5c",
            "uuid": "7687c62cfdf781f4623b721104a70c88",
            "features": [
                "access-ready",
                "partitioned",
                "pluggable-storage-engines",
                "reshard",
                "scheduler"
            ],
            "vendor": {
                "name": "The Apache Software Foundation"
            }
        }
        ```
    services:
        - name: couchdb
          icon: https://couchdb.apache.org/image/couch@2x.png
          template: PREBUILT_V2
          spec:
            source:
                image: couchdb:latest
            ports:
                - id: couchdb
                  port: 5984
                  type: TCP
            volumes:
                - id: couchdb-data
                  dir: /opt/couchdb/data
            instructions:
                - title: CouchDB REST API HTTP Endpoint
                  content: http://${PORT_FORWARDED_HOSTNAME}:${COUCHDB_PORT_FORWARDED_PORT}
                - title: Fauxton -- CouchDB built-in admin webpage
                  content: http://${PORT_FORWARDED_HOSTNAME}:${COUCHDB_PORT_FORWARDED_PORT}/_utils/#
                - title: CouchDB username
                  content: ${COUCHDB_USER}
                - title: CouchDB password
                  content: ${COUCHDB_PASSWORD}
                - title: CouchDB host
                  content: ${PORT_FORWARDED_HOSTNAME}
                - title: CouchDB port
                  content: ${COUCHDB_PORT_FORWARDED_PORT}
            env:
                COUCHDB_PASSWORD:
                    default: ${PASSWORD}
                    expose: true
                COUCHDB_USER:
                    default: admin
                    expose: true
localization:
    en-US:
        description: An open-source, HTTP/JSON request-based document database that supports cross-platform synchronization.
        readme: |
            ## CouchDB Introduction

            An open-source document-oriented, seamless multi-master syncing database with an intuitive HTTP/JSON API, designed for reliability

            CouchDB is Simmilar to MongoDB, but more lightweight and easier to use.

            ## Why CouchDB?

            Apache CouchDB lets you access your data where you need it. The **Couch Replication Protocol** is implemented in a variety of projects and products that span every imaginable computing environment from **globally distributed server-clusters**, over **mobile phones** to **web browsers**.

            Store your data **safely**, on your own servers, or with any leading cloud provider. Your web- and native applications love CouchDB, because it speaks **JSON natively** and supports **binary data** for all your data storage needs.

            **The Couch Replication Protocol** lets your data flow seamlessly between server clusters to mobile phones and web browsers, enabling a compelling **offline-first** user-experience while maintaining high performance and strong reliability. CouchDB comes with a **developer-friendly** query language, and optionally MapReduce for simple, efficient, and comprehensive data retrieval.

            ## **Comparison of CouchDB and MongoDB**

            Similarities:

            1. Both are No-SQL document-oriented databases that can directly store, aggregate, transform, and return document-type (JSON) data.
            2. Both support highly available distributed cluster deployments.
            3. Both are open-source projects that can either be self-hosted or used with cloud service providers' offerings.

            Main differences:

            1. CouchDB interacts via REST API, whereas MongoDB uses a database connection + its own query language.
            2. CouchDB focuses on availability (A) and partition tolerance (P), whereas MongoDB emphasizes consistency (C) and partition tolerance (P).
            3. CouchDB is an Apache project, and the official version does not offer commercial services; MongoDB provides commercial (MongoDB Enterprise) and cloud services (MongoDB Atlas).
            4. Current trend: MongoDB is more popular compared to CouchDB, and related support services are more robust.

            ## **Related Environment Variables**

            * `COUCHDB_USER`: The initial admin username
            * `COUCHDB_PASSWORD`: The initial admin password

            ## **Service Usage Process**

            When the service is started for the first time, initialization is required. It is recommended to use the built-in Fauxton management panel for configuration.

            1. Access the built-in CouchDB browser management panel. The address is located in the **Service Status** page under `CouchDB built-in Fauxton admin webpage`. Log in with the initial username and password.
            2. Click the wrench icon on the left to begin initialization.
                1. Configure a Single Node \= Configure as a single-node setup.
                2. Configure a Cluster \= Configure as a cluster setup.
                    You need to generate multiple CouchDB services in the project and modify port and password verification configurations.
                    See the official documentation for details: [https://docs.couchdb.org/en/stable/setup/cluster.html](https://docs.couchdb.org/en/stable/setup/cluster.html)
            3. Once initialization is complete, you can start using it.

            ## **Managing the Database with the Integrated Fauxton Management Interface**

            Management interface documentation: [https://docs.couchdb.org/en/stable/fauxton/install.html#fauxton-visual-guide](https://docs.couchdb.org/en/stable/fauxton/install.html#fauxton-visual-guide)

            Management panel address: `Fauxton -- CouchDB built-in admin webpage` in the **Service Status** page.

            Log in with the username (`CouchDB username`) and password (`CouchDB password`).

            The interface will allow you to manage database data and configurations.

            ## **Accessing the Database via REST API**

            API Documentation: [https://docs.couchdb.org/en/stable/api/index.html](https://docs.couchdb.org/en/stable/api/index.html)

            > The following example shows how to send a GET request to the `/` path. The database should return a welcome message.

            Use tools like `curl` to send HTTP REST requests.

            ```bash
            curl <the address copied above>
            ```

            The response will contain welcome data, including version features, version number, and more.

            ```json
            {
                "couchdb": "Welcome",
                "version": "3.4.2",
                "git_sha": "6e5ad2a5c",
                "uuid": "7687c62cfdf781f4623b721104a70c88",
                "features": [
                    "access-ready",
                    "partitioned",
                    "pluggable-storage-engines",
                    "reshard",
                    "scheduler"
                ],
                "vendor": {
                    "name": "The Apache Software Foundation"
                }
            }
            ```
    es-ES:
        description: Una base de datos de documentos de código abierto, basada en solicitudes HTTP/JSON y que soporta sincronización multiplataforma.
        readme: |
            ## **Introducción a CouchDB**

            Una base de datos orientada a documentos de código abierto, con sincronización multi-maestro sin interrupciones y una API HTTP/JSON intuitiva, diseñada para ofrecer fiabilidad.

            CouchDB es similar a MongoDB, pero más ligera y fácil de usar.

            ##  **¿Por qué elegir CouchDB?**

            Apache CouchDB te permite acceder a tus datos donde los necesites. El **Couch Replication Protocol** está implementado en una variedad de proyectos y productos que abarcan todos los entornos informáticos imaginables, desde **clusters de servidores distribuidos globalmente**, hasta **teléfonos móviles** y **navegadores web**.

            Almacena tus datos **de forma segura**, ya sea en tus propios servidores o con cualquier proveedor líder de servicios en la nube. A tus aplicaciones web y nativas les encanta CouchDB porque habla **JSON de forma nativa** y soporta **datos binarios** para todas tus necesidades de almacenamiento de datos.

            **El Couch Replication Protocol** permite que tus datos fluyan sin interrupciones entre clusters de servidores, teléfonos móviles y navegadores web, brindando una experiencia de usuario **offline-first** atractiva mientras mantiene un alto rendimiento y una fiabilidad sólida. CouchDB viene con un lenguaje de consulta **amigable para los desarrolladores** y, opcionalmente, MapReduce para una recuperación de datos simple, eficiente y completa.

            ## **Comparación entre CouchDB y MongoDB**

            Similitudes:

            1. Ambos son bases de datos No-SQL orientadas a documentos, capaces de almacenar, agregar, transformar y devolver datos en formato de documento (JSON).
            2. Ambos soportan despliegues de clústeres distribuidos de alta disponibilidad.
            3. Ambos son proyectos de código abierto que pueden ser autohospedados o utilizar los servicios de proveedores de nube.

            Principales diferencias:

            1. CouchDB interactúa a través de la API REST, mientras que MongoDB utiliza una conexión a la base de datos + su propio lenguaje de consultas.
            2. CouchDB se enfoca en la disponibilidad (A) y la tolerancia a particiones (P), mientras que MongoDB enfatiza la consistencia (C) y la tolerancia a particiones (P).
            3. CouchDB es un proyecto de Apache y no ofrece servicios comerciales oficiales; MongoDB ofrece servicios comerciales (MongoDB Enterprise) y servicios en la nube (MongoDB Atlas).
            4. Tendencia actual: MongoDB es más popular que CouchDB, y los servicios de soporte relacionados son más completos.

            ## **Variables de entorno relacionadas**

            * `COUCHDB_USER`: El nombre de usuario del administrador inicial
            * `COUCHDB_PASSWORD`: La contraseña del administrador inicial

            ## **Proceso de uso del servicio**

            Cuando el servicio se inicia por primera vez, se requiere una inicialización. Se recomienda usar el panel de administración Fauxton incorporado en CouchDB para la configuración.

            1. Acceda al panel de administración del navegador integrado de CouchDB. La dirección se encuentra en la página **Estado del servicio** bajo `CouchDB built-in Fauxton admin webpage`. Inicie sesión con el nombre de usuario y la contraseña inicial.
            2. Haga clic en el icono de la llave inglesa en el lado izquierdo para comenzar la inicialización.
                1. Configure a Single Node \= Configurar como modo de nodo único
                2. Configure a Cluster \= Configurar como modo de clúster
                    Es necesario generar varios servicios CouchDB en el proyecto y modificar las configuraciones de puerto y verificación de contraseñas.
                    Consulte la documentación oficial para más detalles: [https://docs.couchdb.org/en/stable/setup/cluster.html](https://docs.couchdb.org/en/stable/setup/cluster.html)
            3. Una vez completada la inicialización, podrá comenzar a usarlo.

            ## **Administración de la base de datos con la interfaz integrada de Fauxton**

            Documentación de la interfaz de administración: [https://docs.couchdb.org/en/stable/fauxton/install.html#fauxton-visual-guide](https://docs.couchdb.org/en/stable/fauxton/install.html#fauxton-visual-guide)

            Dirección del panel de administración: `Fauxton -- CouchDB built-in admin webpage` en la página **Estado del servicio**.

            Inicie sesión con el nombre de usuario (`CouchDB username`) y la contraseña (`CouchDB password`) a continuación.

            La interfaz en su navegador se verá como la siguiente, permitiéndole gestionar los datos y la configuración de la base de datos.

            ## **Acceso a la base de datos mediante REST API**

            Documentación de la API: [https://docs.couchdb.org/en/stable/api/index.html](https://docs.couchdb.org/en/stable/api/index.html)

            > El siguiente ejemplo muestra cómo enviar una solicitud GET al camino `/`. La base de datos debe devolver un mensaje de bienvenida.

            Utilice herramientas como `curl` para enviar solicitudes HTTP REST.

            ```bash
            curl <la dirección copiada arriba>
            ```

            La respuesta contendrá datos de bienvenida, incluyendo características de versión, versión y más.

            ```json
            {
                "couchdb": "Welcome",
                "version": "3.4.2",
                "git_sha": "6e5ad2a5c",
                "uuid": "7687c62cfdf781f4623b721104a70c88",
                "features": [
                    "access-ready",
                    "partitioned",
                    "pluggable-storage-engines",
                    "reshard",
                    "scheduler"
                ],
                "vendor": {
                    "name": "The Apache Software Foundation"
                }
            }
            ```
    ja-JP:
        description: HTTP/JSON リクエストに基づく、クロスプラットフォーム同期をサポートするオープンソースのドキュメントデータベース
        readme: |
            ## **CouchDBの紹介**

            オープンソースのドキュメント指向データベースで、シームレスなマルチマスター同期をサポートし、直感的なHTTP/JSON APIを提供し、信頼性を重視して設計されています。

            CouchDBはMongoDBに似ていますが、より軽量で使いやすいです。

            ## **なぜCouchDBなのか？**

            Apache CouchDBは、必要な場所でデータにアクセスできます。**Couch Replication Protocol**は、**グローバルに分散したサーバークラスター**、**モバイル電話**、**ウェブブラウザ**など、あらゆる計算環境にわたるさまざまなプロジェクトや製品で実装されています。

            自分のサーバーや、主要なクラウドプロバイダーでデータを**安全に**保存できます。あなたのウェブアプリケーションやネイティブアプリケーションはCouchDBを愛しています。なぜなら、それは**JSONをネイティブにサポート**し、すべてのデータストレージニーズに対応する**バイナリデータ**をサポートしているからです。

            **Couch Replication Protocol**により、データはサーバークラスター間でシームレスに流れ、モバイル電話やウェブブラウザにも同期され、**オフラインファースト**なユーザーエクスペリエンスを提供しながら、高いパフォーマンスと強力な信頼性を維持します。CouchDBは**開発者フレンドリーな**クエリ言語と、オプションでMapReduceを提供し、シンプルで効率的なデータ取得をサポートします。

            ## **CouchDB と MongoDB の比較**

            共通点：

            1. 両方は No-SQL のドキュメント指向データベースで、ドキュメントタイプ（JSON）データを直接保存、集約、変換、返却できます。
            2. 両者とも、高可用性の分散クラスタ展開をサポートします。
            3. 両方はオープンソースプロジェクトで、自己ホスティングまたはクラウドサービスプロバイダーのサービスを購入して利用できます。

            主な違い：

            1. CouchDB は REST API を介してやり取りしますが、MongoDB はデータベース接続 + 独自のクエリ言語を使用します。
            2. CouchDB は可用性（A）と分割耐性（P）に重点を置いており、MongoDB は整合性（C）と分割耐性（P）に重点を置いています。
            3. CouchDB は Apache プロジェクトで、公式には商業サービスを提供していません。MongoDB は商業サービス（MongoDB Enterprise）とクラウドサービス（MongoDB Atlas）を提供しています。
            4. 現在のトレンド：MongoDB は CouchDB よりも人気があり、関連するサポートサービスがより充実しています。

            ## **関連環境変数**

            * `COUCHDB_USER`: 初期の管理者ユーザー名
            * `COUCHDB_PASSWORD`: 初期の管理者パスワード

            ## **サービス使用フロー**

            サービスを初めて起動する際、初期化が必要です。CouchDB に組み込まれている Fauxton 管理パネルを使用して構成することをお勧めします。

            1. CouchDB に組み込まれたブラウザ管理パネルにアクセスします。アドレスは【サービス状態】ページの `CouchDB built-in Fauxton admin webpage` にあります。初期のユーザー名とパスワードでログインします。
            2. 左側の【スパナ】アイコンをクリックして、初期化を開始します。
                1. Configure a Single Node \= 単一ノードモードとして設定
                2. Configure a Cluster \= クラスターモードとして設定
                    プロジェクト内で複数の CouchDB サービスを生成し、ポートとパスワード認証設定を変更する必要があります。
                    詳細については公式ドキュメントを参照してください：[https://docs.couchdb.org/en/stable/setup/cluster.html](https://docs.couchdb.org/en/stable/setup/cluster.html)
            3. 初期化が完了したら、使用を開始できます。

            ## **統合された Fauxton 管理インターフェースを使用してデータベースを管理**

            管理インターフェースのドキュメント：[https://docs.couchdb.org/en/stable/fauxton/install.html#fauxton-visual-guide](https://docs.couchdb.org/en/stable/fauxton/install.html#fauxton-visual-guide)

            管理パネルのアドレス：【サービス状態】ページの `Fauxton -- CouchDB built-in admin webpage`

            下記のユーザー名（`CouchDB username`）とパスワード（`CouchDB password`）でログインします。

            ブラウザで以下のようなインターフェースが表示され、データベースのデータと設定を管理できます。

            ## **REST API を使用してデータベースにアクセスする**

            API ドキュメント：[https://docs.couchdb.org/en/stable/api/index.html](https://docs.couchdb.org/en/stable/api/index.html)

            > 以下の例では、`/` パスへの GET リクエストを送信します。データベースは歓迎メッセージを返すべきです。

            `curl` などのツールを使用して HTTP REST リクエストを送信します。

            ```bash
            curl <上記でコピーしたアドレス>
            ```

            レスポンスは、バージョン機能やバージョン情報などを含む歓迎データを返します。

            ```json
            {
                "couchdb": "Welcome",
                "version": "3.4.2",
                "git_sha": "6e5ad2a5c",
                "uuid": "7687c62cfdf781f4623b721104a70c88",
                "features": [
                    "access-ready",
                    "partitioned",
                    "pluggable-storage-engines",
                    "reshard",
                    "scheduler"
                ],
                "vendor": {
                    "name": "The Apache Software Foundation"
                }
            }
            ```
    zh-CN:
        description: 一个开源的、基于HTTP/JSON请求、支持跨平台同步的文档数据库
        readme: |
            ## CouchDB 简介

            一个开源的面向文档的无缝多主同步数据库，具有直观的 HTTP/JSON API，专为可靠性设计。

            类似于 MongoDB，但更轻量化且易于使用。

            ## 为什么选择 CouchDB

            Apache CouchD 让您能够在任何需要的地方访问您的数据。Couch Replication Protocol 协议被应用于 CouchDB 的各种项目和产品中，覆盖了从全球分布式服务器集群，到移动电话，再到网页浏览器的所有可想象的计算环境。

            您可以在自己的服务器上安全存储您的数据，或使用任意云服务提供商基于 CouchDB 提供的云服务。您的 Web 和原生应用程序都会喜爱 CouchDB，因为它文档数据库的特性原生支持 JSON，并支持各种数据的二进制形式存储。

            Couch Replication Protocol 协议使您的数据在服务器集群、手机和网页浏览器之间无缝流动，在保持高性能和强可靠性的同时，提供强大的离线可用和自恢复功能。CouchDB 提供了开发者友好的查询语言，使用直观的 REST/JSON API，并可选 MapReduce 以实现简单、高效和全面的数据检索。

            ## CouchDB 与 MongoDB 对比

            两者相同点：

            1. 都是 No-SQL 的文档型数据库，可直接存储、聚合、转换、返回文档类型（JSON）数据
            2. 都支持高可用的分布式集群部署
            3. 两者都是开源项目，可以自托管或购买云服务商的服务

            在区别主要在以下方面：

            1. CouchDB 通过 REST API 进行交互，而 MongoDB 通过数据库连接 + 特色的查询语言。
            2. CouchDB 侧重可用性（A）和分区容错性（P），MongoDB 侧重一致性（C）和分区容错性（P）
            3. CouchDB 是 Apache 项目，官方不提供商业服务；MongoDB 官方可提供商业（MongoDB Enterprise）及云服务（MongoDB Atlas 服务）
            4. 目前趋势：MongoDB 相较于 CouchDB 更流行，相关支持服务会更到位

            ## 相关环境变量

            * `COUCHDB_USER`：初始的管理员用户名
            * `COUCHDB_PASSWORD`：初始的管理员用户密码

            ## 服务使用流程

            服务首次启动时，需要进行初始化，建议使用 CouchDB 自带的 Fauxton 管理面板进行配置

            1. 进入 CouchDB 自带的浏览器管理面板。地址在【服务状态】页面中的`CouchDB built-in Fauxton admin webpage`，使用初始用户名和密码登录管理面板
            2. 点击左侧【扳手】图标，开始初始化
                1. Configure a Single Node = 配置为单节点模式
                2. Configure a Cluster = 配置为集群模式
                    需要事先在项目中生成多个 CouchDB 服务，并修改端口和密码校验配置
                    详见官方文档：[https://docs.couchdb.org/en/stable/setup/cluster.html](https://docs.couchdb.org/en/stable/setup/cluster.html)
            3. 初始化完成，即可使用


            ## 使用集成的 Fauxton 管理界面管理数据库

            管理界面文档：[https://docs.couchdb.org/en/stable/fauxton/install.html#fauxton-visual-guide](https://docs.couchdb.org/en/stable/fauxton/install.html#fauxton-visual-guide)

            管理面板地址：【服务状态】页面中的`Fauxton -- CouchDB built-in admin webpage`

            使用服务状态界面的的用户名（`CouchDB username`）和密码（`CouchDB password`）登录

            在浏览器中打开界面如下，可对管理数据库的数据、配置

            ## 使用 REST API 访问数据库

            API 文档：[https://docs.couchdb.org/en/stable/api/index.html](https://docs.couchdb.org/en/stable/api/index.html)

            > 以下示例访问 `/` 路径为例，向数据库发送 GET 请求，数据库应返回欢迎信息

            使用 `curl` 等接口工具发送 HTTP REST 请求

            ```bash
            curl <上面复制的地址>
            ```

            返回欢迎数据，包含版本功能、版本等信息

            ```json
            {
                "couchdb": "Welcome",
                "version": "3.4.2",
                "git_sha": "6e5ad2a5c",
                "uuid": "7687c62cfdf781f4623b721104a70c88",
                "features": [
                    "access-ready",
                    "partitioned",
                    "pluggable-storage-engines",
                    "reshard",
                    "scheduler"
                ],
                "vendor": {
                    "name": "The Apache Software Foundation"
                }
            }
            ```
    zh-TW:
        description: 一個開源的、基於 HTTP/JSON 請求、支持跨平台同步的文檔資料庫
        readme: |
            ## **CouchDB 简介**

            一個開源的面向文檔的無縫多主同步資料庫，具有直觀的 HTTP/JSON API，專為可靠性設計。

            類似於 MongoDB，但更輕量化且易於使用。

            ## **為何選擇 CouchDB**

            Apache CouchDB 讓您能夠在任何需要的地方訪問您的數據。Couch Replication Protocol 協議被應用於 CouchDB 的各種專案和產品中，覆蓋了從全球分佈式伺服器集群，到手機，再到網頁瀏覽器的所有可想像的計算環境。

            您可以在自己的伺服器上安全儲存您的數據，或使用任意雲服務提供商基於 CouchDB 提供的雲服務。您的 Web 和原生應用程序都會喜愛 CouchDB，因為它文檔資料庫的特性原生支持 JSON，並支持各種數據的二進制形式儲存。

            Couch Replication Protocol 協議使您的數據在伺服器集群、手機和網頁瀏覽器之間無縫流動，在保持高性能和強可靠性的同時，提供強大的離線可用和自恢復功能。CouchDB 提供了開發者友好的查詢語言，使用直觀的 REST/JSON API，並可選 MapReduce 以實現簡單、高效和全面的數據檢索。

            ## **CouchDB 與 MongoDB 比較**

            兩者相同點：

            1. 都是 No-SQL 的文檔型資料庫，可直接儲存、聚合、轉換、返回文檔類型（JSON）資料
            2. 都支持高可用的分布式集群部署
            3. 兩者都是開源專案，可以自託管或購買雲服務商的服務

            在區別主要在以下方面：

            1. CouchDB 透過 REST API 進行互動，而 MongoDB 透過資料庫連接 + 特色的查詢語言。
            2. CouchDB 偏重於可用性（A）和分區容錯性（P），MongoDB 偏重於一致性（C）和分區容錯性（P）。
            3. CouchDB 是 Apache 專案，官方不提供商業服務；MongoDB 官方可提供商業（MongoDB Enterprise）及雲服務（MongoDB Atlas 服務）。
            4. 目前趨勢：MongoDB 相較於 CouchDB 更流行，相關支援服務會更到位。

            ## **相關環境變數**

            * `COUCHDB_USER`：初始的管理員用戶名稱
            * `COUCHDB_PASSWORD`：初始的管理員用戶密碼

            ## **服務使用流程**

            服務首次啟動時，需要進行初始化，建議使用 CouchDB 自帶的 Fauxton 管理面板進行配置

            1. 進入 CouchDB 自帶的瀏覽器管理面板。地址在【服務狀態】頁面中的 `CouchDB built-in Fauxton admin webpage`，使用初始用戶名和密碼登錄管理面板
            2. 點擊左側【扳手】圖標，開始初始化
                1. Configure a Single Node \= 配置為單節點模式
                2. Configure a Cluster \= 配置為集群模式
                    需要事先在項目中生成多個 CouchDB 服務，並修改端口和密碼校驗配置
                    詳見官方文檔：[https://docs.couchdb.org/en/stable/setup/cluster.html](https://docs.couchdb.org/en/stable/setup/cluster.html)
            3. 初始化完成，即可使用

            ## **使用集成的 Fauxton 管理界面管理資料庫**

            管理界面文檔：[https://docs.couchdb.org/en/stable/fauxton/install.html#fauxton-visual-guide](https://docs.couchdb.org/en/stable/fauxton/install.html#fauxton-visual-guide)

            管理面板地址：【服務狀態】頁面中的 `Fauxton -- CouchDB built-in admin webpage`

            使用下方的用戶名（`CouchDB username`）和密碼（`CouchDB password`）登錄

            在瀏覽器中打開界面如下，可對管理資料庫的數據、配置

            ## **使用 REST API 訪問資料庫**

            API 文檔：[https://docs.couchdb.org/en/stable/api/index.html](https://docs.couchdb.org/en/stable/api/index.html)

            > 以下示例訪問 `/` 路徑為例，向資料庫發送 GET 請求，資料庫應返回歡迎信息

            使用 `curl` 等接口工具發送 HTTP REST 請求

            ```bash
            curl <上面複製的地址>
            ```

            返回歡迎數據，包含版本功能、版本等信息

            ```json
            {
                "couchdb": "Welcome",
                "version": "3.4.2",
                "git_sha": "6e5ad2a5c",
                "uuid": "7687c62cfdf781f4623b721104a70c88",
                "features": [
                    "access-ready",
                    "partitioned",
                    "pluggable-storage-engines",
                    "reshard",
                    "scheduler"
                ],
                "vendor": {
                    "name": "The Apache Software Foundation"
                }
            }
            ```
