Skip to content

Commit

Permalink
doc: notes for xstate usage in UI and explain networking
Browse files Browse the repository at this point in the history
  • Loading branch information
evanshortiss committed Oct 12, 2023
1 parent b10abd7 commit be869e3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
16 changes: 12 additions & 4 deletions roshambo-ui/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# RPS Game UI

**NOTE:** This application uses XState for managing state. Install the [XState VS Code Plugin](https://marketplace.visualstudio.com/items?itemName=statelyai.stately-vscode)
to ensure that the _StateMachine.typegen.ts_ file is automatically regenerated
when _StateMachine.ts_ is modified.

## Local Development

Requires Node.js 18.12.1 or later. Consider using
Expand Down Expand Up @@ -30,8 +34,8 @@ npm run dev -- --host

### Local Development for iOS Devices

iOS disables access to the camera and accelerometer APIs when a site is not
served via HTTPS.
iOS disables camera and accelerometer API access when a site is not served over
HTTPS.

To serve the application in development mode with SSL/HTTPS enabled, use this
command:
Expand All @@ -40,6 +44,9 @@ command:
npm run dev:ssl -- --host
```

You'll need to accept the self-signed certificate when you visit the
application on your iOS device.

## Running with Podman/Docker

Build the backend:
Expand All @@ -50,7 +57,8 @@ mvn clean package
podman build . -f src/main/docker/Dockerfile.jvm -t rps-backend
```

Run the backend container:
Run the backend container, and optionally expose its port 8080 on host port
8181:

```bash
podman run --rm -p 8181:8080 --name rps-backend rps-backend
Expand All @@ -63,7 +71,7 @@ cd roshambo-ui
podman build . -t rps-ui
```

Start the frontend (making sure to pass the backend host):
Start the frontend, making sure to pass the backend host and port:

```bash
export BACKEND_IP=$(podman inspect --format='{{.NetworkSettings.IPAddress}}' rps-backend)
Expand Down
5 changes: 3 additions & 2 deletions roshambo-ui/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ http {

# This is necessary to ensure that RPS_BACKEND_HOST is resolved. NGINX
# fails to resolve the hostname despite the NGINX container having the
# OpenShift nameserver in /etc/resolve.conf, so it must be injected!
# OpenShift nameserver in /etc/resolve.conf, so it must be injected
# into this conf file when the container is starting!
resolver $NAMESERVERS valid=10s;

# Load configuration files for the default server block.
Expand All @@ -58,7 +59,7 @@ http {

# The RPS_BACKEND_HOST variable is replaced by envsubst when the
# container image starts. The RPS_BACKEND_HOST variable must be
# defined as a runtime variable!
# defined as a runtime environment variable!
proxy_pass "$RPS_BACKEND_HOST$request_uri";

# Required for correct handling of server-sent events
Expand Down

0 comments on commit be869e3

Please sign in to comment.