# yaml-language-server: $schema=https://schema.zeabur.app/template.json
apiVersion: zeabur.com/v1
kind: Template
metadata:
    name: Magpie
spec:
    description: |
        A self-hosted proxy manager that transforms messy proxy lists into functional tools through automated scraping, continuous health checks, reputation scoring, and rotating endpoints.
    coverImage: https://raw.githubusercontent.com/Kuucheen/magpie/master/frontend/public/logo.png
    icon: https://raw.githubusercontent.com/Kuucheen/magpie/master/frontend/public/logo.png
    tags:
        - Proxy Manager
        - Security
    readme: ""
    services:
        - name: Backend
          template: PREBUILT_V2
          spec:
            source:
                image: kuuchen/magpie-backend:latest
            ports:
                - id: http
                  port: 5656
                  type: TCP
                - id: grpc-20000
                  port: 20000
                  type: TCP
                - id: grpc-udp-20000
                  port: 20000
                  type: UDP
                - id: grpc-20001
                  port: 20001
                  type: TCP
                - id: grpc-udp-20001
                  port: 20001
                  type: UDP
                - id: grpc-20002
                  port: 20002
                  type: TCP
                - id: grpc-udp-20002
                  port: 20002
                  type: UDP
                - id: grpc-20003
                  port: 20003
                  type: TCP
                - id: grpc-udp-20003
                  port: 20003
                  type: UDP
                - id: grpc-20004
                  port: 20004
                  type: TCP
                - id: grpc-udp-20004
                  port: 20004
                  type: UDP
                - id: grpc-20005
                  port: 20005
                  type: TCP
                - id: grpc-udp-20005
                  port: 20005
                  type: UDP
                - id: grpc-20006
                  port: 20006
                  type: TCP
                - id: grpc-udp-20006
                  port: 20006
                  type: UDP
                - id: grpc-20007
                  port: 20007
                  type: TCP
                - id: grpc-udp-20007
                  port: 20007
                  type: UDP
                - id: grpc-20008
                  port: 20008
                  type: TCP
                - id: grpc-udp-20008
                  port: 20008
                  type: UDP
                - id: grpc-20009
                  port: 20009
                  type: TCP
                - id: grpc-udp-20009
                  port: 20009
                  type: UDP
                - id: grpc-20010
                  port: 20010
                  type: TCP
                - id: grpc-udp-20010
                  port: 20010
                  type: UDP
            env:
                CORS_ALLOWED_ORIGINS:
                    default: http://localhost:5050,http://127.0.0.1:5050,http://localhost:4200,http://127.0.0.1:4200
                DB_HOST:
                    default: postgres
                DB_NAME:
                    default: magpie
                DB_PASSWORD:
                    default: ChangeMeToAStrongDbPassword
                DB_PORT:
                    default: "5432"
                DB_USERNAME:
                    default: magpie_user
                JWT_SECRET:
                    default: magpie-local-compose-jwt-secret-2026
                PROXY_ENCRYPTION_KEY:
                    default: ${PASSWORD}
                    expose: true
                REDIS_MASTER_NAME:
                    default: magpie-master
                REDIS_MODE:
                    default: single
                REDIS_SENTINEL_ADDRS:
                    default: redis-sentinel-1:26379,redis-sentinel-2:26379,redis-sentinel-3:26379
                ROTATING_PROXY_PORT_END:
                    default: "20010"
                ROTATING_PROXY_PORT_START:
                    default: "20000"
                ROTATING_PROXY_SYNC_INTERVAL_SECONDS:
                    default: "10"
                redisUrl:
                    default: redis://redis:6379
            healthCheck:
                type: HTTP
                port: http
                http:
                    path: /health
        - name: Frontend
          template: PREBUILT_V2
          spec:
            source:
                image: kuuchen/magpie-frontend:latest
            ports:
                - id: web
                  port: 80
                  type: TCP
        - name: Postgres
          icon: https://raw.githubusercontent.com/docker-library/postgres/master/logo.png
          template: PREBUILT_V2
          spec:
            source:
                image: postgres:17
            ports:
                - id: db
                  port: 5432
                  type: TCP
            volumes:
                - id: data
                  dir: /var/lib/postgresql/data
            env:
                POSTGRES_DB:
                    default: magpie
                POSTGRES_PASSWORD:
                    default: ChangeMeToAStrongDbPassword
                POSTGRES_USER:
                    default: magpie_user
        - name: Redis
          icon: https://raw.githubusercontent.com/redis/logo/master/redis-logo.png
          template: PREBUILT_V2
          spec:
            source:
                image: redis:7-alpine
            ports:
                - id: cache
                  port: 6379
                  type: TCP
            volumes:
                - id: data
                  dir: /data
