# yaml-language-server: $schema=https://schema.zeabur.app/template.json
apiVersion: zeabur.com/v1
kind: Template
metadata:
    name: Coolify
spec:
    description: |
        Coolify is an open-source & self-hostable alternative to Vercel, Heroku, Netlify and Railway.
        Deploy websites, databases, and 280+ one-click services to your own servers with free SSL,
        Git push-to-deploy, and no vendor lock-in.
    coverImage: https://coolify.io/og.png
    icon: https://coolify.io/coolify-logo-transparent.png
    variables:
        - key: PUBLIC_DOMAIN
          type: DOMAIN
          name: Domain
          description: Public domain for Coolify dashboard (HTTPS via Zeabur)
    tags:
        - PaaS
        - DevOps
        - Docker
        - Tool
    readme: "# Coolify\n\nOfficial site: [coolify.io](https://coolify.io/) · Docs: [coolify.io/docs](https://coolify.io/docs)\n\nOpen-source self-hosted alternative to Vercel / Heroku / Netlify / Railway.\n\n## What this template deploys\n\n| Service  | Role                          |\n|----------|-------------------------------|\n| coolify  | Dashboard (HTTP 8080)         |\n| postgres | Application database          |\n| redis    | Cache / queue                  |\n| soketi   | Realtime (Pusher-compatible)  |\n\n## After deploy\n\n1. Open `https://<your-domain>`\n2. Create the **first admin user** (registration is open only once)\n3. Add **remote servers** via SSH (root/sudo + Docker recommended on the target VPS)\n4. Deploy apps / databases / one-click services from the UI\n\n## Important limitations on Zeabur\n\nCoolify’s “local server” mode expects a **Docker socket on the host** and directories under `/data/coolify`.\nOn Zeabur containers that socket is **not available**, so:\n\n- Use Coolify primarily as a **control plane**\n- Add your **dedicated / VPS machines over SSH** as remote servers\n- Do **not** expect this container to orchestrate sibling Zeabur services via Docker socket\n\nFor a full single-VPS install (Docker + Coolify on the same host), use the official script on a bare Linux server:\n\n```bash\ncurl -fsSL https://cdn.coollabs.io/coolify/install.sh | bash\n```\n\n## Resources\n\nOfficial minimum: **2 CPU / 2 GB RAM / 30 GB disk**.  \nComfortable with a few remote servers managed: **4 CPU / 4–8 GB RAM**.\n\n## License\n\nCoolify is free & open source — see coolify.io/philosophy.\n"
    services:
        - name: postgres
          icon: https://cdn.zeabur.com/marketplace/postgresql.svg
          template: PREBUILT_V2
          spec:
            id: postgres
            source:
                image: postgres:15-alpine
            ports:
                - id: database
                  port: 5432
                  type: TCP
            volumes:
                - id: data
                  dir: /var/lib/postgresql/data
            env:
                POSTGRES_DB:
                    default: coolify
                    expose: true
                POSTGRES_HOST:
                    default: ${CONTAINER_HOSTNAME}
                    expose: true
                POSTGRES_PASSWORD:
                    default: ${PASSWORD}
                    expose: true
                POSTGRES_PORT:
                    default: ${DATABASE_PORT}
                    expose: true
                POSTGRES_USER:
                    default: coolify
                    expose: true
            healthCheck:
                type: TCP
                port: database
        - name: redis
          icon: https://raw.githubusercontent.com/zeabur/service-icons/main/marketplace/redis.svg
          template: PREBUILT_V2
          spec:
            id: redis
            source:
                image: redis:7-alpine
                command:
                    - redis-server
                    - --requirepass
                    - ${REDIS_PASSWORD}
                    - --save
                    - "20"
                    - "1"
            ports:
                - id: database
                  port: 6379
                  type: TCP
            volumes:
                - id: data
                  dir: /data
            env:
                REDIS_HOST:
                    default: ${CONTAINER_HOSTNAME}
                    expose: true
                REDIS_PASSWORD:
                    default: ${PASSWORD}
                    expose: true
                REDIS_PORT:
                    default: ${DATABASE_PORT}
                    expose: true
            healthCheck:
                type: TCP
                port: database
        - name: soketi
          icon: https://coolify.io/coolify-logo-transparent.png
          template: PREBUILT_V2
          spec:
            id: soketi
            source:
                image: coollabsio/coolify-realtime:1.0.16
            ports:
                - id: web
                  port: 6001
                  type: HTTP
            env:
                APP_NAME:
                    default: Coolify
                PUSHER_APP_ID:
                    default: coolify
                    expose: true
                PUSHER_APP_KEY:
                    default: ${PASSWORD}
                    expose: true
                PUSHER_APP_SECRET:
                    default: ${PASSWORD}
                    expose: true
                SOKETI_DEBUG:
                    default: "false"
                SOKETI_DEFAULT_APP_ID:
                    default: ${PUSHER_APP_ID}
                SOKETI_DEFAULT_APP_KEY:
                    default: ${PUSHER_APP_KEY}
                SOKETI_DEFAULT_APP_SECRET:
                    default: ${PUSHER_APP_SECRET}
                SOKETI_HOST:
                    default: 0.0.0.0
            healthCheck:
                type: TCP
                port: web
        - name: coolify
          icon: https://coolify.io/coolify-logo-transparent.png
          dependencies:
            - postgres
            - redis
            - soketi
          template: PREBUILT_V2
          spec:
            id: coolify
            source:
                image: coollabsio/coolify:latest
            ports:
                - id: web
                  port: 8080
                  type: HTTP
            volumes:
                - id: storage
                  dir: /var/www/html/storage/app
            instructions:
                - title: Coolify Dashboard
                  content: https://${ZEABUR_WEB_DOMAIN}
                - title: First login
                  content: Open the domain and create the first admin account (one-time registration).
            env:
                APP_DEBUG:
                    default: "false"
                APP_ENV:
                    default: production
                APP_KEY:
                    default: base64:dGVtcGxhdGUtY29vbGlmeS1rZXktMzJieXRlcw==
                APP_NAME:
                    default: Coolify
                APP_URL:
                    default: https://${PUBLIC_DOMAIN}
                BROADCAST_DRIVER:
                    default: pusher
                CACHE_DRIVER:
                    default: redis
                DB_CONNECTION:
                    default: pgsql
                DB_DATABASE:
                    default: coolify
                DB_HOST:
                    default: ${POSTGRES_HOST}
                DB_PASSWORD:
                    default: ${POSTGRES_PASSWORD}
                DB_PORT:
                    default: "5432"
                DB_USERNAME:
                    default: coolify
                PUSHER_APP_ID:
                    default: ${PUSHER_APP_ID}
                PUSHER_APP_KEY:
                    default: ${PUSHER_APP_KEY}
                PUSHER_APP_SECRET:
                    default: ${PUSHER_APP_SECRET}
                PUSHER_HOST:
                    default: ${SOKETI_HOST}
                PUSHER_PORT:
                    default: "6001"
                PUSHER_SCHEME:
                    default: http
                QUEUE_CONNECTION:
                    default: redis
                REDIS_CLIENT:
                    default: phpredis
                REDIS_HOST:
                    default: ${REDIS_HOST}
                REDIS_PASSWORD:
                    default: ${REDIS_PASSWORD}
                REDIS_PORT:
                    default: "6379"
                SESSION_DRIVER:
                    default: redis
                SSL_CERTIFICATE_DOMAIN:
                    default: ${PUBLIC_DOMAIN}
            healthCheck:
                type: HTTP
                port: web
                http:
                    path: /api/health
          domainKey: PUBLIC_DOMAIN
