Remote Data Broker a is a low-level service within NDIP
data management solution that is responsible
for serving files to other NDIP components using HTTP protocol.
Remote Data Broker is a low-level service within the NDIP data management solution responsible for serving files to
other NDIP components using the HTTP protocol. It is primarily used when files are not available locally and need to be
transferred from another location. Additionally, it provides the capability to delete remote files.
It is usually used when the files are not available locally but need to be
transferred from some other location.
No newline at end of file
## Architecture
The broker consists of two main components:
1.**Server** – Handles HTTP requests and serves files directly or redirects them to the client via RabbitMQ.
2.**Client** (optional) – Listens to a RabbitMQ (RMQ) queue and processes requests in cases where the broker runs on a
machine restricted by firewall rules from accepting inbound HTTP connections.
## File Access Modes
- If the request is processed by the client, it is assumed to have direct access to the files.
- If the request is processed by the server, access is managed in two ways, depending of a query parameter in the request:
- As the user running the service.
- On behalf of another user via an OIDC token provided in the HTTP request.
For the latter, we use the [oidc-run-as-user](https://code.ornl.gov/ndip/ssh-oidc) utility.
## Configuration
Both the server and client are configured using a JSON file. See the example configuration file [here](conf.sample.json).
## Running the Service
The service is containerized using Docker. To build the image, run:
```bash
docker build -f dockerfiles/Dockerfile -t rdb .
```
To run the service, use:
```bash
docker run -it-p 9000:9000 -v <path to config file>:/config.json rdb /remote-data-broker -config /config.json
```
## REST API
After you start a docker container (see above), you can access the REST API documentation at the address:
http://localhost:9000/swagger/
In NDIP, the Remote Data Broker is used internally by Rucio, via an extra [protocol](https://code.ornl.gov/ndip/rucio-protocols) so there is no need to directly interact with it.