Invenio-Cli¶
Command-line tool to create and manage an InvenioRDM instance.
Installation¶
$ pip install invenio-cli
Usage¶
Local Development environment¶
# Initialize environment and cd into <created folder>
$ invenio-cli init rdm
$ cd <created folder>
# Install locally
# install python dependencies (pre-release versions needed for now),
# link/copy assets + statics, install js dependencies, build assets and
# final statics
$ invenio-cli install --pre
# Start and setup services (database, Elasticsearch, Redis, queue)
$ invenio-cli services
# Optional: add demo data
$ invenio-cli demo --local
# Run the server
$ invenio-cli run
# Update assets or statics
$ invenio-cli update
Containerized ‘Production’ environment¶
# Initialize environment and cd into <created folder>
$ invenio-cli init rdm
$ cd <created folder>
# Spin-up InvenioRDM
$ invenio-cli containerize
# Optional: add demo data
$ invenio-cli demo --containers
# After updating statics or code, if you do not need to re-install JS
# dependencies which can take time
$ invenio-cli containerize --no-install-js
More Help¶
# Get more help
$ invenio-cli --help
Further documentation is available on https://invenio-cli.readthedocs.io/
User’s Guide¶
This part of the documentation will show you how to get started in using Invenio-Cli.
API Reference¶
If you are looking for information on a specific function, class or method, this part of the documentation is for you.
API Docs¶
CLI¶
Invenio module to ease the creation and management of applications.
Commands¶
Invenio module to ease the creation and management of applications.
- class invenio_cli.commands.AssetsCommands(cli_config)[source]¶
Local installation commands.
Constructor.
- class invenio_cli.commands.Commands(cli_config)[source]¶
Abstraction over CLI commands that are either local or containerized.
Constructor.
- Parameters
cli_config – :class:CLIConfig instance
- class invenio_cli.commands.ContainersCommands(cli_config, docker_helper=None)[source]¶
Containerized environment CLI commands.
Constructor.
- build(pull=True, cache=True)[source]¶
Return the steps to build images.
- Parameters
pull – Attempt to pull newer versions of the images.
cache – Use cached images and layers.
- declare_queues(project_shortname)[source]¶
Steps to declare the MQ queues required for statistics, etc.
- setup(force, demo_data=True, stop=False, services=True)[source]¶
Return the steps to setup containerize services.
- Parameters
force – Remove existing content (db, indices, etc.).
demo_data – Include demo records.
stop – Stop services after setup.
- start(lock=False, build=False, setup=False, demo_data=True, services=True)[source]¶
Return the steps to start service and application containers.
- Parameters
lock – Lock dependencies.
build – Build containers if not built.
setup – Setup services (db, indices, etc.).
demo_data – Include demo records.
services – Start services or only the application containers. This option is incompatible will all the other flags.
- class invenio_cli.commands.InstallCommands(cli_config)[source]¶
Local installation commands.
Constructor.
- class invenio_cli.commands.LocalCommands(cli_config)[source]¶
Local CLI commands.
Constructor.
- class invenio_cli.commands.PackagesCommands[source]¶
Local installation commands.
- static install_locked_dependencies(pre, dev)[source]¶
Install dependencies from Pipfile.lock using sync.
- static install_packages(packages, log_file=None)[source]¶
Steps to install Python packages.
It is a class method since it does not require any configuration.
- static outdated_packages()[source]¶
Steps to show outdated packages.
It is a class method since it does not require any configuration.
- class invenio_cli.commands.RequirementsCommands[source]¶
Pre-requirements check.
- classmethod check_docker_compose_version(major, minor=-1, patch=-1, exact=False)[source]¶
Check the docker compose version.
- classmethod check_docker_version(major, minor=-1, patch=-1, exact=False)[source]¶
Check the docker version.
- classmethod check_git_version(major, minor=-1, patch=-1, exact=False)[source]¶
Check the git version.
- classmethod check_imagemagick_version(major, minor=-1, patch=-1, exact=False)[source]¶
Check the ImageMagick version.
- classmethod check_node_version(major, minor=-1, patch=-1, exact=False)[source]¶
Check the node version.
- class invenio_cli.commands.ServicesCommands(cli_config, docker_helper=None)[source]¶
Service CLI commands.
Constructor.
- setup(force, demo_data=True, stop=False, services=True)[source]¶
Steps to setup services’ containers.
A check in invenio-cli’s config file is done to see if one-time setup has been executed before.
- class invenio_cli.commands.TranslationsCommands(project_path, instance_path)[source]¶
Translations CLI commands.
Constructor.
- compile(directory=None, fuzzy=False, translation_folder='translations', symlink=True)[source]¶
Compile the message catalog.
- class invenio_cli.commands.UpgradeCommands[source]¶
Local installation commands.
- static upgrade(script_path)[source]¶
Steps to perform an upgrade of the invenio instance.
First, and alembic upgrade is launched to allow alembic to migrate the database using SQLAlchemy. Then, the custom script is executed. Last, the search indices are destroyed, initialized and rebuilt. It is a class method since it does not require any configuration.
Helpers¶
Invenio CLI helpers module.
Additional Notes¶
Notes on how to contribute, legal information and changes are here for the interested.
Contributing¶
Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given. Additional documentation can be found in the Invenio maintainers guide.
Types of Contributions¶
Report Bugs¶
Report bugs at https://github.com/inveniosoftware/invenio-cli/issues.
If you are reporting a bug, please include:
Your operating system name and version.
Any details about your local setup that might be helpful in troubleshooting.
Detailed steps to reproduce the bug.
Fix Bugs¶
Look through the GitHub issues for bugs. Anything tagged with “bug” is open to whoever wants to implement it.
Implement Features¶
Look through the GitHub issues for features. Anything tagged with “feature” is open to whoever wants to implement it.
Write Documentation¶
Invenio-Cli could always use more documentation, whether as part of the official Invenio-Cli docs, in docstrings, or even on the web in blog posts, articles, and such.
Submit Feedback¶
The best way to send feedback is to file an issue at https://github.com/inveniosoftware/invenio-cli/issues.
If you are proposing a feature:
Explain in detail how it would work.
Keep the scope as narrow as possible, to make it easier to implement.
Remember that this is a volunteer-driven project, and that contributions are welcome :)
Get Started!¶
Ready to contribute? Here’s how to set up invenio-cli for local development.
Fork the inveniosoftware/invenio-cli repo on GitHub.
Clone your fork locally:
$ git clone git@github.com:your_name_here/invenio-cli.git
Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development:
$ mkvirtualenv invenio-cli $ cd invenio-cli/ $ pip install -e .[all]
Create a branch for local development:
$ git checkout -b name-of-your-bugfix-or-feature
Now you can make your changes locally.
When you’re done making changes, check that your changes pass tests:
$ ./run-tests.sh
The tests will provide you with test coverage and also check PEP8 (code style), PEP257 (documentation), flake8 as well as build the Sphinx documentation and run doctests.
Commit your changes and push your branch to GitHub:
$ git add . $ git commit -s -m "component: title without verbs" -m "* NEW Adds your new feature." -m "* FIX Fixes an existing issue." -m "* BETTER Improves and existing feature." -m "* Changes something that should not be visible in release notes." $ git push origin name-of-your-bugfix-or-feature
Submit a pull request through the GitHub website.
Pull Request Guidelines¶
Before you submit a pull request, check that it meets these guidelines:
The pull request should include tests and must not decrease test coverage.
If the pull request adds functionality, the docs should be updated. Put your new functionality into a function with a docstring.
The pull request should work for Python 2.7, 3.5 and 3.6. Check https://travis-ci.org/inveniosoftware/invenio-cli/pull_requests and make sure that the tests pass for all supported Python versions.
Changes¶
Version 1.1.0 (released 2023-07-24)
add compatibility for docker compose v2
consider command errors when using install command and fail
Version 1.0.21 (released 2023-05-18)
deps: support docker < 7 for compatibility with urllib3 v2
Version 1.0.20 (released 2023-03-134)
setup: add queues initialisation to steps
Version 1.0.19 (released 2023-03-10)
global: remove fail message on warning (i.e. soft failures)
Version 1.0.18 (released 2023-02-07)
containerize: fix translation commands instance path
Version 1.0.17 (released 2023-01-30)
requirements: check node version depending on app-rdm version
Version 1.0.16 (released 2023-01-30)
bump cookiecutter to v11.0
Version 1.0.15 (released 2023-01-13)
Setup: fix empty translation folder failing
Version 1.0.14 (released 2023-01-09)
Add app-rdm fixtures to setup
Version 1.0.13 (released 2022-11-14)
Allow compilation command to fail in case of missing catalogs.
Version 1.0.12 (released 2022-10-28)
Adds support for translations (i18n) management commands.
Version 1.0.11 (released 2022-10-24)
Add support for InvenioILS
Version 1.0.8 (released 2022-10-13)
Fix issue when checking for services to be up and running correctly.
Version 1.0.7 (released 2022-10-10)
Fix compat issue with RDM versions < v10
Version 1.0.6 (released 2022-10-10)
Bump default RDM version.
Version 1.0.5 (released 2022-05-31)
Bump click version.
Bump default RDM version.
Improve error handling.
Add check for npm version.
Move ImageMagick check to –development.
Version 1.0.4 (released 2022-02-14)
Fixes an issue with virtualenv 20.13.1+ brining in setuptools 60.x which is incompatible with Celery v5.2.3. Once Celery v5.2.4 has been released, this fix is no longer needed.
Version 1.0.3 (released 2022-02-04)
Added
--no-input
and--config=
options toinit
to support running with predefined config and without requiring user input.
Version 1.0.0 (released 2021-08-05)
Initial public release.
License¶
MIT License
Copyright (C) 2019 CERN. Copyright (C) 2019 Northwestern University. Copyright (C) 2021 TU Wien. Copyright (C) 2022 Forschungszentrum Jülich GmbH.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Note
In applying this license, CERN does not waive the privileges and immunities granted to it by virtue of its status as an Intergovernmental Organization or submit itself to any jurisdiction.