How do you change invenio.cfg without rebuilding the whole project?

Is it possible to change invenio.cfg values, for example allowed hosts, without rebuilding?

Hello,
you don’t have to rebuild the whole project:

  1. stop the running web server and celery
  2. change the invenio.cfg, see here for more info
  3. restart the server

I hope it helps!

@nitarocc
I’m using docker image

invenio-cli containers start --lock --build --setup

How do I stop celery? Is that a docker container as well?

I use docker exec -it <container_id> /bin/bash to change invenio.cfg inside the docker container, but that doesn’t work

In development, to stop see here.

When deploying with Docker, you will build the Docker image and Invenio will use your invenio.cfg.
When you run the container, then you should inject environment variables to override the default configuration, see here.

invenio-cli containers stop

export INVENIO_APP_ALLOWED_HOSTS=['example.com']

invenio-cli containers start

Didn’t work. Do you know the path to config.py inside docker containers? I can modify the confiuration from there

Env vars are working correctly in my local env, and we don’t have other users reporting this issue.
You can have a look here how the current env is copied into the new env created by invenio-cli.

❯ export INVENIO_APP_ALLOWED_HOSTS=['example.com']
❯ echo $INVENIO_APP_ALLOWED_HOSTS
[example.com]

❯ invenio-cli shell
Launching subshell in virtual environment...
...
❯ echo $INVENIO_APP_ALLOWED_HOSTS
[example.com]
❯ invenio shell --no-term-title -c "app.config['APP_ALLOWED_HOSTS']"
Out[1]: '[example.com]'
❯ pipenv run invenio shell --no-term-title -c "app.config['APP_ALLOWED_HOSTS']"
Out[1]: '[example.com]'

> exit

❯ unset INVENIO_APP_ALLOWED_HOSTS
❯ pipenv run invenio shell --no-term-title -c "app.config['APP_ALLOWED_HOSTS']"
Out[1]: ['0.0.0.0', 'localhost', '127.0.0.1']

Just a warning: invenio-cli is not meant to be run in any deployed env, only for development.

To answer your other question about the path to the invenio.cfg:

  • here the path in the Dockerfile in the InvenioRDM image
  • here the base image with the path

You can join our chatroom where other users facing similar issues might be able to help.