Skip to content
Open
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
5 changes: 4 additions & 1 deletion .github/actions/build-server/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ runs:
id: build
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a #v7.3.0
with:
context: .
context: ./server
build-contexts: |
sdk=./sdk
license=.
file: ./server/docker/${{ inputs.server-profile }}/Dockerfile
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
Expand Down
7 changes: 4 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,13 @@ To test that the server is working, we expect to at least be able to build the d
of it without error.

For that, you need to have Docker installed on your system.
In the directory with the `Dockerfile`:
In the `server` directory:
```bash
ruff check
docker build -t basyx-python-server .
docker run --name basyx-python-server basyx-python-server
docker build -t basyx-python-repository -f docker/repository/Dockerfile --build-context sdk=../sdk --build-context license=.. .
docker run --name basyx-python-repository basyx-python-repository
```
Replace `repository` with `discovery` or `registry` to test the other server profiles.
Wait until you see the line:
```
INFO success: quit_on_failure entered RUNNING state
Expand Down
14 changes: 8 additions & 6 deletions server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,22 @@ See [below](#options) on how to configure this.
Pre-built images are published to [Docker Hub][11] on every release.
Pull the latest version via:
```
$ docker pull eclipsebasyx/basyx-python-server:latest
$ docker pull eclipsebasyx/basyx-python-repository:latest
```

Or pin to a specific release by replacing `<version>` with the desired release number:
```
$ docker pull eclipsebasyx/basyx-python-server:<version>
$ docker pull eclipsebasyx/basyx-python-repository:<version>
```

## Building

If you need to build the image locally (e.g. for development), run:
If you need to build an image locally (e.g. for development) run the following build command in this directory:
```
$ docker build -t basyx-python-server -f Dockerfile ..
$ docker build -t basyx-python-repository -f docker/repository/Dockerfile --build-context sdk=../sdk --build-context license=.. .
```
Note that the image is built from the `server` directory. The local `sdk` directory is passed in as an additional build context named `sdk`.
To include the package license, a second additional build context `license` passes in the repository root.

Note that when cloning this repository on Windows, Git may convert the line separators to CRLF. This breaks [`entrypoint.sh`](docker/repository/entrypoint.sh) and [`stop-supervisor.sh`](docker/common/stop-supervisor.sh). Ensure both files use LF line separators (`\n`) before building.

Expand Down Expand Up @@ -96,7 +98,7 @@ The server can also be run directly on the host system without Docker, NGINX and
1. Install the local SDK and the local server package.
```bash
$ pip install ../sdk
$ pip install ./app
$ pip install .
```

2. Run the server by executing the main function in [`./app/interfaces/repository.py`](./app/interfaces/repository.py).
Expand Down Expand Up @@ -148,7 +150,7 @@ This Dockerfile is inspired by the [tiangolo/uwsgi-nginx-docker][10] repository.
[8]: https://basyx-python-sdk.readthedocs.io/en/latest/adapter/json.html
[9]: https://basyx-python-sdk.readthedocs.io/en/latest/adapter/xml.html
[10]: https://github.com/tiangolo/uwsgi-nginx-docker
[11]: https://hub.docker.com/r/eclipsebasyx/basyx-python-server
[11]: https://hub.docker.com/r/eclipsebasyx/basyx-python-repository
[12]: https://app.swaggerhub.com/apis/Plattform_i40/AssetAdministrationShellRegistryServiceSpecification/V3.1.1_SSP-001
[13]: https://app.swaggerhub.com/apis/Plattform_i40/DiscoveryServiceSpecification/V3.1.1_SSP-001
[14]: https://app.swaggerhub.com/apis/Plattform_i40/SubmodelRegistryServiceSpecification/V3.1.1_SSP-001
18 changes: 9 additions & 9 deletions server/docker/discovery/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ RUN apk update && \
pip install uwsgi && \
apk del git bash

COPY ./LICENSE /LICENSE
COPY ./sdk /sdk
COPY ./server/app /server/app
COPY ./server/pyproject.toml /server/pyproject.toml
COPY ./server/docker/discovery/uwsgi.ini /etc/uwsgi/
COPY ./server/docker/common/supervisord.ini /etc/supervisor/conf.d/supervisord.ini
COPY ./server/docker/common/stop-supervisor.sh /etc/supervisor/stop-supervisor.sh
COPY --from=sdk . /sdk
COPY --from=license ./LICENSE /server/LICENSE
COPY ./app /server/app
COPY ./pyproject.toml /server/pyproject.toml
COPY ./docker/discovery/uwsgi.ini /etc/uwsgi/
COPY ./docker/common/supervisord.ini /etc/supervisor/conf.d/supervisord.ini
COPY ./docker/common/stop-supervisor.sh /etc/supervisor/stop-supervisor.sh
RUN chmod +x /etc/supervisor/stop-supervisor.sh

# Makes it possible to use a different configuration
Expand All @@ -36,7 +36,7 @@ ENV LISTEN_PORT=80
ENV CLIENT_BODY_BUFFER_SIZE=1M

# Copy the entrypoint that will generate Nginx additional configs
COPY server/docker/common/entrypoint.sh /entrypoint.sh
COPY ./docker/common/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]
Expand All @@ -47,4 +47,4 @@ WORKDIR /server/app
RUN pip install ../../sdk
RUN pip install ..

CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.ini"]
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.ini"]
18 changes: 9 additions & 9 deletions server/docker/registry/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ RUN apk update && \
pip install uwsgi && \
apk del git bash

COPY ./LICENSE /LICENSE
COPY ./sdk /sdk
COPY ./server/app /server/app
COPY ./server/pyproject.toml /server/pyproject.toml
COPY ./server/docker/registry/uwsgi.ini /etc/uwsgi/
COPY ./server/docker/common/supervisord.ini /etc/supervisor/conf.d/supervisord.ini
COPY ./server/docker/common/stop-supervisor.sh /etc/supervisor/stop-supervisor.sh
COPY --from=sdk . /sdk
COPY --from=license ./LICENSE /server/LICENSE
COPY ./app /server/app
COPY ./pyproject.toml /server/pyproject.toml
COPY ./docker/registry/uwsgi.ini /etc/uwsgi/
COPY ./docker/common/supervisord.ini /etc/supervisor/conf.d/supervisord.ini
COPY ./docker/common/stop-supervisor.sh /etc/supervisor/stop-supervisor.sh
RUN chmod +x /etc/supervisor/stop-supervisor.sh

# Makes it possible to use a different configuration
Expand All @@ -43,7 +43,7 @@ ENV STORAGE_OVERWRITE=False
VOLUME ["/input", "/storage"]

# Copy the entrypoint that will generate Nginx additional configs
COPY server/docker/common/entrypoint.sh /entrypoint.sh
COPY ./docker/common/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]
Expand All @@ -54,4 +54,4 @@ WORKDIR /server/app
RUN pip install ../../sdk
RUN pip install ..

CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.ini"]
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.ini"]
16 changes: 8 additions & 8 deletions server/docker/repository/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ RUN apk update && \

# Copy only the files we need to run the container
# The argumentation for this is to keep the containers as slim as possible.
COPY ./LICENSE /LICENSE
COPY ./sdk /sdk
COPY ./server/app /server/app
COPY ./server/pyproject.toml /server/pyproject.toml
COPY ./server/docker/repository/uwsgi.ini /etc/uwsgi/
COPY ./server/docker/common/supervisord.ini /etc/supervisor/conf.d/supervisord.ini
COPY ./server/docker/common/stop-supervisor.sh /etc/supervisor/stop-supervisor.sh
COPY --from=sdk . /sdk
COPY --from=license ./LICENSE /server/LICENSE
COPY ./app /server/app
COPY ./pyproject.toml /server/pyproject.toml
COPY ./docker/repository/uwsgi.ini /etc/uwsgi/
COPY ./docker/common/supervisord.ini /etc/supervisor/conf.d/supervisord.ini
COPY ./docker/common/stop-supervisor.sh /etc/supervisor/stop-supervisor.sh
RUN chmod +x /etc/supervisor/stop-supervisor.sh

# Makes it possible to use a different configuration
Expand All @@ -45,7 +45,7 @@ ENV STORAGE_OVERWRITE=False
VOLUME ["/input", "/storage"]

# Copy the entrypoint that will generate Nginx additional configs
COPY server/docker/common/entrypoint.sh /entrypoint.sh
COPY ./docker/common/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]
Expand Down
14 changes: 8 additions & 6 deletions server/example_configurations/discovery_standalone/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,21 @@ The Discovery Service stores and retrieves relations between AAS identifiers and


## Configuration
This example Docker compose configuration starts a discovery server.

The container image can also be built and run via:
The example Docker compose configuration `compose.dev.yml` builds a discovery server locally. This is usually only necessary
for development:
```
$ docker compose up
$ docker compose up -f compose.dev.yml
```
To just run the discovery server, use the pre-built image `eclipsebasyx/basyx-python-discovery:latest`
on [DockerHub](https://hub.docker.com/r/eclipsebasyx/basyx-python-discovery).

## Persistence

The discovery service can run in persistent or non-persistent mode.

### Persistent Mode

Persistent mode configuration is provided in the `compose.yaml`.
Persistent mode configuration is provided in the `compose.dev.yaml`.

Only the AAS-to-asset-ID mapping is persisted. The reverse lookup index is rebuilt in memory when the service starts.

Expand All @@ -43,4 +44,5 @@ If `storage_path` is not set, the discovery service runs in memory only.

## Notes
- Stop the service before manually editing `discovery_store.json`.

- Note that the image is built from the `server` directory. The local `sdk` directory is passed in as an additional build context named `sdk`.
To include the package license, a second additional build context `license` passes in the repository root.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ name: basyx-python-server
services:
app:
build:
context: ../../..
dockerfile: server/docker/discovery/Dockerfile
context: ../..
additional_contexts:
- sdk=../../../sdk
- license=../../..
dockerfile: ./docker/discovery/Dockerfile
ports:
- "8084:80"
environment:
Expand Down
15 changes: 8 additions & 7 deletions server/example_configurations/registry_standalone/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,17 @@ The Registry Service provides the endpoint for a given AAS-ID or Submodel-ID. Su

## Configuration

This example Docker compose configuration starts a registry server.

The container image can also be built and run via:
The example Docker compose configuration `compose.dev.yml` builds a registry server locally. This is usually only necessary
for development:
```
$ docker compose up
$ docker compose up -f compose.dev.yml
```
To just run the registry server, use the pre-built image `eclipsebasyx/basyx-python-registry:latest`
on [DockerHub](https://hub.docker.com/r/eclipsebasyx/basyx-python-registry).

Input files are read from `./input` and stored persistently under `./storage` on your host system.
The server can be accessed at http://localhost:8083/api/v3.1.1/ from your host system.
To get a different setup, the `compose.yaml` file can be adapted using the options described in the main server [README.md](../../README.md#options).

Note that the `Dockerfile` has to be specified explicitly via `dockerfile: server/docker/repository/Dockerfile`, as the build context must be set to the repository root to allow access to the local `/sdk`.
To get a different setup, the `compose.dev.yaml` file can be adapted using the options described in the main server [README.md](../../README.md#options).

Note that the image is built from the `server` directory. The local `sdk` directory is passed in as an additional build context named `sdk`.
To include the package license, a second additional build context `license` passes in the repository root.
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
services:
app:
build:
context: ../../..
dockerfile: server/docker/registry/Dockerfile
context: ../..
additional_contexts:
- sdk=../../../sdk
- license=../../..
dockerfile: ./docker/registry/Dockerfile
ports:
- "8083:80"
volumes:
Expand Down
14 changes: 7 additions & 7 deletions server/example_configurations/repository_standalone/README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Repository Standalone

This example Docker compose configuration starts a repository server.

The container image can also be built and run via:
The example Docker compose configuration `compose.dev.yml` builds a repository server locally. This is usually only necessary
for development:
```
$ docker compose up
$ docker compose up -f compose.dev.yml
```
To just run the repository server, use the pre-built image `eclipsebasyx/basyx-python-repository`
on [DockerHub](https://hub.docker.com/r/eclipsebasyx/basyx-python-repository).

Input files are read from `./input` and stored persistently under `./storage` on your host system.
The server can be accessed at http://localhost:8080/api/v3.0/ from your host system.
To get a different setup, the `compose.yaml` file can be adapted using the options described in the main server [README.md](../../README.md#options).

Note that the `Dockerfile` has to be specified explicitly via `dockerfile: server/docker/repository/Dockerfile`, as the build context must be set to the repository root to allow access to the local `/sdk`.

Note that the image is built from the `server` directory. The local `sdk` directory is passed in as an additional build context named `sdk`.
To include the package license, a second additional build context `license` passes in the repository root.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ name: basyx-python-server
services:
app:
build:
context: ../../..
dockerfile: server/docker/repository/Dockerfile
context: ../..
additional_contexts:
- sdk=../../../sdk
- license=../../..
dockerfile: ./docker/repository/Dockerfile
ports:
- "8080:80"
volumes:
Expand Down
1 change: 1 addition & 0 deletions server/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ requires-python = ">=3.11"
dependencies = [
"urllib3>=1.26,<3",
"Werkzeug>=3.0.3,<4",
"basyx-python-sdk>=1.0.0" # TODO: declare proper cross-package dependencies (see issue #592)
]

[project.optional-dependencies]
Expand Down
Loading