# yaml-language-server: $schema=https://schema.zeabur.app/template.json
apiVersion: zeabur.com/v1
kind: Template
metadata:
    name: Prappser
spec:
    description: Prappser server - event-driven application sync with PostgreSQL
    variables:
        - key: MASTER_PASSWORD
          type: STRING
          name: Master Password
          description: Plain text admin password (will be hashed by server)
        - key: SERVER_DOMAIN
          type: DOMAIN
          name: Server Domain
          description: Full domain for the server (e.g., myapp.zeabur.app or your custom domain)
    tags:
        - Go
        - PostgreSQL
        - Backend
    readme: |
        # Prappser Server

        Event-driven application sync server with PostgreSQL backend.

        ## Configuration
        - **MASTER_PASSWORD**: Your admin password (plain text, hashed automatically by server)

        ## Endpoints
        - HTTP API: `https://{domain}/api/*`
        - WebSocket: `wss://{domain}/ws`
    services:
        - name: postgresql
          icon: https://raw.githubusercontent.com/zeabur/service-icons/main/marketplace/postgresql.svg
          template: PREBUILT
          spec:
            source:
                image: postgres:16-alpine
            ports:
                - id: database
                  port: 5432
                  type: TCP
            volumes:
                - id: data
                  dir: /var/lib/postgresql/data
            env:
                POSTGRES_DB:
                    default: prappser
                POSTGRES_HOST:
                    default: ${CONTAINER_HOSTNAME}
                    expose: true
                POSTGRES_PASSWORD:
                    default: ${PASSWORD}
                    expose: true
                POSTGRES_PORT:
                    default: "5432"
                    expose: true
                POSTGRES_USER:
                    default: postgres
                    expose: true
        - name: prappser-server
          icon: https://cdn.simpleicons.org/go/00ADD8
          dependencies:
            - postgresql
          template: GIT
          spec:
            source:
                source: GITHUB
                repo: 925100212
                branch: main
            ports:
                - id: http
                  port: 4545
                  type: HTTP
            volumes:
                - id: storage
                  dir: /app/storage
            instructions:
                - title: API Endpoint
                  content: ${ZEABUR_WEB_URL}/api
                - title: WebSocket
                  content: wss://${ZEABUR_WEB_DOMAIN}/ws
            env:
                ALLOWED_ORIGINS:
                    default: https://prappser.app
                DATABASE_URL:
                    default: postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/prappser?sslmode=disable
                EXTERNAL_URL:
                    default: ${SERVER_DOMAIN}
                HOSTING_PROVIDER:
                    default: zeabur
                LOG_LEVEL:
                    default: info
                MASTER_PASSWORD:
                    default: ${MASTER_PASSWORD}
                PORT:
                    default: "4545"
                STORAGE_CHUNK_SIZE_MB:
                    default: "5"
                STORAGE_MAX_FILE_SIZE_MB:
                    default: "50"
                STORAGE_PATH:
                    default: /app/storage
                STORAGE_TYPE:
                    default: local
          domainKey: SERVER_DOMAIN
