-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Run npm audit fix --force * Dockerify the demo * Update readme * Reword
- Loading branch information
Showing
5 changed files
with
437 additions
and
334 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
FROM node:22 | ||
|
||
# Create app directory | ||
RUN mkdir -p /usr/src/app | ||
WORKDIR /usr/src/app | ||
|
||
# Install app dependencies | ||
COPY package.json /usr/src/app/ | ||
RUN npm install | ||
|
||
# Bundle app source | ||
COPY . /usr/src/app | ||
|
||
EXPOSE 3000 | ||
CMD [ "npm", "start" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,23 @@ | ||
# `@styra/opa-react` Demos | ||
|
||
This React application is show-casing specific features of `@styra/opa-react`. | ||
This React application showcases the request batching feature of `@styra/opa-react` when used with the [Enterprise OPA Batch API](https://docs.styra.com/enterprise-opa/reference/api-reference/batch-api). | ||
|
||
Currently, it includes a demo of batching requests when used with [Enterprise OPA](https://docs.styra.com/enterprise-opa), or a custom implemetation of its [Batch API](https://docs.styra.com/enterprise-opa/reference/api-reference/batch-api). | ||
## How to use | ||
|
||
### Docker | ||
|
||
## How to use | ||
1. Set `$EOPA_LICENSE_KEY` | ||
1. Run `docker compose up` | ||
1. Go to <http://127.0.0.1:3000> | ||
|
||
1. Download and start Enterprise OPA with the `policies` loaded: `eopa run --log-level debug --server policies/` | ||
2. Start the app: `npm install && npm run start` | ||
3. Go to http://127.0.0.1:3000 | ||
### Binaries | ||
|
||
1. [Download Enterprise OPA](https://docs.styra.com/enterprise-opa/how-to/install/local) | ||
1. Set `$EOPA_LICENSE_KEY` or sign up for a trial by running `eopa license trial` | ||
1. Start Enterprise OPA with the `policies` loaded: `eopa run --log-level debug --server policies/` | ||
1. Start the app: `npm install && npm run start` | ||
1. Go to <http://127.0.0.1:3000> | ||
|
||
## Note on using OPA | ||
|
||
You can use the demo apps with OPA. The only thing that won't work is enabling batching. | ||
You can use the demo app with the open source Open Policy Agent, however batching mode will not work. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
services: | ||
react-demo: | ||
build: . | ||
expose: | ||
- 3000 | ||
depends_on: | ||
- eopa | ||
command: | ||
- npm | ||
- start | ||
network_mode: host | ||
|
||
eopa: | ||
image: ghcr.io/styrainc/enterprise-opa:latest | ||
expose: | ||
- 8181 | ||
ports: | ||
- "8181:8181" | ||
command: | ||
- run | ||
- --server | ||
- --addr=:8181 | ||
- --log-level=debug | ||
- /policies | ||
working_dir: / | ||
volumes: | ||
- ./policies:/policies | ||
environment: | ||
EOPA_LICENSE_KEY: ${EOPA_LICENSE_KEY} |
Oops, something went wrong.