localization:
    zh-CN:
        description: |
            Coolify 是开源、可自托管的 Vercel / Heroku / Netlify / Railway 替代品。向自有服务器部署网站、数据库与 280+ 一键服务，自带免费 SSL 与 Git 推送部署。
        variables:
            - key: PUBLIC_DOMAIN
              type: DOMAIN
              name: 域名
              description: Coolify 控制台公网域名（Zeabur 自动 HTTPS）
        readme: |
            # Coolify

            官网：[coolify.io](https://coolify.io/) · 文档：[coolify.io/docs](https://coolify.io/docs)

            ## 本模板包含

            - coolify 控制台
            - PostgreSQL
            - Redis
            - Soketi（实时）

            ## 部署后

            1. 打开 `https://你的域名`
            2. 创建第一个管理员账号
            3. 通过 SSH 添加**远程服务器**（目标机建议已装 Docker）
            4. 在 UI 里部署应用 / 数据库 / 一键服务

            ## 在 Zeabur 上的限制

            Coolify「本机 Docker」依赖主机 `docker.sock` 与 `/data/coolify`，在 Zeabur 容器内**不可用**。
            请把 Coolify 当作**控制平面**，用 SSH 管理你的独立 VPS / 专属机。

            若要在单台 Linux VPS 完整安装（Docker + Coolify 同机）：

            ```bash
            curl -fsSL https://cdn.coollabs.io/coolify/install.sh | bash
            ```

            ## 资源

            官方最低 2C / 2G / 30G 磁盘；管理多台远程机建议 4C / 4–8G。
