# yaml-language-server: $schema=https://schema.zeabur.app/template.json
apiVersion: zeabur.com/v1
kind: Template
metadata:
    name: MariaDB
spec:
    description: A community-developed, commercially supported fork of the MySQL relational database management system.
    coverImage: https://mariadb.com/wp-content/uploads/2018/10/mariadb-social-share.jpg
    icon: https://cdn.zeabur.com/mariadb.svg
    tags:
        - Database
    readme: |
        # MariaDB

        MariaDB is a community-developed, commercially supported fork of the MySQL relational database management system. It is designed as a drop-in replacement for MySQL with more features, new storage engines, fewer bugs, and better performance.

        ## Features

        - Compatibility with MySQL
        - Improved performance
        - Additional storage engines
        - Galera cluster technology
        - Advanced replication features
        - Enhanced security options

        For more information, visit [MariaDB.org](https://mariadb.org/).

        ## Credentials

        You can retrieve the credential of MariaDB with the following environment variables:

        - `${MARIADB_USERNAME}`: The username of this MariaDB instance.
        - `${MARIADB_PASSWORD}`: The password of this MariaDB instance.
        - `${MARIADB_DATABASE}`: The database name of this MariaDB instance.
        - `${MARIADB_HOST}`: The hostname of this MariaDB instance.
        - `${MARIADB_PORT}`: The port of this MariaDB instance.

        ## Restoring the Backup

        Zeabur offers an automatic backup feature for MariaDB. However, you must restore the backup manually. Follow the steps below to restore your backup:

        1. Download and extract the backup file from the storage. You will find a data.sql file.
        2. Locate the "Command to connect to your MariaDB" in the "Instructions" section of your MariaDB service.
        3. Ensure you have installed the [MariaDB command tools](https://mariadb.com/downloads/) on your machine. Then, run:

          ```bash
          <Command to connect to your MariaDB> < data.sql
          ```
    services:
        - name: mariadb
          icon: https://cdn.zeabur.com/mariadb.svg
          template: PREBUILT
          spec:
            source:
                image: mariadb:12
            ports:
                - id: database
                  port: 3306
                  type: TCP
            volumes:
                - id: data
                  dir: /var/lib/mysql
            instructions:
                - title: Command to connect to your MariaDB
                  content: mariadb --host ${PORT_FORWARDED_HOSTNAME} --port=${DATABASE_PORT_FORWARDED_PORT} --user=${MARIADB_USERNAME} --password=${MARIADB_PASSWORD} --database=${MARIADB_DATABASE}
                - title: MariaDB username
                  content: ${MARIADB_USERNAME}
                - title: MariaDB password
                  content: ${MARIADB_PASSWORD}
                - title: MariaDB database
                  content: ${MARIADB_DATABASE}
                - title: MariaDB host
                  content: ${PORT_FORWARDED_HOSTNAME}
                - title: MariaDB port
                  content: ${DATABASE_PORT_FORWARDED_PORT}
            env:
                MARIADB_DATABASE:
                    default: zeabur
                    expose: true
                MARIADB_HOST:
                    default: ${CONTAINER_HOSTNAME}
                    expose: true
                MARIADB_PASSWORD:
                    default: ${PASSWORD}
                    expose: true
                MARIADB_PORT:
                    default: ${DATABASE_PORT}
                    expose: true
                MARIADB_ROOT_PASSWORD:
                    default: ${PASSWORD}
                MARIADB_USERNAME:
                    default: root
                    expose: true
            configs:
                - path: /etc/mysql/conf.d/99-custom.cnf
                  template: |
                    ; see https://mariadb.com/kb/en/server-system-variables/#setting-server-system-variables for configuration
                  permission: null
                  envsubst: null
localization:
    ja-JP:
        description: MariaDB は、MySQL リレーショナルデータベース管理システムのコミュニティ開発された商用サポート付きフォークです。
        readme: |
            # MariaDB

            MariaDB は、MySQL リレーショナルデータベース管理システムのコミュニティ開発された商用サポート付きフォークです。MySQL の代替として設計され、より多くの機能、新しいストレージエンジン、より少ないバグ、そしてより良いパフォーマンスを提供します。

            ## 特徴

            - MySQL との互換性
            - パフォーマンスの向上
            - 追加のストレージエンジン
            - Galera クラスター技術
            - 高度なレプリケーション機能
            - 強化されたセキュリティオプション

            詳細については、[MariaDB.org](https://mariadb.org/) をご覧ください。

            ## 認証情報

            次の環境変数を使用して、MariaDB の認証情報を取得できます：

            - `${MARIADB_USERNAME}`: この MariaDB インスタンスのユーザー名。
            - `${MARIADB_PASSWORD}`: この MariaDB インスタンスのパスワード。
            - `${MARIADB_DATABASE}`: この MariaDB インスタンスのデータベース名。
            - `${MARIADB_HOST}`: この MariaDB インスタンスのホスト名。
            - `${MARIADB_PORT}`: この MariaDB インスタンスのポート。

            ## バックアップの復元

            Zeabur は MariaDB の自動バックアップ機能を提供しています。ただし、バックアップの復元は手動で行う必要があります。以下の手順でバックアップを復元してください：

            1. ストレージからバックアップファイルをダウンロードして展開します。data.sql ファイルが見つかります。
            2. MariaDB サービスの「Instructions」セクションで「Command to connect to your MariaDB」を探します。
            3. マシンに [MariaDB command tools](https://mariadb.com/downloads/) がインストールされていることを確認し、次のコマンドを実行します：

              ```bash
              <Command to connect to your MariaDB> < data.sql
              ```
    zh-CN:
        description: MariaDB 是 MySQL 关系数据库管理系统的一个社区开发的、商业支持的分支。
        readme: |
            # MariaDB

            MariaDB 是 MySQL 关系数据库管理系统的一个社区开发的、商业支持的分支。它被设计为 MySQL 的直接替代品，具有更多功能、新的存储引擎、更少的 bug 和更好的性能。

            ## 特性

            - 与 MySQL 兼容
            - 性能改进
            - 额外的存储引擎
            - Galera 集群技术
            - 高级复制功能
            - 增强的安全选项

            欲了解更多信息，请访问 [MariaDB.org](https://mariadb.org/)。

            ## 凭证

            您可以通过以下环境变量检索 MariaDB 的凭证：

            - `${MARIADB_USERNAME}`：此 MariaDB 实例的用户名。
            - `${MARIADB_PASSWORD}`：此 MariaDB 实例的密码。
            - `${MARIADB_DATABASE}`：此 MariaDB 实例的数据库名称。
            - `${MARIADB_HOST}`：此 MariaDB 实例的主机名。
            - `${MARIADB_PORT}`：此 MariaDB 实例的端口。

            ## 恢复备份

            Zeabur 为 MariaDB 提供了自动备份功能。但是，您必须手动还原备份。请按照以下步骤还原备份：

            1. 从存储空间下载并解压缩备份文件。您会找到一个 data.sql 文件。
            2. 在 MariaDB 服务的「Instructions」区段中找到「Command to connect to your MariaDB」。
            3. 确保您已在机器上安装 [MariaDB command tools](https://mariadb.com/downloads/)。然后运行：

              ```bash
              <Command to connect to your MariaDB> < data.sql
              ```
    zh-TW:
        description: MariaDB 是 MySQL 關聯式資料庫管理系統的一個社群開發的、商業支援的分支。
        readme: |
            # MariaDB

            MariaDB 是 MySQL 關聯式資料庫管理系統的一個社群開發的、商業支援的分支。它被設計為 MySQL 的直接替代品，具有更多功能、新的儲存引擎、更少的錯誤和更好的效能。

            ## 特性

            - 與 MySQL 相容
            - 效能改進
            - 額外的儲存引擎
            - Galera 叢集技術
            - 進階複製功能
            - 增強的安全選項

            欲了解更多資訊，請訪問 [MariaDB.org](https://mariadb.org/)。

            ## 憑證

            您可以通過以下環境變數取得 MariaDB 的憑證：

            - `${MARIADB_USERNAME}`：此 MariaDB 實例的使用者名稱。
            - `${MARIADB_PASSWORD}`：此 MariaDB 實例的密碼。
            - `${MARIADB_DATABASE}`：此 MariaDB 實例的資料庫名稱。
            - `${MARIADB_HOST}`：此 MariaDB 實例的主機名稱。
            - `${MARIADB_PORT}`：此 MariaDB 實例的連線埠。

            ## 還原備份

            Zeabur 為 MariaDB 提供了自動備份功能。但是，您必須手動還原備份。請依照以下步驟還原備份：

            1. 從儲存空間下載並解壓縮備份檔案。您會找到一個 data.sql 檔案。
            2. 在 MariaDB 服務的「Instructions」區段中找到「Command to connect to your MariaDB」。
            3. 確保您已在機器上安裝 [MariaDB command tools](https://mariadb.com/downloads/)。然後執行：

              ```bash
              <Command to connect to your MariaDB> < data.sql
              ```
