From c57ec120de7fadc7b4a14c785a3124d617df305f Mon Sep 17 00:00:00 2001 From: Raul Negron Date: Mon, 24 Oct 2022 13:59:51 -0400 Subject: [PATCH 1/2] jitsu full recipe with readme --- jitsu/jitsu-configmap.yaml | 9 ++++ jitsu/jitsu-deployment.yaml | 51 +++++++++++++++++++++ jitsu/jitsu-service.yaml | 15 +++++++ jitsu/package.json | 18 ++++++++ jitsu/readme.md | 89 +++++++++++++++++++++++++++++++++++++ jitsu/redis-configmap.yaml | 9 ++++ jitsu/redis-deployment.yaml | 33 ++++++++++++++ jitsu/redis-service.yaml | 14 ++++++ jitsu/redis-storage.yaml | 12 +++++ jitsu/run.sh | 65 +++++++++++++++++++++++++++ 10 files changed, 315 insertions(+) create mode 100644 jitsu/jitsu-configmap.yaml create mode 100644 jitsu/jitsu-deployment.yaml create mode 100644 jitsu/jitsu-service.yaml create mode 100644 jitsu/package.json create mode 100644 jitsu/readme.md create mode 100644 jitsu/redis-configmap.yaml create mode 100644 jitsu/redis-deployment.yaml create mode 100644 jitsu/redis-service.yaml create mode 100644 jitsu/redis-storage.yaml create mode 100755 jitsu/run.sh diff --git a/jitsu/jitsu-configmap.yaml b/jitsu/jitsu-configmap.yaml new file mode 100644 index 0000000..f06927a --- /dev/null +++ b/jitsu/jitsu-configmap.yaml @@ -0,0 +1,9 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: jitsu-config + labels: + app: jitsu + namespace: #namespace_name# +data: + jitsu-url: jitsu-service diff --git a/jitsu/jitsu-deployment.yaml b/jitsu/jitsu-deployment.yaml new file mode 100644 index 0000000..5bafd8a --- /dev/null +++ b/jitsu/jitsu-deployment.yaml @@ -0,0 +1,51 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: jitsu + namespace: #namespace_name# +spec: + selector: + matchLabels: + app: jitsu + template: + metadata: + labels: + app: jitsu + spec: + terminationGracePeriodSeconds: 10 + containers: + - name: jitsu + image: jitsucom/jitsu:1.43.0 + imagePullPolicy: Always + ports: + - containerPort: 8000 + name: api + env: + - name: REDIS_URL + value: redis-server + - name: DOCKER_HOST + value: tcp://localhost:2375 + - name: DOCKER_TLS_CERTDIR + value: "" + # volumeMounts: + # - name: logs + # mountPath: /home/eventnative/data/logs + # - name: events + # mountPath: /home/eventnative/data/logs/events + # volumeClaimTemplates: + # - metadata: + # name: logs + # spec: + # storageClassName: longhorn + # accessModes: [ "ReadWriteOnce" ] + # resources: + # requests: + # storage: 3Gi + # - metadata: + # name: events + # spec: + # storageClassName: longhorn + # accessModes: [ "ReadWriteOnce" ] + # resources: + # requests: + # storage: 2Gi diff --git a/jitsu/jitsu-service.yaml b/jitsu/jitsu-service.yaml new file mode 100644 index 0000000..ef298e2 --- /dev/null +++ b/jitsu/jitsu-service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: jitsu-service + namespace: #namespace_name# +spec: + ports: + - name: api + port: 8000 + protocol: TCP + nodePort: 32301 + selector: + app: jitsu + sessionAffinity: None + type: NodePort diff --git a/jitsu/package.json b/jitsu/package.json new file mode 100644 index 0000000..e8d1736 --- /dev/null +++ b/jitsu/package.json @@ -0,0 +1,18 @@ +{ + "name": "jitsu", + "display_name": "jitsu", + "description": "jitsu", + "parameters": [], + "main": "jitsu/run.sh", + "dependencies": [ + "jitsu/run.sh", + "jitsu/jitsu-configmap.yaml", + "jitsu/jitsu-service.yaml", + "jitsu/jitsu-deployment.yaml", + "jitsu/redis-configmap.yaml", + "jitsu/redis-deployment.yaml", + "jitsu/redis-service.yaml", + "jitsu/redis-storage.yaml", + "utils/cachengo.sh" + ] + } \ No newline at end of file diff --git a/jitsu/readme.md b/jitsu/readme.md new file mode 100644 index 0000000..eab7602 --- /dev/null +++ b/jitsu/readme.md @@ -0,0 +1,89 @@ +![Jitsu logo](https://jitsu.com/img/jitsu-responsive.svg "Jitsu Logo") + +## What is Jitsu? + +--- + +an open-source web- and app- event collection platform. Jitsu is designed to be a fast and easy replacement for proprietary analytics stacks such as Google Analytics and Segment. + +## Features + +--- + +Unstructured Event Collection. Jitsu can be used as event gateway for your database. Once an event is sent to Jitsu (via HTTP API or JS SDK), it take cares of the rest: table schema maintenance, batching and/or buffering events (for performance optimization or for reliability). If you want to learn more about how Jitsu works we have an article explaining Jitsu's architecture. + +Data Collection (from external services). Jitsu can collect data from external services via an API and insert it in your database. We support a number of native connectors. Also Jitsu can serve as a bridge to Singer, which is an open source command-line framework for API connectors. + +Transformation and event dispatching. Think of Jitsu as a network router for events. It can send events to multiple destinations based on dynamic rules. Also, it can apply transformations to incoming data streams, including geo-resolution based on IP addresses and rule-based transformations. + +## Installation + +--- + +1. Select the devices to which Jitsu will be installed from 'Devices' page. + +2. Navigate to the 'App Marketplace' tab and select the 'Jitsu' application. + +3. The 'Install Now' button should now appear near the top of the screen. Select this button. + +4. Give your installation a name and fill all the parameters. Click 'Install Jitsu' in the bottom right corner. + +## Required Parameters + +--- + +## Additional Parameters + +--- + +**Installation Name** + +Here you will put your app name. Although the app name is Jitsu on the portal, you can personalize the name that is shown on the device's Applications. + +## Using Jitsu + +--- + + +1. Setup SSH Tunneling between your device and any of your nodes using port 32301: + +E.g. + +``` +ssh -L 8000:127.0.0.1:32301 cachengo@fde5:ef2d:1377:132e:b599:932a:3d4:d540 +``` + +2. In your web browser, navigate to your localhost using the fowarded port. This will redirect you to Jitsu UI. + +E.g. + +``` +http://127.0.0.1:8000/configurator + +``` + + + +## OS Architectures + +--- + +- Arm64 + +## Limitations / Known issues + +--- + +N/A + +## Jitsu Platform Video + +--- + +[![Demo Image](http://img.youtube.com/vi/59cVVUxXxFU/0.jpg)](https://youtu.be/59cVVUxXxFU) + +## Docs + +--- + +For more information: <[https://github.com/jitsucom/jitsu/blob/master/README.md]> diff --git a/jitsu/redis-configmap.yaml b/jitsu/redis-configmap.yaml new file mode 100644 index 0000000..eaec565 --- /dev/null +++ b/jitsu/redis-configmap.yaml @@ -0,0 +1,9 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: redis-config + namespace: #namespace_name# +data: + redis-config: | + maxmemory 2mb + maxmemory-policy allkeys-lru diff --git a/jitsu/redis-deployment.yaml b/jitsu/redis-deployment.yaml new file mode 100644 index 0000000..91e097b --- /dev/null +++ b/jitsu/redis-deployment.yaml @@ -0,0 +1,33 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: redis-server + namespace: #namespace_name# +spec: + replicas: 1 + selector: + matchLabels: + app: redis-server + template: + metadata: + labels: + app: redis-server + name: redis-server + spec: + containers: + - name: redis-server + image: redis:latest + args: ["--appendonly", "yes"] + ports: + - name: redis-server + containerPort: 6379 + volumeMounts: + - name: lv-storage + mountPath: /data + env: + - name: ALLOW_EMPTY_PASSWORD + value: "yes" + volumes: + - name: lv-storage + persistentVolumeClaim: + claimName: redis-pvc diff --git a/jitsu/redis-service.yaml b/jitsu/redis-service.yaml new file mode 100644 index 0000000..f7e16fb --- /dev/null +++ b/jitsu/redis-service.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: Service +metadata: + name: redis-server + namespace: #namespace_name# +spec: + selector: + app: redis-server + type: LoadBalancer + ports: + - name: redis-port + protocol: TCP + port: 6379 + targetPort: 6379 diff --git a/jitsu/redis-storage.yaml b/jitsu/redis-storage.yaml new file mode 100644 index 0000000..e26aeea --- /dev/null +++ b/jitsu/redis-storage.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: redis-pvc + namespace: #namespace_name# +spec: + accessModes: + - ReadWriteOnce + storageClassName: longhorn + resources: + requests: + storage: 1Gi diff --git a/jitsu/run.sh b/jitsu/run.sh new file mode 100755 index 0000000..bd1b0b9 --- /dev/null +++ b/jitsu/run.sh @@ -0,0 +1,65 @@ +#!/bin/bash + +source "utils/cachengo.sh" +source "jitsu/jitsu-configmap.yaml" +source "jitsu/jitsu-service.yaml" +source "jitsu/jitsu-deployment.yaml" +source "jitsu/redis-configmap.yaml" +source "jitsu/redis-deployment.yaml" +source "jitsu/redis-service.yaml" +source "jitsu/redis-storage.yaml" + +function do_install { + set -e + cachengo-cli updateInstallStatus "$APPID" "Installing" + + if [ -n "$NAMESPACE_NAME" ]; then + + kubectl create namespace $NAMESPACE_NAME + sed -i "s|#namespace_name#|$NAMESPACE_NAME|g" jitsu/jitsu-configmap.yaml + sed -i "s|#namespace_name#|$NAMESPACE_NAME|g" jitsu/jitsu-service.yaml + sed -i "s|#namespace_name#|$NAMESPACE_NAME|g" jitsu/jitsu-deployment.yaml + sed -i "s|#namespace_name#|$NAMESPACE_NAME|g" jitsu/redis-configmap.yaml + sed -i "s|#namespace_name#|$NAMESPACE_NAME|g" jitsu/redis-deployment.yaml + sed -i "s|#namespace_name#|$NAMESPACE_NAME|g" jitsu/redis-service.yaml + sed -i "s|#namespace_name#|$NAMESPACE_NAME|g" jitsu/redis-storage.yaml + + else + + sed -i "s|#namespace_name#|default|g" jitsu/jitsu-configmap.yaml + sed -i "s|#namespace_name#|default|g" jitsu/jitsu-service.yaml + sed -i "s|#namespace_name#|default|g" jitsu/jitsu-deployment.yaml + sed -i "s|#namespace_name#|default|g" jitsu/redis-configmap.yaml + sed -i "s|#namespace_name#|default|g" jitsu/redis-deployment.yaml + sed -i "s|#namespace_name#|default|g" jitsu/redis-service.yaml + sed -i "s|#namespace_name#|default|g" jitsu/redis-storage.yaml + + fi + + kubectl apply -f jitsu/jitsu-configmap.yaml + kubectl apply -f jitsu/jitsu-service.yaml + kubectl apply -f jitsu/jitsu-deployment.yaml + kubectl apply -f jitsu/redis-configmap.yaml + kubectl apply -f jitsu/redis-deployment.yaml + kubectl apply -f jitsu/redis-service.yaml + kubectl apply -f jitsu/redis-storage.yaml + +} + +function do_uninstall { + cachengo-cli updateInstallStatus "$APPID" "Uninstalling" + + kubectl delete -f jitsu/jitsu-configmap.yaml + kubectl delete -f jitsu/jitsu-service.yaml + kubectl delete -f jitsu/jitsu-deployment.yaml + kubectl delete -f jitsu/redis-configmap.yaml + kubectl delete -f jitsu/redis-deployment.yaml + kubectl delete -f jitsu/redis-service.yaml + kubectl delete -f jitsu/redis-storage.yaml + + cachengo-cli updateInstallStatus "$APPID" "Uninstalled" +} +case "$1" in + install) do_install ;; + uninstall) do_uninstall ;; +esac \ No newline at end of file From 79d6294759968b5e7b94957f3ca532e0ba7aeb74 Mon Sep 17 00:00:00 2001 From: Raul Negron Date: Mon, 5 Dec 2022 11:47:38 -0400 Subject: [PATCH 2/2] added ingress file --- jitsu/jitsu-ingress.yaml | 28 ++++++++++++++++++++++++++++ jitsu/package.json | 1 + jitsu/run.sh | 5 +++++ 3 files changed, 34 insertions(+) create mode 100644 jitsu/jitsu-ingress.yaml diff --git a/jitsu/jitsu-ingress.yaml b/jitsu/jitsu-ingress.yaml new file mode 100644 index 0000000..c79429c --- /dev/null +++ b/jitsu/jitsu-ingress.yaml @@ -0,0 +1,28 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: jitsu + namespace: #namespace_name# + annotations: + kubernetes.io/ingress.class: "nginx" + # nginx.ingress.kubernetes.io/rewrite-target: /$2 + # nginx.ingress.kubernetes.io/app-root: / + # nginx.ingress.kubernetes.io/use-regex: "true" + # nginx.ingress.kubernetes.io/configuration-snippet: | + # more_set_headers "X-Robots-Tag: noindex, nofollow"; + # nginx.ingress.kubernetes.io/enable-cors: "true" + # nginx.ingress.kubernetes.io/cors-allow-methods: "GET, OPTIONS" + # nginx.ingress.kubernetes.io/cors-allow-origin: "*" + # nginx.ingress.kubernetes.io/cors-allow-credentials: "true" +spec: + rules: + - host: jitsu.mybento.local + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: jitsu + port: + number: 8000 diff --git a/jitsu/package.json b/jitsu/package.json index e8d1736..89fb6b4 100644 --- a/jitsu/package.json +++ b/jitsu/package.json @@ -9,6 +9,7 @@ "jitsu/jitsu-configmap.yaml", "jitsu/jitsu-service.yaml", "jitsu/jitsu-deployment.yaml", + "jitsu/jitsu-ingress.yaml", "jitsu/redis-configmap.yaml", "jitsu/redis-deployment.yaml", "jitsu/redis-service.yaml", diff --git a/jitsu/run.sh b/jitsu/run.sh index bd1b0b9..4fc2310 100755 --- a/jitsu/run.sh +++ b/jitsu/run.sh @@ -4,6 +4,7 @@ source "utils/cachengo.sh" source "jitsu/jitsu-configmap.yaml" source "jitsu/jitsu-service.yaml" source "jitsu/jitsu-deployment.yaml" +source "jitsu/jitsu-ingress.yaml" source "jitsu/redis-configmap.yaml" source "jitsu/redis-deployment.yaml" source "jitsu/redis-service.yaml" @@ -19,6 +20,7 @@ function do_install { sed -i "s|#namespace_name#|$NAMESPACE_NAME|g" jitsu/jitsu-configmap.yaml sed -i "s|#namespace_name#|$NAMESPACE_NAME|g" jitsu/jitsu-service.yaml sed -i "s|#namespace_name#|$NAMESPACE_NAME|g" jitsu/jitsu-deployment.yaml + sed -i "s|#namespace_name#|$NAMESPACE_NAME|g" jitsu/jitsu-ingress.yaml sed -i "s|#namespace_name#|$NAMESPACE_NAME|g" jitsu/redis-configmap.yaml sed -i "s|#namespace_name#|$NAMESPACE_NAME|g" jitsu/redis-deployment.yaml sed -i "s|#namespace_name#|$NAMESPACE_NAME|g" jitsu/redis-service.yaml @@ -29,6 +31,7 @@ function do_install { sed -i "s|#namespace_name#|default|g" jitsu/jitsu-configmap.yaml sed -i "s|#namespace_name#|default|g" jitsu/jitsu-service.yaml sed -i "s|#namespace_name#|default|g" jitsu/jitsu-deployment.yaml + sed -i "s|#namespace_name#|default|g" jitsu/jitsu-ingress.yaml sed -i "s|#namespace_name#|default|g" jitsu/redis-configmap.yaml sed -i "s|#namespace_name#|default|g" jitsu/redis-deployment.yaml sed -i "s|#namespace_name#|default|g" jitsu/redis-service.yaml @@ -39,6 +42,7 @@ function do_install { kubectl apply -f jitsu/jitsu-configmap.yaml kubectl apply -f jitsu/jitsu-service.yaml kubectl apply -f jitsu/jitsu-deployment.yaml + kubectl apply -f jitsu/jitsu-ingress.yaml kubectl apply -f jitsu/redis-configmap.yaml kubectl apply -f jitsu/redis-deployment.yaml kubectl apply -f jitsu/redis-service.yaml @@ -52,6 +56,7 @@ function do_uninstall { kubectl delete -f jitsu/jitsu-configmap.yaml kubectl delete -f jitsu/jitsu-service.yaml kubectl delete -f jitsu/jitsu-deployment.yaml + kubectl delete -f jitsu/jitsu-ingress.yaml kubectl delete -f jitsu/redis-configmap.yaml kubectl delete -f jitsu/redis-deployment.yaml kubectl delete -f jitsu/redis-service.yaml