# yaml-language-server: $schema=https://schema.zeabur.app/template.json
apiVersion: zeabur.com/v1
kind: Template
metadata:
    name: Brew
spec:
    description: brew.re, AI base rag service
    icon: https://brew.re/assets/favicon-B5T_atCh.ico
    tags:
        - API
        - Website
    readme: "![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/breeew/brew/ghcr.yml)\n![GitHub Tag](https://img.shields.io/github/v/tag/breeew/brew)\n![GitHub commit activity](https://img.shields.io/github/commit-activity/m/breeew/brew)\n\n![Discord](https://img.shields.io/discord/1293497229096521768?logo=discord&logoColor=white)\n![X (formerly Twitter) Follow](https://img.shields.io/twitter/follow/trybrewapp)\n\n**Brew** is a lightweight and user-friendly Retrieval-Augmented Generation (RAG) system designed to help you build your own second brain. With its fast and easy-to-use interface, Brew empowers users to efficiently manage and retrieve information.\n\n\nhttps://github.com/user-attachments/assets/78751333-e02f-482d-b2da-12d0ea59a66c\n\n\n## Community\n\nJoin our community on Discord to connect with other users, share ideas, and get support: [Discord Community](https://discord.gg/YGrbmbCVRF).\n\n## Install\n\n### Databases\n\n- Install DB: [pgvector](https://github.com/pgvector/pgvector)，don't forget `CREATE EXTENSION vector;`\n- Create database like 'brew'\n- Execute create table sqls via `/internal/store/sqlstore/*.sql`\n\n### Service\n\n- Clone & go build cmd/main.go\n- Copy default config(cmd/service/etc/service-default.toml) to your config path  \n  `brew-api service -c {your config path}` to start selfhost service.\n\n### Web\n\n- [brew web-app](https://github.com/breeew/web-app)\n"
    services:
        - name: PostgreSQL with pgvector
          icon: https://raw.githubusercontent.com/zeabur/service-icons/main/marketplace/postgresql.svg
          template: PREBUILT
          spec:
            id: postgresql-with-pgvector
            source:
                image: pgvector/pgvector:pg16
            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
        - name: webapp
          template: GIT
          spec:
            id: webapp
            source:
                source: GITHUB
                repo: 875622525
                branch: main
        - name: api service
          template: GIT
          spec:
            id: api-service
            source:
                source: GITHUB
                repo: 873075204
                branch: main
