Skip to content

Commit b7d2659

Browse files
committed
chore(docs): rewrite installation page; set mermaid and markdown_extensions plugins
1 parent 2902f62 commit b7d2659

2 files changed

Lines changed: 68 additions & 72 deletions

File tree

docs/installation.md

Lines changed: 63 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,106 +1,97 @@
1-
# Installation
1+
# Installation & Setup
22

3-
## Service Snapshot
3+
The service runs with Docker Compose. The default setup validates metadata documents only; enabling object storage adds validation of complete stored crates. If you are upgrading from a 1.\* release, see the [upgrade guide](upgrading.md) first.
44

5-
Cratey Validator is a web service that checks whether RO-Crates follow the
6-
expected structure and metadata rules. It can validate a complete RO-Crate
7-
stored in MinIO-compatible object storage, or it can validate the contents
8-
of an `ro-crate-metadata.json` file directly.
5+
## Quick start
96

10-
At a high level, a client sends a validation request, the service runs the
11-
RO-Crate validation checks, and the result is either returned directly or
12-
saved so it can be retrieved later.
7+
You will need Docker with Docker Compose.
138

14-
## What You Can Validate
9+
First, clone the repository, copy the example environment file, and start the stack:
1510

16-
### Stored RO-Crates
17-
18-
Use this option when the RO-Crate already exists in MinIO-compatible object
19-
storage. The service reads the crate from the configured bucket, runs the
20-
validation checks, and saves the validation result back to object storage.
21-
22-
This is useful for validating complete crates as part of an upload, review,
23-
or publication workflow.
11+
```bash
12+
git clone https://github.com/eScienceLab/RO-Crate-Validation-Service.git
13+
cd RO-Crate-Validation-Service
14+
cp example.env .env
15+
docker compose up --build
16+
```
2417

18+
!!! warning
19+
You should update the default `.env` values when running the object store in production.
2520

26-
### Metadata Files
21+
The API is served at `http://localhost:5001`. Redis and a Celery worker are also started, but are only used once storage is enabled. To check the service is up:
2722

28-
Use this option when you only need to check the contents of
29-
`ro-crate-metadata.json`. Instead of asking the service to download a full
30-
crate, you submit the metadata JSON directly and receive the validation result
31-
in the response.
23+
```bash
24+
curl http://localhost:5001/healthz
25+
```
3226

33-
This is useful for quick checks while editing metadata or before a complete
34-
crate has been assembled.
27+
This returns `{"status": "ok"}`.
3528

