diff --git a/Dockerfile b/Dockerfile index e927529..f14e23f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ # 1st stage, build the app -FROM container-registry.oracle.com/java/openjdk:23 as build +FROM container-registry.oracle.com/java/openjdk:23 AS build # Install maven WORKDIR /usr/share diff --git a/README.md b/README.md index fc48b66..c6b6bf5 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Introduction +This repository was used as the basis for two talks at [Cloud Native Rejects Paris 2024](https://cfp.cloud-native.rejekts.io/cloud-native-rejekts-eu-paris-2024/talk/LXXPWR/) and [Open Source Monitoring Conference 2024](https://osmc.de/talks/fluent-bit-the-engine-to-power-chat-ops/). + The demo for [Cloud Native Rejects Paris 2024 talk](https://cfp.cloud-native.rejekts.io/cloud-native-rejekts-eu-paris-2024/talk/review/PP8T37LPQUSTTRWBXVCHFJSSKDM9B98J). The [actual presentation is available in this repo](./docs/Fluent_Bit_for_ChatOps-Cloud_Native_Rejekts_EU_2024.pdf). @@ -30,3 +32,39 @@ SYNTH_ALERT_PORT= ``` Once this is done, just run up `docker compose up` to start sending an alert and responding. + +Once running, you will see a report of an issue like so and can tell it to fix it up: + +![Example chatops slack responses](./docs/slack_example.png) + +Specify a command to run using the syntax `FLBNode:: FLBCmd:`, this syntax is arbitrary and just an example for usage in the demo. + +```shell +FLBNode:node1:8090 FLBCmd:fix_permissions +``` + +The command will show you it is running (just a dummy here as an example): + +```shell +node1-1 | [0] alert: [[1731410091.996160421, {}], {"ERROR"=>"testfile.txt has incorrect permissions"}] +... +http-slack-server-1 | 2024.11.12 11:15:24 INFO com.oracle.flb.chatops.FLBSocialCommandResource VirtualThread[#63,[0x4de53a24 0x79177571] WebServer socket]/runnable@ForkJoinPool-1-worker-4: Actioning: +http-slack-server-1 | {"isOk" : "true", "command":"fix_permissions", "FLBNode"="node1:8090"} +http-slack-server-1 | 2024.11.12 11:15:24 INFO com.oracle.flb.chatops.FLBSocialCommandResource VirtualThread[#63,[0x4de53a24 0x79177571] WebServer socket]/runnable@ForkJoinPool-1-worker-4: Thread : [0x4de53a24 0x79177571] WebServer socket ending <<<<<<<<<<<<< +node1-1 | [2024/11/12 11:15:24] [ info] [output:http:http.1] http-slack-server:8080, HTTP status=200 +node1-1 | {postAlertNoId= 11-14-53} +node1-1 | { +node1-1 | command = "fix_permissions", +node1-1 | tagged = "11-14-53", +node1-1 | time = "11-15-24", +node1-1 | = { +node1-1 | type = 2 +node1-1 | } +node1-1 | } +node1-1 | Will execute fix_permissions +node1-1 | running: /fluent-bit/etc/cmd_fix_permissions.sh > /logs//remoteCommand.lua.out +node1-1 | [0] command: [[1731410124.293250380, {}], {"command"=>"fix_permissions", "time"=>"11-15-24", "tagged"=>"11-14-53"}] +node1-1 | [2024/11/12 11:15:24] [ info] [input:tail:tail.3] inotify_fs_add(): inode=2 watch_fd=1 name=/logs//remoteCommand.lua.out +node1-1 | [0] results: [[1731410124.999926256, {}], {"log"=>"chmod a+w testfile.txt"}] +... +``` diff --git a/docker-compose.yaml b/docker-compose.yaml index 62c3163..c26e6e0 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,8 +1,9 @@ -version: '2' - services: node1: - image: ghcr.io/calyptia/core/calyptia-fluent-bit:24.2.3 # OR fluent/fluent-bit:2.2.2-debug + # Using Chronosphere LTS image + image: ghcr.io/calyptia/core/calyptia-fluent-bit:24.11.1 + # OR any image with a shell, e.g. + # image: fluent/fluent-bit:3.1.10-debug ports: # HTTP server communication - ':8090' @@ -21,8 +22,10 @@ services: working_dir: /fluent-bit/etc/ http-slack-server: + # A pre-built image is pushed automatically by the repo + image: ghcr.io/fluent/fluent-bit-chatops-demo + # Otherwise build locally build: - # image: ghcr.io/fluent/fluent-bit-chatops-demo context: . dockerfile: Dockerfile ports: diff --git a/docs/slack_example.png b/docs/slack_example.png new file mode 100644 index 0000000..8f5993d Binary files /dev/null and b/docs/slack_example.png differ