Skip to content

Commit 2755dd7

Browse files
authored
server/README.md: Document non-Docker setup (#403)
Previously, we only documented how to run the server via Docker. This adds a short tutorial how to run the server directly from `./server/app/interfaces/repository.py` without the Docker setup. Fixes #386
1 parent 6f5e4b8 commit 2755dd7

File tree

1 file changed

+28
-4
lines changed

1 file changed

+28
-4
lines changed

server/README.md

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Alternatively, the container can also be told to use the [Local-File Backend][2]
1313
See [below](#options) on how to configure this.
1414

1515
## Building
16+
1617
The container image can be built via:
1718
```
1819
$ docker build -t basyx-python-server -f Dockerfile ..
@@ -23,17 +24,20 @@ Note that when cloning this repository on Windows, Git may convert the line sepa
2324
## Running
2425

2526
### Storage
27+
2628
The container needs to be provided with the directory `/storage` to store AAS and Submodel files: AASX, JSON, XML or JSON files of Local-File Backend.
2729

2830
This directory can be mapped via the `-v` option from another image or a local directory.
2931
To map the directory `storage` inside the container, `-v ./storage:/storage` can be used.
3032
The directory `storage` will be created in the current working directory, if it doesn't already exist.
3133

3234
### Port
35+
3336
The HTTP server inside the container listens on port 80 by default.
3437
To expose it on the host on port 8080, use the option `-p 8080:80` when running it.
3538

3639
### Options
40+
3741
The container can be configured via environment variables:
3842
- `API_BASE_PATH` determines the base path under which all other API paths are made available.
3943
Default: `/api/v3.0`
@@ -61,15 +65,15 @@ Per default, the server will use the `LOCAL_FILE_READ_ONLY` storage type and ser
6165
$ docker run -p 8080:80 -v ./storage2:/storage2 -e API_BASE_PATH=/api/v3.1 -e STORAGE_TYPE=LOCAL_FILE_BACKEND -e STORAGE_PATH=/storage2 basyx-python-server
6266
```
6367

64-
## Building and running the image with docker-compose
68+
## Building and Running the Image with Docker Compose
6569

6670
The container image can also be built and run via:
6771
```
6872
$ docker compose up
6973
```
7074

71-
This is the exemplary `docker-compose` file for the server:
72-
````yaml
75+
This is the exemplary `compose.yml` file for the server:
76+
```yaml
7377
services:
7478
app:
7579
build:
@@ -79,13 +83,33 @@ services:
7983
- "8080:80"
8084
volumes:
8185
- ./storage:/storage
82-
````
86+
```
8387
8488
Here files are read from `/storage` and the server can be accessed at http://localhost:8080/api/v3.0/ from your host system.
8589
To get a different setup this compose.yaml file can be adapted and expanded.
8690

8791
Note that the `Dockerfile` has to be specified explicitly, as the build context must be set to the parent directory of `/server` to allow access to the local `/sdk`.
8892

93+
## Running without Docker (Debugging Only)
94+
95+
The server can also be run directly on the host system without Docker, NGINX and supervisord. Although this is not suitable for production, it may be useful for debugging.
96+
97+
> [!warning]
98+
> Not supported for production systems!
99+
100+
1. Install the local SDK and the local server package.
101+
```bash
102+
$ pip install ../sdk
103+
$ pip install ./app
104+
```
105+
106+
2. Run the server by executing the main function in [`./app/interfaces/repository.py`](./app/interfaces/repository.py) from within the current folder.
107+
```bash
108+
$ python -m app.interfaces.repository
109+
```
110+
111+
The server can be accessed at http://localhost:8080/api/v3.0/ from your host system.
112+
89113
## Acknowledgments
90114

91115
This Dockerfile is inspired by the [tiangolo/uwsgi-nginx-docker][10] repository.

0 commit comments

Comments
 (0)