From 84b5f5f139032fa414448bf35b3473fa6085cdeb Mon Sep 17 00:00:00 2001 From: Joseph Hanson Date: Thu, 5 Sep 2024 05:41:21 -0500 Subject: [PATCH] add searxng --- kubernetes/apps/default/kustomization.yaml | 1 + .../default/searxng/app/externalsecret.yaml | 19 +++ .../apps/default/searxng/app/helmrelease.yaml | 112 ++++++++++++++++++ .../default/searxng/app/kustomization.yaml | 15 +++ .../searxng/app/resources/limiter.toml | 6 + .../searxng/app/resources/settings.yml | 51 ++++++++ kubernetes/apps/default/searxng/ks.yaml | 28 +++++ 7 files changed, 232 insertions(+) create mode 100644 kubernetes/apps/default/searxng/app/externalsecret.yaml create mode 100644 kubernetes/apps/default/searxng/app/helmrelease.yaml create mode 100644 kubernetes/apps/default/searxng/app/kustomization.yaml create mode 100644 kubernetes/apps/default/searxng/app/resources/limiter.toml create mode 100644 kubernetes/apps/default/searxng/app/resources/settings.yml create mode 100644 kubernetes/apps/default/searxng/ks.yaml diff --git a/kubernetes/apps/default/kustomization.yaml b/kubernetes/apps/default/kustomization.yaml index 4be3a429..0fb696e7 100644 --- a/kubernetes/apps/default/kustomization.yaml +++ b/kubernetes/apps/default/kustomization.yaml @@ -21,3 +21,4 @@ resources: - ./it-tools/ks.yaml - ./excalidraw/ks.yaml - ./recyclarr/ks.yaml + - ./searxng/ks.yaml diff --git a/kubernetes/apps/default/searxng/app/externalsecret.yaml b/kubernetes/apps/default/searxng/app/externalsecret.yaml new file mode 100644 index 00000000..982251f8 --- /dev/null +++ b/kubernetes/apps/default/searxng/app/externalsecret.yaml @@ -0,0 +1,19 @@ +--- +# yaml-language-server: $schema=https://ks.hsn.dev/external-secrets.io/externalsecret_v1beta1.json +apiVersion: external-secrets.io/v1beta1 +kind: ExternalSecret +metadata: + name: searxng +spec: + secretStoreRef: + kind: ClusterSecretStore + name: onepassword-connect + target: + name: searxng-secret + template: + engineVersion: v2 + data: + SEARXNG_SECRET: "{{ .SEARXNG_SECRET }}" + dataFrom: + - extract: + key: searxng diff --git a/kubernetes/apps/default/searxng/app/helmrelease.yaml b/kubernetes/apps/default/searxng/app/helmrelease.yaml new file mode 100644 index 00000000..bd2e5994 --- /dev/null +++ b/kubernetes/apps/default/searxng/app/helmrelease.yaml @@ -0,0 +1,112 @@ +--- +# 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/v2 +kind: HelmRelease +metadata: + name: searxng +spec: + interval: 30m + chart: + spec: + chart: app-template + version: 3.4.0 + sourceRef: + kind: HelmRepository + name: bjw-s + namespace: flux-system + install: + remediation: + retries: 3 + upgrade: + cleanupOnFail: true + remediation: + retries: 3 + strategy: rollback + values: + controllers: + searxng: + annotations: + reloader.stakater.com/auto: "true" + containers: + app: + image: + repository: docker.io/searxng/searxng + tag: 2024.7.7-ef103ba80 + envFrom: + - secretRef: + name: searxng-secret + env: + TZ: America/Chicago + SEARXNG_BASE_URL: https://search.jahanson.tech + SEARXNG_URL: https://search.jahanson.tech + SEARXNG_PORT: &port 8080 + probes: + liveness: &probes + enabled: true + custom: true + spec: + httpGet: + path: /stats + port: *port + initialDelaySeconds: 0 + periodSeconds: 10 + timeoutSeconds: 1 + failureThreshold: 3 + readiness: *probes + startup: + enabled: false + securityContext: + allowPrivilegeEscalation: false + readOnlyRootFilesystem: true + capabilities: + drop: + - ALL + add: + - CHOWN + - SETGID + - SETUID + - DAC_OVERRIDE + resources: + requests: + cpu: 10m + limits: + memory: 3Gi + service: + app: + controller: searxng + ports: + http: + port: *port + ingress: + app: + enabled: true + className: internal-nginx + hosts: + - host: &host "search.jahanson.tech" + paths: + - path: / + service: + identifier: app + port: http + tls: + - hosts: + - *host + persistence: + config: + type: configMap + name: searxng-configmap + advancedMounts: + searxng: + app: + - path: /etc/searxng/settings.yml + subPath: settings.yml + readOnly: true + - path: /etc/searxng/limiter.toml + subPath: limiter.toml + readOnly: true + tmp: + type: emptyDir + advancedMounts: + searxng: + app: + - path: /etc/searxng diff --git a/kubernetes/apps/default/searxng/app/kustomization.yaml b/kubernetes/apps/default/searxng/app/kustomization.yaml new file mode 100644 index 00000000..cc085e4e --- /dev/null +++ b/kubernetes/apps/default/searxng/app/kustomization.yaml @@ -0,0 +1,15 @@ +--- +# yaml-language-server: $schema=https://json.schemastore.org/kustomization +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - ./externalsecret.yaml + - ./helmrelease.yaml + - ../../../../templates/gatus/internal +configMapGenerator: + - name: searxng-configmap + files: + - settings.yml=./resources/settings.yml + - limiter.toml=./resources/limiter.toml +generatorOptions: + disableNameSuffixHash: true diff --git a/kubernetes/apps/default/searxng/app/resources/limiter.toml b/kubernetes/apps/default/searxng/app/resources/limiter.toml new file mode 100644 index 00000000..190f8df5 --- /dev/null +++ b/kubernetes/apps/default/searxng/app/resources/limiter.toml @@ -0,0 +1,6 @@ +# This configuration file updates the default configuration file +# See https://github.com/searxng/searxng/blob/master/searx/limiter.toml + +[botdetection.ip_limit] +# activate link_token method in the ip_limit method +link_token = true diff --git a/kubernetes/apps/default/searxng/app/resources/settings.yml b/kubernetes/apps/default/searxng/app/resources/settings.yml new file mode 100644 index 00000000..553e14e6 --- /dev/null +++ b/kubernetes/apps/default/searxng/app/resources/settings.yml @@ -0,0 +1,51 @@ +--- +use_default_settings: true + +server: + limiter: false + image_proxy: true + +redis: + url: redis://dragonfly.database.svc.cluster.local:6379?db=10 + +search: + safe_search: 0 + autocomplete: brave + formats: + - html + - json + +general: + instance_name: HansonSearch + +ui: + static_use_hash: true + default_theme: simple + theme_args: + simple_style: dark + infinite_scroll: true + results_on_new_tab: true + +enabled_plugins: + - Basic Calculator + - Hash plugin + - Hostnames plugin + - Open Access DOI rewrite + - Self Informations + - Tracker URL remover + - Unit converter plugin + +hostnames: + high_priority: + - (.*)\/blog\/(.*) + - (.*\.)?wikipedia.org$ + - (.*\.)?github.com$ + - (.*\.)?reddit.com$ + - (.*\.)?linuxserver.io$ + - (.*\.)?docker.com$ + - (.*\.)?archlinux.org$ + - (.*\.)?stackoverflow.com$ + - (.*\.)?askubuntu.com$ + - (.*\.)?superuser.com$ + replace: + (www\.)?reddit\.com$: red.hsn.dev diff --git a/kubernetes/apps/default/searxng/ks.yaml b/kubernetes/apps/default/searxng/ks.yaml new file mode 100644 index 00000000..b1da4b9e --- /dev/null +++ b/kubernetes/apps/default/searxng/ks.yaml @@ -0,0 +1,28 @@ +--- +# yaml-language-server: $schema=https://ks.hsn.dev/kustomize.toolkit.fluxcd.io/kustomization_v1.json +apiVersion: kustomize.toolkit.fluxcd.io/v1 +kind: Kustomization +metadata: + name: &app searxng + namespace: flux-system +spec: + targetNamespace: default + commonMetadata: + labels: + app.kubernetes.io/name: *app + dependsOn: + - name: dragonfly + - name: external-secrets-stores + path: ./kubernetes/apps/default/searxng/app + prune: true + sourceRef: + kind: GitRepository + name: theshire + wait: false + interval: 30m + retryInterval: 1m + timeout: 5m + postBuild: + substitute: + APP: *app + GATUS_SUBDOMAIN: search