From 2db557bf513ac41d9436c93771e3483e28adcfae Mon Sep 17 00:00:00 2001 From: Ryabin Sergey Date: Thu, 23 Nov 2023 23:02:49 +0100 Subject: [PATCH 1/8] bump neo4j version --- inventory/classes/neo4j/common.yml | 3 ++- inventory/classes/neo4j/helm.yml | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/inventory/classes/neo4j/common.yml b/inventory/classes/neo4j/common.yml index 1f2cd56..51d7b21 100644 --- a/inventory/classes/neo4j/common.yml +++ b/inventory/classes/neo4j/common.yml @@ -3,6 +3,7 @@ parameters: neo4j_ip4_port: 7687 neo4j_release_name: neo4j neo4j_namespace: neo4j - neo4j_version: 5.11.0 + neo4j_version: 5.13.0 + #neo4j_version: 4.4.0 neo4j_user: neo4j neo4j_password: password diff --git a/inventory/classes/neo4j/helm.yml b/inventory/classes/neo4j/helm.yml index ffbf75d..170603c 100644 --- a/inventory/classes/neo4j/helm.yml +++ b/inventory/classes/neo4j/helm.yml @@ -3,7 +3,9 @@ classes: - helm - neo4j.common parameters: - neo4j_chart_version: 5.11.0 + neo4j_chart_version: 5.13.0 + neo4j_chart_name: neo4j + # neo4j_chart_version: 4.4.27 neo4j_helm_chart_path: files/helm-charts/neo4j bash: @@ -18,4 +20,4 @@ parameters: type: helm source: https://helm.neo4j.com/neo4j version: ${neo4j_chart_version} - chart_name: neo4j + chart_name: ${neo4j_chart_name} From 9b0a4a3bf5090b9c440314e8579bc535759f5a13 Mon Sep 17 00:00:00 2001 From: Ryabin Sergey Date: Thu, 23 Nov 2023 23:03:14 +0100 Subject: [PATCH 2/8] add events and clipboard rabbitmq exchanges --- inventory/classes/rabbitmq/common.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/inventory/classes/rabbitmq/common.yml b/inventory/classes/rabbitmq/common.yml index 6ecba9e..407a286 100644 --- a/inventory/classes/rabbitmq/common.yml +++ b/inventory/classes/rabbitmq/common.yml @@ -58,6 +58,14 @@ parameters: name: openai type: fanout durable: true + clipboard: + name: clipboard + type: fanout + durable: true + events: + name: events + type: fanout + durable: true rabbitmq_version: 3.12.4 rabbitmq_user: user From c65d560f5c9d9930a88952bea827d9080206b7d5 Mon Sep 17 00:00:00 2001 From: Ryabin Sergey Date: Thu, 23 Nov 2023 23:03:35 +0100 Subject: [PATCH 3/8] pass events from http to rabbitmq events exchange --- inventory/targets/vector.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/inventory/targets/vector.yml b/inventory/targets/vector.yml index feaece8..42f7217 100644 --- a/inventory/targets/vector.yml +++ b/inventory/targets/vector.yml @@ -18,6 +18,7 @@ classes: # - vector.tmux-kafka # - vector.console-output - opensearch + - vector.common - vector.config - helm - vector.helm @@ -57,7 +58,6 @@ parameters: ) vector_aggregator_port: ${mindwm:k8s:vector_aggregator_port} - vector_http_server_port: 31398 @@ -313,6 +313,16 @@ parameters: encoding: codec: json + events: + type: amqp + inputs: + - http_server + connection: + connection_string: "amqp://${rabbitmq_user}:${rabbitmq_password}@${rabbitmq_release_name}.${rabbitmq_namespace}:5672/%2f?timeout=10" + exchange: ${rabbitmq_exchanges:events:name} + encoding: + codec: json + # opensearch-tmux-io-context: # type: elasticsearch From b2237eb5114c8f9260b6f9d7a1bd79f102ea25e1 Mon Sep 17 00:00:00 2001 From: Ryabin Sergey Date: Thu, 23 Nov 2023 23:03:59 +0100 Subject: [PATCH 4/8] add apoc extension to neo4j --- inventory/targets/neo4j.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/inventory/targets/neo4j.yml b/inventory/targets/neo4j.yml index d344455..c8a7686 100644 --- a/inventory/targets/neo4j.yml +++ b/inventory/targets/neo4j.yml @@ -17,6 +17,24 @@ parameters: neo4j: name: ${neo4j_release_name} password: ${neo4j_password} + config: + server.directories.plugins: "/var/lib/neo4j/labs" + dbms.security.procedures.unrestricted: "apoc.*" + server.config.strict_validation.enabled: "false" + dbms.security.procedures.allowlist: "apoc.*" + apoc_config: + apoc.export.file.enabled: "true" + apoc.trigger.enabled: "true" + apoc.import.file.enabled: "true" + env: + NEO4J_apoc_export_file_enabled: "true" + NEO4J_apoc_import_file_enabled: "true" + NEO4J_apoc_import_file_use__neo4j__config: "true" + NEO4J_PLUGINS: '["apoc-extended"]' + serviceMonitor: + enabled: false + podDisruptionBudget: + enabled: false volumes: data: mode: defaultStorageClass From f8998b3493cc5b617af5bc55b1740030807fe040 Mon Sep 17 00:00:00 2001 From: Ryabin Sergey Date: Thu, 23 Nov 2023 23:05:55 +0100 Subject: [PATCH 5/8] add basic fvwm target --- files/fvwm/config | 1 + files/fvwm/fvwm-rabbitmq.py | 31 +++++++++++++ inventory/targets/fvwm.yml | 74 ++++++++++++++++++++++++++++++++ lib/jsonnet/bash/scripts.jsonnet | 2 +- templates/bash/script.sh | 1 - 5 files changed, 107 insertions(+), 2 deletions(-) create mode 100644 files/fvwm/config create mode 100644 files/fvwm/fvwm-rabbitmq.py create mode 100644 inventory/targets/fvwm.yml diff --git a/files/fvwm/config b/files/fvwm/config new file mode 100644 index 0000000..8f4f1a2 --- /dev/null +++ b/files/fvwm/config @@ -0,0 +1 @@ +Module FvwmMLF diff --git a/files/fvwm/fvwm-rabbitmq.py b/files/fvwm/fvwm-rabbitmq.py new file mode 100644 index 0000000..4a903a7 --- /dev/null +++ b/files/fvwm/fvwm-rabbitmq.py @@ -0,0 +1,31 @@ +import pika +import pprint +import json +import re +import libtmux +import os +import subprocess + +rabbitmq_url = "amqp://user:password@192.168.49.2:30466/%2f" + +# Create a connection to RabbitMQ +connection = pika.BlockingConnection(pika.URLParameters(rabbitmq_url)) +rabbitmq_channel = connection.channel() + +exchange_name = "events" +result = rabbitmq_channel.queue_declare(queue="", exclusive=True) +queue_name = result.method.queue + +rabbitmq_channel.queue_bind(exchange=exchange_name, queue=queue_name) + +def display_message(message): + command = f'echo "{message}" | bash /home/bebebeko/mindwm/compiled/fvwm/bin/aosd_show.sh' + subprocess.run(command, shell=True) + +def callback(ch, method, properties, body): + pprint.pprint(body.decode()) + display_message(body.decode()) + +rabbitmq_channel.basic_consume(queue=queue_name, on_message_callback=callback, auto_ack=True) +print("Waiting for messages. To exit, press Ctrl+C") +rabbitmq_channel.start_consuming() diff --git a/inventory/targets/fvwm.yml b/inventory/targets/fvwm.yml new file mode 100644 index 0000000..147eacb --- /dev/null +++ b/inventory/targets/fvwm.yml @@ -0,0 +1,74 @@ +--- +classes: + - vim + - bash.functions + - bash.kapitan + - bash.script + - common + - tmuxinator + - tmuxinator.kapitan + - vector.common +parameters: + target_name: fvwm + + bash: + functions: + aosd_show: | + aosd_cat -x 700 -y -600 -e 1 -f 0 -u 500 + fvwm_send: | + FvwmCommand -c -f /tmp/fvwm_mfl.sock + clipnotify_run: | + clipboard_type=$1 + while ${clipnotify_bin} -s $clipboard_type; do + cat</dev/null + done + clipnotify_primary: + clipnotify_run primary + clipnotify_secondary: + clipnotify_run secondary + clipnotify_clipboard: + clipnotify_run clipboard + + + clipnotify_path: ${kapitan_root}/files/github.com/cdown/clipnotify + clipnotify_bin: ${clipnotify_path}/clipnotify + + kapitan: + dependencies: + - source: https://github.com/cdown/clipnotify + type: git + output_path: ${clipnotify_path} + ref: 25ba143c7da8ae0f196cb0db2797d30e6d04e15c + + tmuxinator: + windows: + fvwm: + panes: + - + - cd ${kapitan_root}/files/fvwm + - + - cd ${kapitan_root}/files/fvwm + - + - cd ${kapitan_root}/files/fvwm + clipnotify: + panes: + - + - cd ${clipnotify_path} + - # make + - + - cd ${clipnotify_path} + - + - clipnotify_primary + - + - clipnotify_secondary + - + - clipnotify_clipboard diff --git a/lib/jsonnet/bash/scripts.jsonnet b/lib/jsonnet/bash/scripts.jsonnet index d159d62..5fa511a 100644 --- a/lib/jsonnet/bash/scripts.jsonnet +++ b/lib/jsonnet/bash/scripts.jsonnet @@ -5,7 +5,7 @@ local p = inventory.parameters; { [func_name + ".sh"]: kap.jinja2_template("templates/bash/script.sh", { inventory: inventory, - script: p.bash.functions[func_name] + " $*" + script: p.bash.functions[func_name] }) for func_name in std.objectFieldsAll(p.bash.functions) } diff --git a/templates/bash/script.sh b/templates/bash/script.sh index 8462baa..fe021c3 100755 --- a/templates/bash/script.sh +++ b/templates/bash/script.sh @@ -6,4 +6,3 @@ set -eo pipefail . {{ p.compiled_dir }}/functions.bash {{ script }} - From 519357fc8ce6b7c4ecb9d28bcf97e1a82813b04a Mon Sep 17 00:00:00 2001 From: Ryabin Sergey Date: Thu, 23 Nov 2023 23:26:15 +0100 Subject: [PATCH 6/8] Extract common vector variables into a separate class --- inventory/classes/vector/common.yml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 inventory/classes/vector/common.yml diff --git a/inventory/classes/vector/common.yml b/inventory/classes/vector/common.yml new file mode 100644 index 0000000..53ec169 --- /dev/null +++ b/inventory/classes/vector/common.yml @@ -0,0 +1,4 @@ +--- +parameters: + vector_http_server_port: 31398 + From e98f6f6f1f6d96d6f3f91942527f9716f25a1288 Mon Sep 17 00:00:00 2001 From: Ryabin Sergey Date: Thu, 23 Nov 2023 23:33:57 +0100 Subject: [PATCH 7/8] Increase aosd debug message delay, fix clipboard encode, add aosd-debug pane --- files/fvwm/rabbitmq-osd-debug.py | 30 ++++++++++++++++++++++++++++++ inventory/targets/fvwm.yml | 12 +++++++++--- 2 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 files/fvwm/rabbitmq-osd-debug.py diff --git a/files/fvwm/rabbitmq-osd-debug.py b/files/fvwm/rabbitmq-osd-debug.py new file mode 100644 index 0000000..83134ba --- /dev/null +++ b/files/fvwm/rabbitmq-osd-debug.py @@ -0,0 +1,30 @@ +import pika +import pprint +import json +import re +import libtmux +import os +import subprocess + +rabbitmq_url = "amqp://user:password@192.168.49.2:30466/%2f" + +connection = pika.BlockingConnection(pika.URLParameters(rabbitmq_url)) +rabbitmq_channel = connection.channel() + +exchange_name = "events" +result = rabbitmq_channel.queue_declare(queue="", exclusive=True) +queue_name = result.method.queue + +rabbitmq_channel.queue_bind(exchange=exchange_name, queue=queue_name) + +def display_message(message): + command = f'echo "{message}" | bash /home/bebebeko/mindwm/compiled/fvwm/bin/aosd_show.sh' + subprocess.run(command, shell=True) + +def callback(ch, method, properties, body): + pprint.pprint(body.decode()) + display_message(body.decode()) + +rabbitmq_channel.basic_consume(queue=queue_name, on_message_callback=callback, auto_ack=True) +print("Waiting for messages. To exit, press Ctrl+C") +rabbitmq_channel.start_consuming() diff --git a/inventory/targets/fvwm.yml b/inventory/targets/fvwm.yml index 147eacb..a7f2eab 100644 --- a/inventory/targets/fvwm.yml +++ b/inventory/targets/fvwm.yml @@ -14,18 +14,18 @@ parameters: bash: functions: aosd_show: | - aosd_cat -x 700 -y -600 -e 1 -f 0 -u 500 + aosd_cat -x 700 -y -600 -e 1 -f 0 -u 1000 fvwm_send: | FvwmCommand -c -f /tmp/fvwm_mfl.sock clipnotify_run: | clipboard_type=$1 while ${clipnotify_bin} -s $clipboard_type; do - cat< Date: Thu, 23 Nov 2023 23:52:04 +0100 Subject: [PATCH 8/8] rename script --- files/fvwm/fvwm-rabbitmq.py | 31 ------------------------------- 1 file changed, 31 deletions(-) delete mode 100644 files/fvwm/fvwm-rabbitmq.py diff --git a/files/fvwm/fvwm-rabbitmq.py b/files/fvwm/fvwm-rabbitmq.py deleted file mode 100644 index 4a903a7..0000000 --- a/files/fvwm/fvwm-rabbitmq.py +++ /dev/null @@ -1,31 +0,0 @@ -import pika -import pprint -import json -import re -import libtmux -import os -import subprocess - -rabbitmq_url = "amqp://user:password@192.168.49.2:30466/%2f" - -# Create a connection to RabbitMQ -connection = pika.BlockingConnection(pika.URLParameters(rabbitmq_url)) -rabbitmq_channel = connection.channel() - -exchange_name = "events" -result = rabbitmq_channel.queue_declare(queue="", exclusive=True) -queue_name = result.method.queue - -rabbitmq_channel.queue_bind(exchange=exchange_name, queue=queue_name) - -def display_message(message): - command = f'echo "{message}" | bash /home/bebebeko/mindwm/compiled/fvwm/bin/aosd_show.sh' - subprocess.run(command, shell=True) - -def callback(ch, method, properties, body): - pprint.pprint(body.decode()) - display_message(body.decode()) - -rabbitmq_channel.basic_consume(queue=queue_name, on_message_callback=callback, auto_ack=True) -print("Waiting for messages. To exit, press Ctrl+C") -rabbitmq_channel.start_consuming()