Skip to content

Commit

Permalink
opa-react-demo: add RP connect and djblue/portal for DL viewing
Browse files Browse the repository at this point in the history
This introduces an out-of-band web UI for inspecting decision logs.
When the services are up, you can view the decision logs via Portal
on http://127.0.0.1:5678.
  • Loading branch information
srenatus committed Jul 18, 2024
1 parent e1c8d50 commit 7236e0c
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 0 deletions.
20 changes: 20 additions & 0 deletions opa-react-demo/connect.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
input:
broker:
inputs:
- http_server:
path: /post/logs
processors:
- decompress:
algorithm: gzip
- unarchive:
format: json_array

buffer:
memory: {}

output:
http_client:
url: http://portal:5678/submit
verb: POST
headers:
"Content-Type": application/json
18 changes: 18 additions & 0 deletions opa-react-demo/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,26 @@ services:
- --server
- --addr=:8181
- --log-level=debug
- --config-file=/eopa.yml
- /policies
volumes:
- ./policies:/policies
- ./eopa.yml:/eopa.yml
environment:
EOPA_LICENSE_KEY: ${EOPA_LICENSE_KEY}

portal:
build: portal
ports:
- "5678:5678"

connect:
image: docker.redpanda.com/redpandadata/redpanda:latest
ports:
- "4195:4195"
command:
- connect
- run
- /connect.yml
volumes:
- ./connect.yml:/connect.yml
8 changes: 8 additions & 0 deletions opa-react-demo/eopa.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
services:
- name: connect
url: http://connect:4195/post
decision_logs:
service: connect
reporting:
min_delay_seconds: 0
max_delay_seconds: 1
7 changes: 7 additions & 0 deletions opa-react-demo/portal/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM clojure:tools-deps-bullseye-slim
WORKDIR /app
COPY . .

EXPOSE 5678
# TODO(sr): build at build time, run uberjar here
ENTRYPOINT ["clj", "-X", "start/run"]
1 change: 1 addition & 0 deletions opa-react-demo/portal/deps.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{:deps {djblue/portal {:mvn/version "0.57.0"}}}
6 changes: 6 additions & 0 deletions opa-react-demo/portal/src/start.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
(ns start
(:require [portal.api :as p]))

(defn run [_]
(p/start {:port 5678})
@(promise))

0 comments on commit 7236e0c

Please sign in to comment.