Commit ce38e862 authored by hengwen's avatar hengwen

More info on nginx

parent 983e3537
......@@ -79,7 +79,11 @@ Several options are available in there.
## Docker
Since the server depends on multiple services, it is a good choice to run them all in docker
containers. We can start all dependencies with docker at once:
containers. First built docker images with `rpc/build.sh` and `restful/build.sh` and then
edit the last line in `dev.yml` to add path to your local visualization files.
You can comment out the nginx service if you don't need visualization,
but in that case, please also uncomment line 49 of `dev.yml`
Finally, start the project with:
```
$ docker-compose -f dev.yml up
```
......@@ -90,11 +94,6 @@ $ docker-compose -f dev.yml up --scale rmi-server=10 rmi-server
$ docker-compose -f dev.yml up --scale rpc-server=3 rpc-server
```
To build the docker image, first build the jar with maven and then:
```
$ ./build.sh
```
## Developing with Docker
The development always involves debugging, with docker, debugging has to be done via remote debugger.
`dev.yml` already configured the restful server to run in debug mode, the JVM listens for debugging request
......@@ -129,11 +128,6 @@ rpc-server-debugger:
```
It starts a rpc server that listen on port **8788** for debugging.
## Test
```
$ ./run_test.sh
```
## Visualization
By default, visualization is not enabled in the server.
To enable visualization, put the static files under `restful/src/main/resources/resources`.
......@@ -143,6 +137,18 @@ copy everything from [webapp directory](https://git.rwth-aachen.de/monticore/Emb
`restful/src/main/resources/resources`.
Start the restful server, the visualization client will be available at [http://127.0.0.1:8090/index.html](http://127.0.0.1:8090/index.html)
It is highly recommended for frontend developers to use reverse proxy to serve
the frontend files. Because otherwise, you need to recompile the restful module
every time you changed something in your code. For example, to use nginx as reverse proxy,
we provided a configuration(`nginx.conf`) for that.
You should
1. update `root /app` to point it to your static files, such as `root /path/to/visualization/src/webapp`
2. update `proxy_pass http://server:8090;` to fit your case. If you started the restful server with `java -jar ...jar` command,
it should be `proxy_pass http://127.0.0.1:8090;`
After you installed nginx, start it with this config file.
If you use docker, you only need to update the last line of `dev.yml` in order to
use nginx.
## Simulation via RESTful API
After the server started, simulation tasks can be configured via the RESTful APIs.
......@@ -160,3 +166,11 @@ The sequence should be:
The APIs are defined using OpenAPI2.0 in `openapi.yml`.
However, the restful server also provides an auto generated API documentation page at
[http://127.0.0.1:8090/swagger-ui.html](http://127.0.0.1:8090/swagger-ui.html).
## Tips
### Scenarios and Maps
There are couple of scenarios and maps that you can play with. They are located
in `restful/src/test/resources`. Maps have `.osm` suffix, `.sim` suffix are for scenarios.
### Editing scenario files
`https://www.openstreetmap.org/node/[node id]` will help you with finding source and target coordinates for vehicles easily.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment