Skip to content

Commit 3207350

Browse files
committed
v13: upgrade recipe improvements
1 parent d679794 commit 3207350

File tree

4 files changed

+98
-172
lines changed

4 files changed

+98
-172
lines changed

docs/install/requirements.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ For running and building the application locally you will also need:
3838
InvenioRDM depends on the following services. During the installation we start these services in containers, but you could as well use externally hosted services for them:
3939
4040
- Databases: PostgreSQL 12+
41-
- Search: OpenSearch (2.0+)
41+
- Search: OpenSearch (2.12+)
4242
- Cache: Redis, memcached
4343
- Message broker: RabbitMQ, Redis
4444
- Storage systems: Network storage, S3, XRootD, and more

docs/operate/customize/jobs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ celery -A invenio_app.celery beat --scheduler invenio_jobs.services.scheduler:Ru
2020
```
2121

2222
!!! note
23-
Be sure to run this additional Celery beat scheduler in your production or deployed environment. Without it, scheduled and on-demand jobs will not be executed.
23+
Be sure to run this additional Celery beat scheduler in your production or deployed environments. Without it, scheduled and on-demand jobs will not be executed.
2424

2525
## How to create a new job
2626
This guide walks developers through implementing a new job using the engine provided by the `invenio-jobs` module. Jobs are asynchronous tasks that can be triggered from the admin UI or REST API. They run using Celery and support logging, argument validation, and result tracking.

docs/releases/v13/upgrade-v13.0.md

Lines changed: 92 additions & 168 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,24 @@
11
# Upgrading from v12 to v13.0
22

3-
!!! warning "THIS RECIPE IS A WORK IN PROGRESS"
4-
53
## Prerequisites
64

75
The steps listed in this article require an existing local installation of InvenioRDM v12.
86

97
!!! warning "Backup"
108

11-
Always backup your database and files before you try to perform an upgrade.
9+
Always backup your database, statistics indices and files before you try to perform an upgrade.
1210

1311
!!! info "Older Versions"
14-
15-
In case you have an InvenioRDM installation older than v12, you can gradually upgrade
16-
to v12 and afterwards continue from here.
17-
18-
!!! read through the whole upgrade steps before upgrading
12+
If your InvenioRDM installation is older than v12, you must first upgrade to v12 before proceeding with the steps in this guide.
1913

2014
## Upgrade Steps
2115

22-
Make sure you have the latest `invenio-cli` installed. For InvenioRDM v13, it
23-
should be v1.7.0+
16+
Make sure you have the latest `invenio-cli` installed. For InvenioRDM v13,
17+
it should be v1.7.0+.
2418

2519
```bash
2620
$ invenio-cli --version
27-
invenio-cli, version 1.7.0
21+
invenio-cli, version 1.7.2
2822
```
2923

3024
!!! info "Virtual environments"
@@ -50,17 +44,20 @@ running `invenio-cli` or `pipenv` commands below.
5044

5145
### Upgrade InvenioRDM
5246

53-
Python 3.9 or 3.11 or 3.12 is required to run InvenioRDM v12.
47+
#### Requirements
48+
Python 3.9 or 3.11 or 3.12 is required to run InvenioRDM v13.
5449

55-
Note: endoflife of python3.9 will be 31. October 2025. There will be no
56-
python3.9 related updates done after that date.
50+
!!! info "Python 3.9 end-of-life"
51+
Official support for Python 3.9 will end on October 31, 2025.
52+
See the [official Python version status page](https://devguide.python.org/versions/) for more information.
53+
Future releases of InvenioRDM will require a more recent Python version.
5754

58-
There are two options to upgrade your system:
55+
The minimum required OpenSearch version is now **v2.12**. See [below](#opensearch-version) on how to upgrade older versions.
5956

6057
#### Upgrade option 1: In-place
61-
62-
This approach upgrades the dependencies in place. Your virtual environment for the
63-
v12 version will be gone afterwards.
58+
This approach upgrades the dependencies in place. At the end of the process,
59+
your virtual environment for the v12 version will be completely replaced
60+
with the v13 environment and dependencies.
6461

6562
```bash
6663
cd <my-site>
@@ -94,7 +91,7 @@ Update the file `<my-site>/Pipfile`.
9491
+++invenio-app-rdm = {extras = [...], version = "~=13.0.0"}
9592
```
9693

97-
If you're using Sentry, update invenio-logging in `<my-site>/Pipfile` to
94+
If you're using [Sentry](https://sentry.io) (tool for monitoring or error tracking), update invenio-logging in `<my-site>/Pipfile` to
9895

9996
```diff
10097
---invenio-logging = {extras = ["sentry_sdk"], version = "~=2.0"}
@@ -133,186 +130,113 @@ Execute the data migration:
133130
invenio shell $(find $(pipenv --venv)/lib/*/site-packages/invenio_app_rdm -name migrate_12_0_to_13_0.py)
134131
```
135132

133+
### Rebuild search indices
136134

137-
### Configuration change for `nginx`
138-
139-
The new PDF file previewer is based on `pdfjs-dist` v4, which uses ECMAScript modules (`.mjs`) over CommonJS files (`.js`).
140-
These files are not registered in the [default configuration](https://github.com/nginx/nginx/blob/master/conf/mime.types#L8) for `nginx`.
141-
This can result in the MIME type being reported incorrectly, and thus being blocked by the browser, leading to a broken PDF preview.
142-
143-
Luckily, this can be simply fixed by adding a custom [`types`](https://nginx.org/en/docs/http/ngx_http_core_module.html#types) entry;
144-
e.g. in the `http` block in [`nginx.conf`](https://github.com/inveniosoftware/cookiecutter-invenio-rdm/blob/master/%7B%7Bcookiecutter.project_shortname%7D%7D/docker/nginx/nginx.conf)
145-
(cf. this [Cookiecutter PR](https://github.com/inveniosoftware/cookiecutter-invenio-rdm/pull/299)).
146-
147-
```nginx
148-
include /etc/nginx/mime.types;
149-
default_type application/octet-stream;
150-
types {
151-
# Tell nginx that ECMAScript modules are also JS
152-
application/javascript js mjs;
153-
}
154-
```
155-
156-
### if you plan to use `APP_RDM_DEPOSIT_NG_FILES_UI_ENABLED`
157-
158-
you have to add following
159-
160-
```
161-
"script-src": [
162-
"'self'", "blob:", "'wasm-unsafe-eval'" # for WASM-based workers, e.g. hash-wasm
163-
],
135+
```bash
136+
invenio index destroy --yes-i-know
137+
invenio index init
138+
# if you have records custom fields
139+
invenio rdm-records custom-fields init
140+
# if you have communities custom fields
141+
invenio communities custom-fields init
142+
invenio rdm rebuild-all-indices
164143
```
165144

166-
in the `invenio.cfg` file to the
167-
168-
```
169-
APP_DEFAULT_SECURE_HEADERS = {
170-
"content_security_policy": {}
171-
}
172-
```
145+
From v12 onwards, search indices for statistics (record's views and downloads) are not
146+
affected by `invenio index destroy --yes-i-know` and are totally functional after the rebuild step.
173147

174-
configuration.
148+
!!! info "Permission issue"
149+
If you encounter an error similar to this when indexing:
150+
```
151+
opensearchpy.exceptions.AuthorizationException: AuthorizationException(403, 'security_exception', 'no permissions for [cluster:admin/component_template/put] and User [name=<my-name>, backend_roles=[], requestedTenant=null]')
152+
opensearchpy.exceptions.AuthorizationException: AuthorizationException(403, 'security_exception', 'no permissions for [indices:admin/index_template/put] and User [name=<my-name>, backend_roles=[], requestedTenant=null]')
153+
```
154+
This means your OpenSearch user does not have sufficient permissions to create or update index templates.
155+
To resolve this, grant the necessary permissions to your user in the OpenSearch cluster:
156+
1. Go to **OpenSearch Dashboards** -> **Security** -> **Roles** -> *<your role name>*.
157+
2. Edit the role and add the following cluster and index permissions:
158+
- `cluster:admin/component_template/put`
159+
- `indices:admin/index_template/put`
175160

176-
### Jobs
161+
### Updated affiliations and funders
162+
InvenioRDM now integrates the updated schema version v2 of ROR (see [announcement here](https://ror.org/blog/2024-04-15-announcing-ror-v2/)). This new version introduces additional fields and improvements, so you will need to re-import both the affiliations and funders vocabularies to ensure your data is up to date.
177163

178-
#### New worker beat scheduler
164+
To re-import, you can either set up a job or perform the import manually via the CLI. Please follow the instructions in the [affiliations](../../operate/customize/vocabularies/affiliations.md) and [funders](../../operate/customize/vocabularies/funding.md) documentation pages for detailed steps.
179165

180-
```
181-
celery -A invenio_app.celery beat --scheduler invenio_jobs.services.scheduler:RunScheduler
182-
```
166+
## Infrastructure/configuration changes
183167

184-
#### New Index Template for Job Logs
168+
### Required changes
185169

186-
Replace `localhost:9200` and `__SEARCH_INDEX_PREFIX__ `with your instance values.
170+
#### OpenSearch version
171+
The minimum required OpenSearch version is now **v2.12**. This change is necessary due to a bug in earlier OpenSearch versions that affects the handling of `geo-shape` fields introduced in InvenioRDM v13.
172+
For more details, see the related [InvenioRDM issue](https://github.com/inveniosoftware/invenio-rdm-records/issues/1807) and the [OpenSearch issue and discussion](https://github.com/opensearch-project/OpenSearch/issues/10958#issuecomment-2037882756).
187173

188-
Then run:
174+
To check the current version, connect to the OpenSearch Dashboard with your browser or run the following CLI command:
189175

190176
```bash
191-
curl -X PUT "http://localhost:9200/_index_template/job-logs-v1.0.0" -H "Content-Type: application/json" -d '
177+
$ curl -X GET "http://localhost:9200"
192178
{
193-
"index_patterns": ["__SEARCH_INDEX_PREFIX__job-logs*"],
194-
"data_stream": {},
195-
"template": {
196-
"mappings": {
197-
"properties": {
198-
"@timestamp": { "type": "date" },
199-
"level": { "type": "keyword" },
200-
"message": { "type": "text" },
201-
"module": { "type": "keyword" },
202-
"function": { "type": "keyword" },
203-
"line": { "type": "integer" },
204-
"context": {
205-
"type": "object",
206-
"properties": {
207-
"job_id": { "type": "keyword" },
208-
"run_id": { "type": "keyword" }
209-
},
210-
"dynamic": true
211-
}
212-
}
213-
}
214-
}
215-
}'
216-
```
217-
218-
### Rebuild search indices
219-
220-
#### full rebuild
221-
222-
```bash
223-
invenio index destroy --yes-i-know
224-
invenio index init
225-
invenio rdm rebuild-all-indices
226-
```
227-
228-
From v12 onwards, record statistics will be stored in search indices rather than the
229-
database. These indices are created through some _index templates_ machinery
230-
rather than having indices registered directly in `Invenio-Search`. As such, the
231-
search indices for statistics are not affected by `invenio index destroy
232-
--yes-i-know` and are totally functional after the rebuild step.
233-
234-
#### possible live update
235-
236-
CHECK if that works
237-
```bash
238-
invenio index update names-name-v2.0.0 --no-check
179+
...
180+
"version" : {
181+
"distribution" : "opensearch",
182+
"number" : "2.17.1",
183+
...
184+
},
185+
...
186+
}
239187
```
240188

241-
TODO: this is also required to create the mapping for the new `copyright` field.
242-
243-
189+
Add `-u <username>:<password>` if you require authentication, or `-k` to ignore SSL certificate warnings.
244190

245-
### Updated vocabularies
191+
Please refer to the official [OpenSearch upgrade documentation](https://docs.opensearch.org/docs/latest/install-and-configure/upgrade-opensearch/index/).
192+
If you choose to delete and re-create your search cluster as part of the upgrade, remember to **back up and restore your statistics indices** (see [how to do this here](../../maintenance/internals/statistics.md)).
193+
Be sure to repeat the [Rebuild search indices](#rebuild-search-indices) step to ensure your system is fully functional.
246194

247-
InvenioRDM now supports ROR v2, and you should update your affiliations and
248-
funders vocabularies following the
249-
instructions on the [affiliations](../../operate/customize/vocabularies/affiliations.md)
250-
and [funders](../../operate/customize/vocabularies/funding.md) documentation pages.
195+
#### Jobs
196+
The new Jobs feature uses a custom celery task scheduler which requires a separate celery beat. See the [related documentation](../../operate/customize/jobs.md#scheduler) on how to add it or [this change](https://github.com/inveniosoftware/cookiecutter-invenio-rdm/pull/314) in the InvenioRDM boilerplate for reference.
251197

198+
!!! note
199+
Be sure to run this additional Celery beat scheduler in your production or deployed environments. Without it, scheduled and on-demand jobs will not be executed.
252200

253-
### FAIR signposting level 1
201+
#### Updated PDF previewer
202+
The updated PDF file previewer (PDF.js v4) now uses ECMAScript modules (`.mjs`) instead of CommonJS files (`.js`). By default, the `nginx` web server does not recognize `.mjs` files in its [default MIME types configuration](https://github.com/nginx/nginx/blob/master/conf/mime.types#L8). As a result, the MIME type may be reported incorrectly, causing browsers to block the file and resulting in broken PDF previews.
254203

255-
However, since enabling FAIR signposting level 1 does increase the size of HTTP response headers, it is recommended to edit the `nginx` configuration and specify [`uwsgi_buffer_size`](https://nginx.org/en/docs/http/ngx_http_uwsgi_module.html#uwsgi_buffer_size) with a higher limit than the default values. If you have enabled `uwsgi_buffering on;`, then [`uwsgi_buffers`](https://nginx.org/en/docs/http/ngx_http_uwsgi_module.html#uwsgi_buffers) may also be adjusted.
204+
To resolve this, simply add a custom [`types`](https://nginx.org/en/docs/http/ngx_http_core_module.html#types) entry in your `nginx.conf` (for example, in the `http` block). See [this change](https://github.com/inveniosoftware/cookiecutter-invenio-rdm/pull/299) in the InvenioRDM boilerplate for reference.
256205

257-
```nginx
258-
server {
259-
# ...
260-
# Allow for larger HTTP response headers for FAIR signposting level 1 support
261-
uwsgi_buffer_size 16k;
262-
# optional if uwsgi_buffering on;
263-
uwsgi_buffers 8 16k;
264-
265-
# ...
266-
}
206+
```diff
207+
...
208+
include /etc/nginx/mime.types;
209+
default_type application/octet-stream;
210+
+ types {
211+
+ # Ensure nginx treats ECMAScript modules as JavaScript
212+
+ application/javascript js mjs;
213+
+ }
214+
...
267215
```
268216

269-
### New roles
270-
nothing yet
217+
### Optional changes
271218

219+
#### Deprecated configurations
220+
With the upgrade to Flask version 3, the configuration variable `APP_ALLOWED_HOSTS` has been renamed to `TRUSTED_HOSTS`. The value remains unchanged.
221+
You should review your `invenio.cfg`, environment variables, and deployment configuration for any occurrences of the old variable name.
222+
It is recommended to update all references to `TRUSTED_HOSTS` to avoid deprecation warnings in the console.
272223

273-
### New configuration variables
224+
#### Display versions in administration panel
225+
As described in the [release notes](./version-v13.0.0.md#miscellaneous-additions), you can now display the versions of your installed modules directly in the Administration panel.
226+
To enable this feature, add the following to your `invenio.cfg`:
274227

275-
```bash
228+
```python
276229
from invenio_app_rdm import __version__
277230
ADMINISTRATION_DISPLAY_VERSIONS = [
278231
("invenio-app-rdm", f"v{__version__}"),
279-
("{{ cookiecutter.project_shortname }}", "v1.0.0"),
232+
("<my module name>",
280233
]
281234
```
282235

283-
### Changed configuration variables
284-
285-
- change from `APP_ALLOWED_HOSTS` to `TRUSTED_HOSTS` due flask >= 3
286-
287-
288-
## Big Changes
289-
290-
- feature: invenio jobs module, periodic tasks administration panel
291-
- feature: invenio vocabularies entries deprecation
292-
- improvement: search mappings and analyzers to improve performance
293-
- OpenSearch min version now required v2.12 due to breaking changes in `geo-shape` fields, see issue [here](https://github.com/inveniosoftware/invenio-rdm-records/issues/1807) and related OpenSearch issue and comment [here](https://github.com/opensearch-project/OpenSearch/issues/10958#issuecomment-2037882756).
294-
- dashboard: `shared_with_me` drafts and requests. See [issue[(https://github.com/inveniosoftware/docs-invenio-rdm/blob/master/docs/releases/v13/upgrade-v13.0.md)
295-
- custom fields: thesis subfields renamed (TODO: migration recipe)
296-
- custom fields: meeting url changed to identifiers subfield (TODO: migration recipe)
297-
- experimental: using uv (instead of pipenv), rspack (instead of webpack) and pnpm (instead of npm)
298-
299-
Document this error, or actually add it to the upgrade recipe
300-
301-
302-
## OPEN PROBLEMS
303-
304-
```
305-
opensearchpy.exceptions.AuthorizationException: AuthorizationException(403, 'security_exception', 'no permissions for [cluster:admin/component_template/put] and User [name=inveniordm-qa, backend_roles=[], requestedTenant=null]')
306-
307-
opensearchpy.exceptions.AuthorizationException: AuthorizationException(403, 'security_exception', 'no permissions for [indices:admin/index_template/put] and User [name=inveniordm-qa, backend_roles=[], requestedTenant=null]')
308-
```
309-
310-
To solve it, grant permission to the user in OpenSearch cluster:
311-
Go to OpenSearch Dashboards -> Security -> Roles -> <instance name>, edit role and add:
312-
313-
- `cluster:admin/component_template/put`
314-
- `indices:admin/index_template/put`
236+
#### FAIR signposting level 1
237+
If you have enabled FAIR Signposting, ensure that you have updated your web server configuration as required. See the [documentation here](../../operate/customize/FAIR-signposting.md#level-1) for detailed instructions.
315238

239+
Failing to apply these changes may result in errors when accessing certain records.
316240

317-
## OPEN PROBLEMS
318-
nothing yet
241+
#### Enhanced File Uploader (Uppy)
242+
If you plan to use the new Uppy file uploader, ensure that your Content Security Policy (CSP) settings are updated in your `invenio.cfg` as described in the [enhanced file uploader documentation](../../operate/customize/file-uploads/uploader.md#enhanced-file-uploader-uppy). Failing to update your CSP rules may prevent the uploader from functioning correctly.

docs/releases/v13/version-v13.0.0.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,10 @@ Here is a quick summary of the myriad other improvements in this release:
206206
- ...and many more bug fixes!
207207

208208
## Breaking changes
209+
- The minimum required OpenSearch version is now **v2.12**. This change is necessary due to a bug in earlier OpenSearch versions that affects the handling of `geo-shape` fields introduced in InvenioRDM v13. See the [upgrade guide](upgrade-v13.0.md#opensearch-version) for more information.
210+
- The new search improvements and the enhanced subjects and awards features require the recreation of the search mappings for Subjects, Awards, Records _(including percolators)_, Drafts and Communities. See the [upgrade guide](upgrade-v13.0.md#rebuild-search-indices) for more information.
211+
- The integration with the new ROR schema v2 requires to re-import both the affiliations and funders vocabularies. See the [upgrade guide](upgrade-v13.0.md#updated-affiliations-and-funders) for more information.
209212
- The upgrade of the PDF previewer requires a small change to the webserver configuration. See the [upgrade guide](upgrade-v13.0.md) for more information.
210-
- The new search improvements and the enhanced subjects and awards features require the recreation of the search mappings for Subjects, Awards, Records _(including percolators)_, Drafts and Communities. See the [upgrade guide](upgrade-v13.0.md) for more information.
211213
- Direct Python imports of identifier schemes (e.g., `from idutils.isbn import normalize_isbn`) are now deprecated and will be removed in future versions. If you have custom code that directly imports scheme modules, you'll need to update it to use the new API.
212214

213215
## Requirements
@@ -217,7 +219,7 @@ InvenioRDM v13 supports:
217219
- Python 3.9 (end of life October 2025), 3.11 and 3.12
218220
- Node.js 18+
219221
- PostgreSQL 12+
220-
- OpenSearch v2
222+
- OpenSearch v2.12+
221223

222224
## Upgrading to v13.0
223225

0 commit comments

Comments
 (0)