29+
To validate some metadata, post the contents of an `ro-crate-metadata.json` file to the metadata endpoint. The [running example](https://www.researchobject.org/ro-crate/specification/1.2/introduction.html#running-example) from the RO-Crate specification is a good test document. The file needs to be sent as an escaped JSON string, which `jq` can do:
3630

37-
### Saved Validation Results
31+
```bash
32+
jq -Rs '{crate_json: .}' ro-crate-metadata.json | curl -X POST http://localhost:5001/v1/ro_crates/validate_metadata -H 'Content-Type: application/json' -d @-
33+
```
3834

39-
After a stored RO-Crate has been validated, the saved validation result can be
40-
retrieved later. This lets another application or user interface show the most
41-
recent validation status without rerunning the checks.
35+
The response contains a `status` of `valid`, `invalid` or `error`, along with the detailed findings. The [API reference](api.md) describes the endpoints and result format in full.
4236

37+
## Enabling object storage
4338

44-
## Before You Start
39+
To validate a complete RO-Crate (zip or directory) held in an object store, set `STORAGE_ENABLED=true` in `.env`. Storage mode requires six settings, [described below](#configuration-reference): `S3_ENDPOINT`, `S3_ACCESS_KEY`, `S3_SECRET_KEY`, `S3_BUCKET`, `CELERY_BROKER_URL` and `CELERY_RESULT_BACKEND`. The service will fail at startup if any are missing. The Compose stack already sets the Celery variables to the bundled Redis, so in practice only the S3 settings in `.env` matter here.
4540

46-
For stored RO-Crate validation, you need:
41+
Then start the stack with the bundled development object store (RustFS):
4742

48-
- A MinIO-compatible object store.
49-
- A bucket containing the RO-Crate.
50-
- Access credentials for that bucket.
51-
- The crate identifier used by the object store.
43+
```bash
44+
docker compose --profile objectstore up --build
45+
```
5246

53-
For metadata-only validation, you only need the contents of
54-
`ro-crate-metadata.json`.
47+
RustFS serves the S3 API on port 9000 and a web console at `http://localhost:9001`. Development credentials are set in `example.env`.
5548

49+
!!! warning
50+
The service does not create the bucket itself. Create the bucket in the console or with any S3 client. The bucket name needs to match `S3_BUCKET` (`ro-crates` by default).
5651

57-
## Running The Service
52+
Upload an RO-Crate under the crate prefix: `crates/<id>.zip` for a zipped RO-Crate, or `crates/<id>/` for a directory. Note that for a zipped RO-Crate, `ro-crate-metadata.json` must be at the root of the archive.
5853

59-
The service can be started with Docker Compose:
54+
The readiness endpoint checks the object store and broker connections:
6055

6156
```bash
62-
docker compose up --build
57+
curl http://localhost:5001/readyz
6358
```
6459

65-
For local container development, use:
66-
67-
```bash
68-
docker compose --file docker-compose-develop.yml up --build
69-
```
60+
## Using your own object store
7061

71-
Expected local services:
62+
Any S3-compatible store can be used in place of RustFS, including AWS S3, MinIO and Ceph: set `S3_ENDPOINT`, the credentials and `S3_BUCKET` for your store, and skip the `objectstore` profile. If you already run a 1.\* release against MinIO, the [upgrade guide](upgrading.md) maps the old settings to the new ones.
7263

73-
- Flask API: `http://localhost:5001`
74-
- MinIO API: `http://localhost:9000`
75-
- MinIO console: `http://localhost:9001`
76-
- Redis: `localhost:6379`
64+
## Configuration reference
7765

78-
MinIO needs a bucket for RO-Crates, normally `ro-crates`. Bucket versioning
79-
should be enabled so uploaded crate objects can be tracked reliably.
66+
| Variable | Default | Description |
67+
|----------|---------|-------------|
68+
| `STORAGE_ENABLED` | `false` | Enable the stored-crate endpoints and storage checks |
69+
| `S3_ENDPOINT` || Object store endpoint, e.g. `objectstore:9000` (required in storage mode) |
70+
| `S3_ACCESS_KEY` || Object store access key (required in storage mode) |
71+
| `S3_SECRET_KEY` || Object store secret key (required in storage mode) |
72+
| `S3_BUCKET` || Bucket holding crates and results (required in storage mode) |
73+
| `S3_USE_SSL` | `false` | Use HTTPS to the object store |
74+
| `S3_REGION` || Region; needed for AWS S3 |
75+
| `S3_CRATE_PREFIX` | `crates` | Key prefix crates are read from |
76+
| `S3_RESULTS_PREFIX` | `validation-results` | Key prefix results are written to |
77+
| `CELERY_BROKER_URL` || Redis broker URL (required in storage mode; preset in the Compose stack) |
78+
| `CELERY_RESULT_BACKEND` || Celery result backend URL (required in storage mode; preset in the Compose stack) |
79+
| `PROFILES_PATH` || Profiles directory that replaces the bundled profiles |
80+
| `EXTRA_PROFILES_PATH` || Profiles directory added to the bundled profiles |
81+
| `CACHE_PATH` | `/app/.rocrate-cache` in the published image | Validator HTTP cache location |
82+
| `VALIDATION_OFFLINE` | `false` | Validate using only the cache, with no network access |
83+
| `FLASK_ENV` | `development` | Set to `production` to disable debug behaviour |
8084

85+
## Custom profiles
8186

82-
## Configuration
87+
The validator comes with the base RO-Crate profiles. For Five Safes validation, the prebuilt `ghcr.io/esciencelab/ro-crate-validation-service-fivesafes-profile` image has the `five-safes-crate` profile already included; see [Five Safes validation](five-safes.md).
8388

84-
The main environment variables are:
89+
Adding other profiles works by mounting a directory of profile definitions into both the `flask` and `celery_worker` containers. You set `EXTRA_PROFILES_PATH` to the mounted path. Both containers need the mount as metadata-only validation runs in the API process and stored-crate validation runs in the worker. There is a working example in `docker-compose-develop.yml`.
8590

86-
- `FLASK_APP`: Flask entrypoint, normally `cratey.py`.
87-
- `FLASK_ENV`: selects development or production config.
88-
- `CELERY_BROKER_URL`: Redis broker URL.
89-
- `CELERY_RESULT_BACKEND`: Redis result backend URL.
90-
- `PROFILES_PATH`: optional path to custom RO-Crate validator profile
91-
definitions.
92-
- `MINIO_ENDPOINT`: default MinIO endpoint used by Docker examples.
93-
- `MINIO_ROOT_USER`: MinIO root username for local development.
94-
- `MINIO_ROOT_PASSWORD`: MinIO root password.
95-
- `MINIO_BUCKET_NAME`: default bucket name used by local setup.
91+
`EXTRA_PROFILES_PATH` adds the directory to the bundled profiles, whereas `PROFILES_PATH` replaces them entirely.
9692

97-
API calls also pass MinIO access details in `minio_config`, so the service can validate crates in a specified object store and bucket.
93+
## Offline validation
9894

99-
## More Information
95+
The validator fetches profile and context resources over HTTP and caches them. The published images pre-populate this cache at build time, so setting `VALIDATION_OFFLINE=true` runs validation entirely from the cache, with no network access at runtime. This is useful inside TREs and other restricted networks.
10096

101-
- For endpoint paths, request bodies, response codes, validation profiles, and
102-
result storage paths, see the [REST API documentation](./rest_api).
103-
- For implementation details, service components, runtime flow, and test
104-
coverage, see the [Architecture documentation](./architecture).
105-
- For deployment context and the architecture diagram, see
106-
[Deployment](./deployment).
97+
Online validation (the default) also uses and refreshes the same cache. Offline validation requires `rocrate-validator` at 0.10.0 or later, which the published images include.

mkdocs.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,8 @@ nav:
66
- ENTRUST: entrust.md
77
- Contributions: contribution.md
88
theme: readthedocs
9+
plugins:
10+
- search
11+
- mermaid2
12+
markdown_extensions:
13+
- admonition

0 commit comments

Comments
 (0)