revoltchat / self-hosted

Deploy Revolt using Docker.
854 stars 108 forks source link

Enhancement: Kubernetes Support & Helm Chart #32

Closed hofq closed 1 year ago

hofq commented 2 years ago

It would be cool if you could publish an Helm Chart & add Kubernetes support to allow scalabale self-hosting

djpbessems commented 1 year ago

I have it running in K8s just fine without a helm chart; just look at the docker-compose.yml and write an appropriate manifest...

In fact, I'll leave you my manifest (I edited out specific details for my setup, so you'll have to re-add volumemounts, configmaps and secrets)

apiVersion: v1
kind: Service
metadata:
  name: revolt
spec:
  ports:
    - protocol: TCP
      name: api
      port: 8000
    - protocol: TCP
      name: events
      port: 9000
    - protocol: TCP
      name: web
      port: 5000
    - protocol: TCP
      name: redis
      port: 6379
  selector:
    app: revolt
---
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: revolt
  name: revolt
spec:
  replicas: 1
  selector:
    matchLabels:
      app: revolt
  template:
    metadata:
      labels:
        app: revolt
    spec:
      containers:
      - image: ghcr.io/revoltchat/server:20220715-1
        name: api
        envFrom:
        - configMapRef:
            name: configmap-revolt-conf
        - secretRef:
            name: secret-revolt-conf
        ports:
        - containerPort: 8000
          name: api
      - image: ghcr.io/revoltchat/bonfire:20220715-1
        name: events
        ports:
        - containerPort: 9000
          name: events
      - image: ghcr.io/revoltchat/client:master
        name: web
        envFrom:
        - configMapRef:
            name: configmap-revolt-conf
        - secretRef:
            name: secret-revolt-conf
        ports:
        - containerPort: 5000
          name: web
      - name: redis
        image: redis:alpine
        ports:
        - name: redis
          containerPort: 6379
      - image: mongo
        name: database
---
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
  name: strip-prefix-revolt
spec:
  stripPrefix:
    prefixes:
      - /api
      - /ws
---
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
  name: revolt
spec:
  entryPoints:
    - websecure
  routes:
  - match: Host(`chat.example.org`)
    kind: Rule
    services:
    - name: revolt
      port: 5000
  - match: Host(`chat.example.org`) && PathPrefix(`/api`)
    kind: Rule
    services:
    - name: revolt
      port: 8000
    middlewares:
    - name: strip-prefix-revolt
  - match: Host(`chat.example.org`) && PathPrefix(`/ws`)
    kind: Rule
    services:
    - name: revolt
      port: 9000
    middlewares:
    - name: strip-prefix-revolt
hofq commented 1 year ago

cool, thank you.