Skip to content
Draft
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
30 changes: 29 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,42 @@ The application is implemented using [React](https://reactjs.org/).

## Development

### Install dependencies
### Without Docker

#### Install dependencies

You'll need to install the project's dependencies before you can run the server:

```console
npm install
```

### Docker

First [start your backend server](https://github.com/burningmantech/ranger-ims-server#development) with `docker-compose`, then start your frontend server. This will create the required docker network.

#### Install dependencies

You'll need to install the project's dependencies before you can run the server:

```console
docker compose run --rm app npm install
```

#### Start the frontend server

```console
docker compose up app -d
```

#### Troubleshooting

##### Network error with all docker commands

`Error response from daemon: network rangers not found`

If you see this error you did not start the backend server in docker first.

### Running the Test Suite

To run all of the tests:
Expand Down
20 changes: 20 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: "3.7"

services:
app:
container_name: "ranger_ims_web"
image: "${NODE_IMG_TAG:-node:18.18.2-alpine3.17}"
user: ":${NODE_GROUP_ID:-1420}"
ports:
- "${NODE_PORT:-3000}:3000"
environment:
- "BACKEND_URL=${BACKEND_URL:-http://ranger_ims_server:8080}"
volumes:
- "./:/app:cached"
command: "npm start"
working_dir: "/app"

networks:
default:
external: true
name: "${DOCKER_RANGERS_NETWORK:-rangers}"
3 changes: 3 additions & 0 deletions docker-dev-sample.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# BACKEND_URL="http://ranger_ims_server:8080"
# NODE_PORT=3000
# DOCKER_RANGERS_NETWORK="rangers"
10 changes: 6 additions & 4 deletions src/setupProxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@

const { createProxyMiddleware } = require("http-proxy-middleware");

const backendUrl = process.env.BACKEND_URL || "http://127.0.0.1:8080";

module.exports = function (app) {
app.use(
"/ims/api",
createProxyMiddleware({
target: "http://127.0.0.1:8080",
target: backendUrl,
changeOrigin: true,
}),
);
Expand All @@ -16,21 +18,21 @@ module.exports = function (app) {
app.use(
"/ims/auth",
createProxyMiddleware({
target: "http://127.0.0.1:8080",
target: backendUrl,
changeOrigin: true,
}),
);
app.use(
"/ims/ext",
createProxyMiddleware({
target: "http://127.0.0.1:8080",
target: backendUrl,
changeOrigin: true,
}),
);
app.use(
"/ims/static",
createProxyMiddleware({
target: "http://127.0.0.1:8080",
target: backendUrl,
changeOrigin: true,
}),
);
Expand Down