# yaml-language-server: $schema=https://schema.zeabur.app/template.json
apiVersion: zeabur.com/v1
kind: Template
metadata:
    name: Notifuse
spec:
    description: An open-source & modern emailing platform
    coverImage: https://zb-tpl.resource.cc.cd/Notifuse-444d8ca47fb3f4d8.webp
    icon: https://www.notifuse.com/favicon.ico
    readme: |
        # [Notifuse](https://github.com/Notifuse/notifuse)

        ## Requirements

        - An SMTP server is required to send emails.

        ## Steps

        1. Deploy the service and wait for the deployment to complete.
        2. Set up the domain and restart.
        3. Go to the website, follow the prompts to complete the initial setup, and you can start using Notifuse to send emails!
    services:
        - name: postgresql
          icon: https://cdn.zeabur.com/marketplace/postgresql.svg
          template: PREBUILT_V2
          spec:
            id: postgresql
            source:
                image: postgres:18
                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/18/docker
            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/18/docker/pgdata
                    expose: false
                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
                    expose: false
                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
                    expose: false
                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 = 256
                    shared_buffers = 256MB
                    dynamic_shared_memory_type = posix
                    max_wal_size = 1GB
                    min_wal_size = 80MB
                    log_timezone = 'UTC'
                    datestyle = 'iso, mdy'
                    timezone = 'UTC'
                    lc_messages = 'en_US.UTF-8'
                    lc_monetary = 'en_US.UTF-8'
                    lc_numeric = 'en_US.UTF-8'
                    lc_time = 'en_US.UTF-8'
                    default_text_search_config = 'pg_catalog.english'
                  permission: null
                  envsubst: null
            portForwarding:
                enabled: true
        - name: notifuse
          icon: https://www.notifuse.com/favicon.ico
          dependencies:
            - postgresql
          template: PREBUILT_V2
          spec:
            id: notifuse
            source:
                image: notifuse/notifuse:latest
            ports:
                - id: notifuse
                  port: 8080
                  type: HTTP
            env:
                API_ENDPOINT:
                    default: https://${ZEABUR_notifuse_DOMAIN}
                    expose: false
                DB_HOST:
                    default: ${POSTGRES_HOST}
                    expose: false
                DB_PASSWORD:
                    default: ${POSTGRES_PASSWORD}
                    expose: false
                DB_PORT:
                    default: ${POSTGRES_PORT}
                    expose: false
                DB_SSLMODE:
                    default: disable
                    expose: false
                DB_USER:
                    default: ${POSTGRES_USERNAME}
                    expose: false
                SECRET_KEY:
                    default: LdArz7obtqKIQvfaVrkWJ/Dp0rbE0LYaaW1CBFD+TPo=
                    expose: false
            configs: []
            portForwarding:
                enabled: false
localization:
    zh-TW:
        description: 一個開源且現代化的郵件平台
        readme: |
            # [Notifuse](https://github.com/Notifuse/notifuse)

            ## 要求

            -  需要一個 SMTP 服務器來發送郵件。

            ## 步驟

            1. 部署服務，等待部署完成。
            2. 設定域名並重啟
            3. 前往網站，依照提示完成初始設定，即可開始使用 Notifuse 發送郵件了！
