Skip to content

B2SHARE image build and stack deployment#

The B2SHARE deployment process:

Repo#

Clone B2SHARE repository:

git clone https://gitlab.eudat.eu/b2share/b2share-v3.git

Init the submodules#

cd b3share
git submodule init
git submodule update

Update env files#

cd inveniordm_deployment
cp b2share.env .env
cp b2share.app.env app.env
Update the B2SHARE_DIR variable in the .env file.

Update the secrets and the features in the app.env file.

More about configuration here.

Create necessary data directories#

The folders structure (${B2SHARE_DATADIR}) should look like this:

├── b2share_data
│   ├── archived_data
│   ├── static_data
│   └── uploaded_data
├── opensearch_data
├── postgres_data
└── rabbitmq_data

To create these directories run devscripts/create_dirs.sh

Create invenio.cfg#

copy “new_invenio.cfg” to “invenio.cfg”

cp new_invenio.cfg invenio.cfg

There is no need to update the invenio.cfg code until a new submodule is added or a new config module is added.

Build the app containers#

docker buildx build \
  -f Dockerfile \
  -t b2share-rdm/b2share:<tag> \
  --build-arg BUILD_ASSETS=yes \
  --build-arg GENERATE_PIPFILE_LOCK=yes \
  .

Argument BUILD_ASSETS enables UI building as part of docker build. Argument GENERATE_PIPFILE_LOCK enables pipfile.lock file generation.

Update app in docker-services.yml with the image just built.

Start the stack#

Initialize the app#

Run everything at once with:

docker compose -f docker-compose.full.yml exec web-api /eudat/devscripts/init.sh

Steps: (Run in container docker compose -f docker-compose.full.yml exec web-api bash)

  1. Init DB invenio db init
  2. Create tables invenio db create
  3. Update alembic versions invenio alembic stamp
  4. Set the file storage path INVENIO_FILE_STORAGE_PATH=$(invenio shell --no-term-title -c "print(app.instance_path)")'/data'
  5. Set default file storage invenio files location create --default 'default-location' $INVENIO_FILE_STORAGE_PATH
  6. Create administrator role invenio roles create administrator
  7. Allow administrator access invenio access allow administration-access role administrator
  8. Allow administration moderation invenio access allow administration-moderation role administrator
  9. Init search indices invenio index init --force
  10. Init record custom fields invenio rdm-records custom-fields init
  11. Init community custom fields invenio communities custom-fields init
  12. Add fixtures invenio rdm-records fixtures
  13. Generate static pages invenio rdm pages create

Optional: Add affiliations, awards & funders#

docker compose -f docker-compose.full.yml exec web-api bash
invenio vocabularies update \
  --vocabulary affiliations \
  --origin ror-http

invenio vocabularies update --vocabulary funders --origin ror-http

# wget project.tar from https://doi.org/10.5281/zenodo.3516917

invenio vocabularies import \
  --vocabulary awards \
  --origin "/path/to/project.tar"

Optional: Add demo data#

To add demo data get API token from B2SHARE, add it to ./demo_data/upload_demo_data.py, and run:

python3 ./demo_data/upload_demo_data.py

B2SHARE docker compose stack definition#

The B2SHARE docker compose stack is split into two main files: docker-services.yml and docker-compose.full.yml. The docker-services.yml file defines images and configurations for B2SHARE support containers. The docker-compose.full.yml defines the actual container deployment, volumes and networks to use for the deployment.

  Last update : 11.09.2026

Last review : 11.09.2026