Perplexica icon indicating copy to clipboard operation
Perplexica copied to clipboard

Kubernetes / Helm package for Perplexica

Open michael-willingham opened this issue 1 year ago • 10 comments

It would be great to see a Helm chart for this to run easily on Kubernetes! A bit busy with my 9-5 job at the moment, but might be able to take a look at it in the coming weeks.

michael-willingham avatar May 26 '24 19:05 michael-willingham

Hello @michael-willingham did you have time to work on it ?

delta-whiplash avatar Jul 29 '24 09:07 delta-whiplash

Sadly I have not had the time! Work and life have kept me quite busy. This might be better off if someone else could take a look tbh

michael-willingham avatar Jul 31 '24 22:07 michael-willingham

ok no worries could you just automate at least the docker container creation with the github actions template. With this (5min of clicks) you can automate the build and publish of your docker image on this github repo soo I can write a kubernetes deployment to do some testings

you can do it like this : https://github.com/ItzCrazyKns/Perplexica/new/main?filename=.github%2Fworkflows%2Fdocker-publish.yml&workflow_template=ci%2Fdocker-publish

delta-whiplash avatar Aug 01 '24 13:08 delta-whiplash

This is not my repo, I'm just a user! That's a question for @ItzCrazyKns

michael-willingham avatar Aug 09 '24 05:08 michael-willingham

Hey @ItzCrazyKns! I just started to work on the Helm Chart based on the current Docker Compose file. I'm closed to push the PR. Just need to finish the PV&PVC.

timoa avatar Oct 21 '24 14:10 timoa

Hi, @ItzCrazyKns! I was able to deploy Perplexica a few minutes ago on my Kubernetes cluster 🎉

Screenshot 2024-10-24 at 07 56 35

But the CORS config is restricting access to the backend API to http://127.0.0.1, where I deployed it with a public URL:

Screenshot 2024-10-24 at 07 48 50

To solve that, I will check how the CORS is configured on the backend side.

timoa avatar Oct 24 '24 06:10 timoa

Nice work

delta-whiplash avatar Oct 24 '24 12:10 delta-whiplash

here is my deployments

apiVersion: apps/v1
kind: Deployment
metadata:
  name: searxng-deployment
  namespace: search
  labels:
    app: searxng-deployment
spec:
  replicas: 1
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 1
  selector:
    matchLabels:
      app: searxng-deployment
  template:
    metadata:
      name: searxng-deployment
      labels:
        app: searxng-deployment
    spec:
      restartPolicy: Always
      containers:
        - name: searxng
          image: searxng/searxng:latest
          imagePullPolicy: Always
          ports:
            - containerPort: 8080
              name: searxng
              protocol: TCP
          env:
            - name: PUID
              value: "1005"
            - name: PGID
              value: "1005"
            - name: TZ
              value: "Europe/Paris"
          volumeMounts:
            - name: searxng-config
              mountPath: /etc/searxng
      volumes:
        - name: searxng-config
          persistentVolumeClaim:
            claimName: searxng-data
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: backend-deployment
  namespace: search
  labels:
    app: backend-deployment
spec:
  replicas: 1
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 1
  selector:
    matchLabels:
      app: backend-deployment
  template:
    metadata:
      name: backend-deployment
      labels:
        app: backend-deployment
    spec:
      restartPolicy: Always
      containers:
        - name: backend
          image: itzcrazykns1337/perplexica-backend:main
          imagePullPolicy: Always
          ports:
            - containerPort: 3001
              name: backend
              protocol: TCP
          env:
            - name: PUID
              value: "1005"
            - name: PGID
              value: "1005"
            - name: TZ
              value: "Europe/Paris"
            - name: SEARXNG_API_URL
              value: searxng-service.search.svc.cluster.local
          volumeMounts:
            - name: backend-dbstore
              mountPath: /home/perplexica/data
            - name: uploads
              mountPath: /home/perplexica/uploads
            - name: config
              mountPath: /home/perplexica/config.toml
              subPath: config.toml
      volumes:
        - name: backend-dbstore
          persistentVolumeClaim:
            claimName: backend-data
        - name: uploads
          persistentVolumeClaim:
            claimName: backend-media
        - name: config
          configMap:
            name: perplexica-config
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: frontend-deployment
  namespace: search
  labels:
    app: frontend-deployment
spec:
  replicas: 1
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 1
  selector:
    matchLabels:
      app: frontend-deployment
  template:
    metadata:
      name: frontend-deployment
      labels:
        app: frontend-deployment
    spec:
      restartPolicy: Always
      containers:
        - name: frontend
          image: itzcrazykns1337/perplexica-frontend:main
          imagePullPolicy: Always
          ports:
            - containerPort: 3001
              name: frontend
              protocol: TCP
          env:
            - name: NEXT_PUBLIC_API_URL
              value: "https://perplexica-backend.domain/api"
            - name: NEXT_PUBLIC_WS_URL
              value: "wss://perplexica-backend.domain"

for some reason it is still trying to hit 127.0.0.1:3001, is there a way to fix this issue

eleven-am avatar Nov 28 '24 21:11 eleven-am

@timoa its because the docker build file hard codes the args

  perplexica-frontend:
    build:
      context: .
      dockerfile: app.dockerfile
      args:
        - NEXT_PUBLIC_API_URL=http://127.0.0.1:3001/api
        - NEXT_PUBLIC_WS_URL=ws://127.0.0.1:3001
    ill see if i can make a fix so its more k8s friendly

mitchross avatar Jan 03 '25 22:01 mitchross