# yaml-language-server: $schema=https://schema.zeabur.app/template.json
apiVersion: zeabur.com/v1
kind: Template
metadata:
    name: Halo
spec:
    description: A powerful and easy-to-use open-source website building tool.
    icon: https://avatars.githubusercontent.com/u/48195280?s=48&v=4
    tags:
        - Blog
        - Website
        - Starter
    readme: |-
        # Halo

        Halo [ˈheɪloʊ], a powerful and easy-to-use open-source website building tool.

        -  Official Website: <http://www.halo.run>
        -  GitHub: <https://github.com/halo-dev/halo>

        ## Domain Binding

        After binding a domain in Zeabur, please restart the Halo service. After restarting, Halo will automatically configure the set domain as the external access address, so no manual setup is needed.

        ### Version Upgrade

        If you need to upgrade the version of Halo, simply change the version number of the image in the service settings.

        You can view the list of Halo versions at [halohub/halo](https://hub.docker.com/r/halohub/halo/tags). For release notes, please visit: [Halo Official Website - Release Notes](https://www.halo.run/categories/release-notes).

        After modifying the image version, the service will automatically restart, and the upgrade will be completed after a short wait.

        ### Backup and Migration

        Although Zeabur also provides backup functionality for services, Halo's built-in backup feature is platform-independent, so it is more recommended to use Halo's built-in backup feature for backups.

        Additionally, if you need to migrate your existing Halo service to Zeabur, using Halo's backup and restore feature is also a better choice.

        For information on how to use Halo's backup and restore feature, please refer to: [Halo Documentation - Backup and Restore](https://docs.halo.run/user-guide/backup).
    services:
        - name: PostgreSQL
          icon: https://raw.githubusercontent.com/zeabur/service-icons/main/marketplace/postgresql.svg
          template: PREBUILT
          spec:
            source:
                image: postgres:16
                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: Halo
          icon: https://avatars.githubusercontent.com/u/48195280?s=200&v=4
          template: PREBUILT
          spec:
            source:
                image: halohub/halo:2.20
            ports:
                - id: web
                  port: 8090
                  type: HTTP
            volumes:
                - id: data
                  dir: /root/.halo2
            env:
                HALO_EXTERNAL_URL:
                    default: ${ZEABUR_WEB_URL}
                SPRING_R2DBC_PASSWORD:
                    default: ${POSTGRES_PASSWORD}
                SPRING_R2DBC_URL:
                    default: r2dbc:pool:postgresql://${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DATABASE}
                SPRING_R2DBC_USERNAME:
                    default: ${POSTGRES_USERNAME}
                SPRING_SQL_INIT_PLATFORM:
                    default: postgresql
localization:
    zh-CN:
        description: 强大易用的开源建站工具
        readme: |
            # Halo

            Halo [ˈheɪloʊ]，一款强大且易用的开源建站工具。

            - 官网：<http://www.halo.run>
            - GitHub：<https://github.com/halo-dev/halo>

            ## 绑定域名

            在 Zeabur 完成域名绑定后，需要重启 Halo 服务。重启后，Halo 会自动将设定的域名配置为外部访问地址，无需手动设置。

            ### 版本升级

            如需升级 Halo 版本，只需在服务设置中修改镜像版本号即可。

            您可以在 [halohub/halo](https://hub.docker.com/r/halohub/halo/tags) 查看所有可用版本，版本更新说明请访问：[Halo 官网 - 发布说明](https://www.halo.run/categories/release-notes)

            更改镜像版本后，服务会自动重启，等待片刻即可完成升级。

            ### 备份与迁移

            尽管 Zeabur 提供服务备份功能，但我们更推荐使用 Halo 自带的备份功能，因为它不受平台限制。

            同样，如果您想把现有的 Halo 服务迁移到 Zeabur，使用 Halo 的备份恢复功能是更好的选择。

            关于 Halo 备份恢复功能的使用方法，请参考：[Halo 文档 - 备份和恢复](https://docs.halo.run/user-guide/backup)
    zh-TW:
        description: 功能強大且易用的開源架站工具
        readme: |
            # Halo

            Halo [ˈheɪloʊ]，一款功能強大且易用的開源架站工具。

            - 官網：<http://www.halo.run>
            - GitHub：<https://github.com/halo-dev/halo>

            ## 綁定網域名稱

            在 Zeabur 完成網域名稱綁定後，需要重新啟動 Halo 服務。重新啟動後，Halo 會自動將設定的網域名稱配置為外部存取位址，無需手動設定。

            ### 版本升級

            如需升級 Halo 版本，只需在服務設定中修改映像檔版本即可。

            您可以在 [halohub/halo](https://hub.docker.com/r/halohub/halo/tags) 查看所有可用版本，版本更新說明請訪問：[Halo 官網 - 發布說明](https://www.halo.run/categories/release-notes)

            更改映像檔版本後，服務會自動重新啟動，等待片刻即可完成升級。

            ### 備份與遷移

            儘管 Zeabur 提供服務備份功能，但我們更推薦使用 Halo 內建的備份功能，因為它不受平台限制。

            同樣，如果您想把現有的 Halo 服務遷移到 Zeabur，使用 Halo 的備份還原功能是更好的選擇。

            關於 Halo 備份還原功能的使用方法，請參考：[Halo 文件 - 備份和還原](https://docs.halo.run/user-guide/backup)
