Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

experiment with client-html #83

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
build/
dist/
node_modules/
server/java/bin
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,17 @@ The TicketHub sample application to show off using the Styra OPA SDKs:
* [Java SDK repository](https://github.com/StyraInc/opa-java)
* [Typescript / Javascript SDK repository](https://github.com/StyraInc/opa-typescript)
* [C# SDK repository](https://github.com/StyraInc/opa-csharp)


## Running the Tickethub app

```
docker compose --profile node up
```

```
cd client/react
make run
```

Then open the browser at `http://localhost:3000`
21 changes: 21 additions & 0 deletions client/html/Caddyfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
:{$CLIENT_PORT:3000} {
log {
format console
}

handle /api/* {
reverse_proxy {$SERVER_URL:"localhost:4000"}
}

handle { # catch-all
root * public/

rewrite /ticket/new /new_ticket.html
rewrite /ticket/* /ticket.html
rewrite /tickets /tickets.html

file_server {
index tickets.html
}
}
}
8 changes: 8 additions & 0 deletions client/html/Dockerfile.caddy
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM caddy:2-alpine
RUN mkdir -p /opt/app
WORKDIR /opt/app
COPY public public
COPY Caddyfile Caddyfile
EXPOSE 3000
ENTRYPOINT ["caddy", "run"]

10 changes: 10 additions & 0 deletions client/html/Dockerfile.node
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM node:21-alpine
RUN mkdir -p /opt/app
WORKDIR /opt/app
COPY package.json package-lock.json ./
RUN npm install
COPY src src
COPY public public
EXPOSE 3000
ENV SERVER_HOST "0.0.0.0"
CMD [ "npm", "start"]
6 changes: 1 addition & 5 deletions client/html/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,4 @@ The TicketHub sample app client component.
## How to run

1. `make run`.
2. The server opens a listener on `0.0.0.0:3000`. Turn a browser to `http://localhost:3000` to see it in action.

## SDKs

* [Styra Run js SDK](https://github.com/StyraInc/styra-run-sdk-js)
2. The server opens a listener on `0.0.0.0:3000`. Turn a browser to `http://localhost:3000` to see it in action.
Loading
Loading