# yaml-language-server: $schema=https://schema.zeabur.app/template.json
apiVersion: zeabur.com/v1
kind: Template
metadata:
    name: Artalk
spec:
    description: A Self-hosted Comment System | 自托管评论系统
    coverImage: https://user-images.githubusercontent.com/22412567/171680920-6e74b77c-c565-487b-bff1-4f94976ecbe7.png
    icon: https://avatars.githubusercontent.com/u/76841221?s=200&v=4
    tags:
        - Website
    readme: "# Artalk\n\nArtalk 是一款简单易用但功能丰富的评论系统，你可以开箱即用地部署并置入任何博客、网站、Web 应用。\n\n- \U0001F343 前端 ~40KB，纯天然 Vanilla JS\n- \U0001F371 后端 Golang，高效轻量跨平台\n- \U0001F433 通过 Docker 一键部署，方便快捷\n- \U0001F308 开源程序，自托管，隐私至上\n\nGitHub → <https://github.com/ArtalkJS/Artalk>\n\n## 预设帐密\n\n- 帐号：`artalk@zeabur.com`\n- 密码：`artalk@zeabur`"
    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: Redis
          icon: https://raw.githubusercontent.com/zeabur/service-icons/main/marketplace/redis.svg
          template: PREBUILT
          spec:
            source:
                image: redis/redis-stack-server:latest
            ports:
                - id: database
                  port: 6379
                  type: TCP
            volumes:
                - id: data
                  dir: /data
            instructions:
                - title: Command to connect to your Redis
                  content: redis-cli -h ${PORT_FORWARDED_HOSTNAME} -p ${DATABASE_PORT_FORWARDED_PORT} -a ${REDIS_PASSWORD}
                - title: Redis Connection String
                  content: redis://:${REDIS_PASSWORD}@${PORT_FORWARDED_HOSTNAME}:${DATABASE_PORT_FORWARDED_PORT}
                - title: Redis password
                  content: ${REDIS_PASSWORD}
                - title: Redis host
                  content: ${PORT_FORWARDED_HOSTNAME}
                - title: Redis port
                  content: ${DATABASE_PORT_FORWARDED_PORT}
            env:
                REDIS_ARGS:
                    default: --requirepass ${REDIS_PASSWORD}
                REDIS_CONNECTION_STRING:
                    default: redis://:${REDIS_PASSWORD}@${REDIS_HOST}:${REDIS_PORT}
                    expose: true
                REDIS_HOST:
                    default: ${CONTAINER_HOSTNAME}
                    expose: true
                REDIS_PASSWORD:
                    default: ${PASSWORD}
                    expose: true
                REDIS_PORT:
                    default: ${DATABASE_PORT}
                    expose: true
                REDIS_URI:
                    default: ${REDIS_CONNECTION_STRING}
                    expose: true
        - name: Artalk
          icon: https://avatars.githubusercontent.com/u/76841221?s=200&v=4
          template: PREBUILT
          spec:
            source:
                image: artalk/artalk-go:2.8
            ports:
                - id: web
                  port: 23366
                  type: HTTP
            volumes:
                - id: data
                  dir: /data
            env:
                ATK_APP__KEY:
                    default: ${PASSWORD}
                ATK_CACHE_REDIS_PASSWORD:
                    default: ${REDIS_PASSWORD}
                ATK_CACHE_SERVER:
                    default: ${REDIS_HOST}:${REDIS_PORT}
                ATK_DB_HOST:
                    default: ${POSTGRES_HOST}
                ATK_DB_NAME:
                    default: ${POSTGRES_DATABASE}
                ATK_DB_PASSWORD:
                    default: ${POSTGRES_PASSWORD}
                ATK_DB_PORT:
                    default: ${POSTGRES_PORT}
                ATK_DB_USER:
                    default: ${POSTGRES_USERNAME}
            configs:
                - path: /data/artalk.yml
                  template: |
                    # Listen host
                    host: "0.0.0.0"

                    # Listen port
                    port: 23366

                    # App Key (for generation of JWT)
                    app_key: ""

                    # Debug mode
                    debug: false

                    # Language (follow Unicode BCP 47) ["en", "zh-CN", "zh-TW", "jp", "fr", "ko", "ru"]
                    # -- see https://www.techonthenet.com/js/language_tags.php --
                    locale: zh-CN

                    # Timezone (follow IANA Time Zone Database)
                    # -- see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones --
                    timezone: Asia/Shanghai

                    # Default site name (create when app is first launched)
                    site_default: Default Site

                    # Login timeout (in seconds)
                    login_timeout: 259200

                    # Database (Configured for PostgreSQL)
                    db:
                      # Database type ["sqlite", "mysql", "pgsql", "mssql"]
                      type: pgsql
                      # Table prefix (e.g. "atk_")
                      table_prefix: atk_
                      # Database charset
                      charset: utf8mb4
                      # Enable SSL mode
                      ssl: false
                      # Prepared Statement
                      prepare_stmt: true

                    # Web server
                    http:
                      # Body size limit (unit: MB)
                      body_limit: 100
                      # Proxy Header (fill `X-Forwarded-For` to get user real IP if behind a trusted reverse proxy or CDN)
                      proxy_header: ""

                    # Logging
                    log:
                      # Enable logging
                      enabled: true
                      # Log file path
                      filename: /dev/stdout

                    # Cache (Configured for Redis)
                    cache:
                      # Enable cache
                      enabled: true
                      # Cache type ["redis", "memcache", "builtin"]
                      type: redis
                      # Cache expiration time (in minutes)
                      expires: 30
                      # Cache warm up (warm up cache when program starts)
                      warm_up: true
                      # Redis config
                      redis:
                        # Connection type ["tcp", "unix"]
                        network: tcp
                        # Redis database number (e.g. 0)
                        db: 0

                    # Trusted domains
                    # -- e.g. ["https://artalk.example.com:23366"] add url of your site her --
                    trusted_domains: []

                    # SSL
                    ssl:
                      # Enable SSL
                      enabled: false
                      # Certificate file path
                      # (e.g. "/etc/letsencrypt/live/example.com/fullchain.pem")
                      cert_path: ""
                      # Key file path
                      # (e.g. "/etc/letsencrypt/live/example.com/privkey.pem")
                      key_path: ""

                    # Moderator
                    # -- Comment examination before being public --
                    moderator:
                      # Default pending (new comments need to be approved by admin)
                      pending_default: false
                      # Block when API request fails (set to false to let comments pass when API request fails)
                      api_fail_block: false
                      # Akismet Key
                      # (Akismet anti-spam service, https://akismet.com)
                      akismet_key: ""
                      # Tencent Cloud Content Security
                      # (Auto review comments with Tencent Cloud Content Security)
                      # -- see https://cloud.tencent.com/document/product/1124/64508 --
                      tencent:
                        enabled: false
                        secret_id: ""
                        secret_key: ""
                        region: ap-guangzhou
                      # Aliyun Content Security
                      # (Auto review comments with Aliyun Content Security)
                      # -- see https://help.aliyun.com/document_detail/28417.html --
                      aliyun:
                        enabled: false
                        access_key_id: ""
                        access_key_secret: ""
                        region: cn-shanghai
                      # Keyword filter (local offline dictionary)
                      keywords:
                        # Enable keyword filter
                        enabled: false
                        # Set to pending when match
                        pending: false
                        # Dictionary file (support multiple dictionary files)
                        files:
                          - ./data/keywords_1.txt
                        file_sep: "
                    "
                        replace_to: x

                    # Captcha
                    captcha:
                      # Enable captcha
                      enabled: true
                      # Captcha is required always
                      always: false
                      # Captcha type ["image", "turnstile", "recaptcha", "hcaptcha", "geetest"]
                      captcha_type: image
                      # Action limit
                      # (the number of actions required to activate captcha)
                      action_limit: 3
                      # Reset Timeout (timeout to reset action counter. unit: s, set to -1 to disable)
                      action_reset: 60
                      # Turnstile
                      # (https://www.cloudflare.com/products/turnstile/)
                      turnstile:
                        site_key: ""
                        secret_key: ""
                      # reCaptcha
                      # (https://www.google.com/recaptcha/about/)
                      recaptcha:
                        site_key: ""
                        secret_key: ""
                      # hCaptcha (https://www.hcaptcha.com/)
                      hcaptcha:
                        site_key: ""
                        secret_key: ""
                      # Geetest (https://www.geetest.com)
                      geetest:
                        captcha_id: ""
                        captcha_key: ""

                    # Upload
                    img_upload:
                      # Enable image upload
                      enabled: true
                      # Image storage
                      path: ./data/artalk-img/
                      # Image size limit (unit: MB)
                      max_size: 5
                      # Image link base path (default: "/static/images/")
                      public_path: null
                      # Upgit config
                      upgit:
                        # Enable Upgit
                        enabled: false
                        # Command line arguments
                        exec: upgit -c UPGIT_CONF_FILE_PATH -t /artalk-img
                        # Delete local image after upload success
                        del_local: true

                    # Email
                    email:
                      # Enable email notification
                      enabled: false
                      # Send method ["smtp", "ali_dm", "sendmail"]
                      send_type: smtp
                      # Nick name of sender
                      send_name: "{{reply_nick}}"
                      # Email address of sender
                      send_addr: noreply@example.com
                      # Email subject
                      mail_subject: "[{{site_name}}] You got a reply from @{{reply_nick}}"
                      # Email template file (set to file path to use custom template)
                      mail_tpl: default
                      # SMTP send (set send method to "smtp" to enable)
                      smtp:
                        # Email address of sender
                        host: smtp.qq.com
                        # Email port
                        port: 587
                        # Email address of sender
                        username: example@qq.com
                        # Password
                        password: ""
                      # Aliyun mail push
                      # (set send method to "ali_dm" to enable; see: https://help.aliyun.com/document_detail/29444.html)
                      ali_dm:
                        access_key_id: ""
                        access_key_secret: ""
                        account_name: noreply@example.com

                    # Multi-Push
                    admin_notify:
                      # Notification template (set to file path to use custom template)
                      notify_tpl: default
                      # Pending comment still send notification (notifications are still sent when comments are intercepted)
                      notify_pending: false
                      # Noise mode
                      # -- noise_mode is disabled by default. --
                      # -- When this option is set to `false`, only messages sent to the administrator will be notified, --
                      # -- such as "user A" replies to "user B", the communication between these two users will not be notified to the administrator. --
                      noise_mode: false
                      # Notify admin
                      email:
                        # Enable (can be disabled when using other push methods)
                        enabled: true
                        # Email subject (email subject sent to admin)
                        mail_subject: '[{{site_name}}] Post "{{page_title}}" has new a comment'
                        # Admin email template file (set to file path to use custom template)
                        mail_tpl: ""
                      # Telegram
                      telegram:
                        enabled: false
                        api_token: ""
                        receivers:
                          - 7777777
                      # Bark
                      bark:
                        enabled: false
                        server: http://day.app/xxxxxxx/
                      # Lark
                      lark:
                        enabled: false
                        webhook_url: ""
                        # Message type ["text", "card"]
                        msg_type: "text"
                      # WebHook
                      webhook:
                        enabled: false
                        url: ""
                      # DingTalk
                      ding_talk:
                        enabled: false
                        token: ""
                        secret: ""
                      # Slack
                      slack:
                        enabled: false
                        oauth_token: ""
                        receivers:
                          - "CHANNEL_ID"
                      # LINE
                      line:
                        enabled: false
                        channel_secret: ""
                        channel_access_token: ""
                        receivers:
                          - USER_ID_1
                          - GROUP_ID_1

                    # Social Login
                    auth:
                      # Enable Social Login
                      enabled: false
                      # Allow anonymous commenting (Allow skipping verification, only fill in an anonymous nickname and email)
                      anonymous: true
                      # Callback URL (https://example.com/api/v2/auth/{provider}/callback)
                      callback: "http://localhost:23366/api/v2/auth/{provider}/callback"
                      # Email
                      email:
                        # Enable email password login
                        enabled: true
                        # Verification email subject
                        verify_subject: "Your Code - {{code}}"
                        # Verification email template (set to file path to use custom template)
                        verify_tpl: default
                      # GitHub
                      github:
                        enabled: false
                        client_id: ""
                        client_secret: ""
                      # GitLab
                      gitlab:
                        enabled: false
                        client_id: ""
                        client_secret: ""
                      # Gitea
                      gitea:
                        enabled: false
                        client_id: ""
                        client_secret: ""
                      # Google
                      google:
                        enabled: false
                        client_id: ""
                        client_secret: ""
                      # Mastodon
                      mastodon:
                        enabled: false
                        client_id: ""
                        client_secret: ""
                      # Twitter
                      twitter:
                        enabled: false
                        client_id: ""
                        client_secret: ""
                      # Facebook
                      facebook:
                        enabled: false
                        client_id: ""
                        client_secret: ""
                      # Discord
                      discord:
                        enabled: false
                        client_id: ""
                        client_secret: ""
                      # Steam
                      steam:
                        enabled: false
                        api_key: ""
                      # Apple
                      apple:
                        enabled: false
                        client_id: ""
                        client_secret: ""
                      # Microsoft
                      microsoft:
                        enabled: false
                        client_id: ""
                        client_secret: ""
                      # WeChat
                      wechat:
                        enabled: false
                        client_id: ""
                        client_secret: ""
                      # Tiktok
                      tiktok:
                        enabled: false
                        client_id: ""
                        client_secret: ""
                      # Slack
                      slack:
                        enabled: false
                        client_id: ""
                        client_secret: ""
                      # Line
                      line:
                        enabled: false
                        client_id: ""
                        client_secret: ""
                      # Patreon
                      patreon:
                        enabled: false
                        client_id: ""
                        client_secret: ""
                      # Auth0
                      auth0:
                        enabled: false
                        client_id: ""
                        client_secret: ""
                        domain: ""

                    # UI Settings
                    frontend:
                      # Comment box placeholder
                      placeholder: ""
                      # Text to display when there is
                      noComment: ""
                      # Text of the send button
                      sendBtn: ""
                      # Movable comment box
                      editorTravel: true
                      # Emoticons
                      emoticons: https://cdn.jsdelivr.net/gh/ArtalkJS/Emoticons/grps/default.json
                      # Vote button
                      vote: true
                      # Dislike button
                      voteDown: false
                      # User UA badge
                      uaBadge: false
                      # Comment sorting
                      listSort: true
                      # Page PV binding element
                      pvEl: "#ArtalkPV"
                      # Comment count binding element
                      countEl: "#ArtalkCount"
                      # Editor real-time preview
                      preview: true
                      # Flatten mode ["auto", true, false]
                      flatMode: auto
                      # Dark mode ["inherit", "auto"]
                      darkMode: inherit
                      # Maximum nesting level
                      nestMax: 2
                      # Nesting comment sorting rules ["DATE_ASC", "DATE_DESC", "VOTE_UP_DESC"]
                      nestSort: DATE_ASC
                      # Gravatar
                      gravatar:
                        # API URL
                        mirror: https://www.gravatar.com/avatar/
                        # API parameters
                        params: d=mp&s=240
                      # Comment pagination
                      pagination:
                        # Number of comments per page
                        pageSize: 20
                        # Load more mode (disabled to use pagination bar)
                        readMore: true
                        # Scroll loading
                        autoLoad: true
                      # Content height limit
                      heightLimit:
                        # Comment content height limit (unit: px)
                        content: 300
                        # Sub-comment area height limit (unit: px)
                        children: 400
                        # Scrollable (scrollable height limit area)
                        scrollable: false
                      # Image lazy load [false, "native", "data-src"]
                      imgLazyLoad: false
                      # Request timeout (unit: ms)
                      reqTimeout: 15000
                      # Version check
                      versionCheck: true
                      # Plugins
                      pluginURLs: []

                    # Admin users
                    admin_users:
                      - name: artalk
                        email: artalk@zeabur.com
                        # default password: "artalk@zeabur"
                        password: (bcrypt)$2a$10$jOUbFXiz.yY0svR5NFgFzOR9dWG6pwZqqEmUNo352gG.6BWCQxzWW
                        badge_name: Admin
                        badge_color: '#0083FF'
                  permission: null
                  envsubst: null
