diff --git a/opa-react-demo/connect.yml b/opa-react-demo/connect.yml new file mode 100644 index 0000000..88c5a09 --- /dev/null +++ b/opa-react-demo/connect.yml @@ -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 diff --git a/opa-react-demo/docker-compose.yaml b/opa-react-demo/docker-compose.yaml index 7fb0835..412b512 100644 --- a/opa-react-demo/docker-compose.yaml +++ b/opa-react-demo/docker-compose.yaml @@ -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 diff --git a/opa-react-demo/eopa.yml b/opa-react-demo/eopa.yml new file mode 100644 index 0000000..bdfbe2e --- /dev/null +++ b/opa-react-demo/eopa.yml @@ -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 diff --git a/opa-react-demo/portal/Dockerfile b/opa-react-demo/portal/Dockerfile new file mode 100644 index 0000000..ff936ef --- /dev/null +++ b/opa-react-demo/portal/Dockerfile @@ -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"] diff --git a/opa-react-demo/portal/deps.edn b/opa-react-demo/portal/deps.edn new file mode 100644 index 0000000..b8acca5 --- /dev/null +++ b/opa-react-demo/portal/deps.edn @@ -0,0 +1 @@ +{:deps {djblue/portal {:mvn/version "0.57.0"}}} diff --git a/opa-react-demo/portal/src/start.clj b/opa-react-demo/portal/src/start.clj new file mode 100644 index 0000000..241c789 --- /dev/null +++ b/opa-react-demo/portal/src/start.clj @@ -0,0 +1,6 @@ +(ns start + (:require [portal.api :as p])) + +(defn run [_] + (p/start {:port 5678}) + @(promise))