From 60226b3ca9dd95cbb4c125f4d6feaca3824afb0b Mon Sep 17 00:00:00 2001 From: SeanOMik Date: Wed, 26 Jun 2024 20:24:55 -0400 Subject: [PATCH] feat(huginn): split huginn into agent pods for better performance --- .../default/huginn/agent-helm-release.yaml | 41 +++++++++++++++++++ .../apps/default/huginn/env-configmap.yaml | 20 +++++++++ cluster/apps/default/huginn/helm-release.yaml | 25 ++--------- .../apps/default/huginn/kustomization.yaml | 4 +- 4 files changed, 68 insertions(+), 22 deletions(-) create mode 100644 cluster/apps/default/huginn/agent-helm-release.yaml create mode 100644 cluster/apps/default/huginn/env-configmap.yaml diff --git a/cluster/apps/default/huginn/agent-helm-release.yaml b/cluster/apps/default/huginn/agent-helm-release.yaml new file mode 100644 index 0000000..b2ec677 --- /dev/null +++ b/cluster/apps/default/huginn/agent-helm-release.yaml @@ -0,0 +1,41 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/bjw-s/helm-charts/main/charts/other/app-template/schemas/helmrelease-helm-v2beta2.schema.json +apiVersion: helm.toolkit.fluxcd.io/v2beta2 +kind: HelmRelease +metadata: + name: huginn-agent + namespace: default +spec: + interval: 5m + chart: + spec: + chart: app-template + version: 3.1.0 + sourceRef: + kind: HelmRepository + name: bjws-charts + namespace: flux-system + + values: + controllers: + main: + replicas: 3 + + pod: + securityContext: + runAsNonRoot: true + + containers: + main: + image: + repository: ghcr.io/huginn/huginn-single-process + tag: 5a1509b51188e0d16868be893c983d6fcfd232a5 + + command: + - /scripts/init + - bin/threaded.rb + + envFrom: + - secretRef: + name: huginn-env + - configMapRef: + name: huginn-env diff --git a/cluster/apps/default/huginn/env-configmap.yaml b/cluster/apps/default/huginn/env-configmap.yaml new file mode 100644 index 0000000..511ca38 --- /dev/null +++ b/cluster/apps/default/huginn/env-configmap.yaml @@ -0,0 +1,20 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: huginn-env + namespace: default +data: + DATABASE_ADAPTER: postgresql + DATABASE_HOST: postgresql.database + DATABASE_PORT: "5432" + + DATABASE_NAME: huginn + DATABASE_RECONNECT: "true" + # Specified in huginn-env secret + # DATABASE_USERNAME: + # DATABASE_PASSWORD: + + #TIMEZONE: ${SERVER_TIMEZONE} + USE_GRAPHVIZ_DOT: dot + USE_EVERNOTE_SANDBOX: "false" # set to production + RAILS_ENV: production \ No newline at end of file diff --git a/cluster/apps/default/huginn/helm-release.yaml b/cluster/apps/default/huginn/helm-release.yaml index a920533..b5c736b 100644 --- a/cluster/apps/default/huginn/helm-release.yaml +++ b/cluster/apps/default/huginn/helm-release.yaml @@ -29,31 +29,14 @@ spec: containers: main: image: - repository: ghcr.io/huginn/huginn - tag: 0533a3768537f7a6a157227bfd9a9caefada768f - - command: - - /scripts/init - - bin/threaded.rb - - env: - DATABASE_ADAPTER: postgresql - DATABASE_HOST: postgresql.database - DATABASE_PORT: 5432 - - DATABASE_NAME: huginn - DATABASE_RECONNECT: true - # Specified in huginn-env - # DATABASE_USERNAME: - # DATABASE_PASSWORD: - - #TIMEZONE: ${SERVER_TIMEZONE} - USE_GRAPHVIZ_DOT: dot - USE_EVERNOTE_SANDBOX: false # set to production + repository: ghcr.io/huginn/huginn-single-process + tag: 5a1509b51188e0d16868be893c983d6fcfd232a5 envFrom: - secretRef: name: huginn-env + - configMapRef: + name: huginn-env service: app: diff --git a/cluster/apps/default/huginn/kustomization.yaml b/cluster/apps/default/huginn/kustomization.yaml index 8eb891c..e06efe9 100644 --- a/cluster/apps/default/huginn/kustomization.yaml +++ b/cluster/apps/default/huginn/kustomization.yaml @@ -1,5 +1,7 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: +- ./env-configmap.sops.yaml - ./env-secret.sops.yaml -- ./helm-release.yaml \ No newline at end of file +- ./helm-release.yaml +- ./agent-helm-release.yaml \ No newline at end of file