Package: mdapi
mdapiA simple and fast API for serving the metadata from the RPM repositoriesInstallationFor developmentInstallPython 3,VirtualenvandPoetryon your Fedora Linux installation.$ sudo dnf install python3 python3-virtualenv poetryClone the repository to your local storage and make it your present working directory.$ git clone git@github.com:fedora-infra/mdapi.git
$ cd mdapiSet up and activate a virtual environment within the directory of the cloned repository.$ virtualenv venv
$ source venv/bin/activateCheck the validity of the project configuration and install the project dependencies from the lockfile.$ (venv) poetry check
$ (venv) poetry installFor container imageInstallPodmanon your Fedora Linux installation.$ sudo dnf install podmanEnsure thatThe project directory is the present working directory.The virtual environment with the project is activated, following the instructions provided in thedevelopment installationsection.The project configuration is modified according to needs inmyconfig.pyfile, following the instructions provided in theconfiguration setupsection.Execute the following command to build the container image.$ (venv) podman build -t "mdapi:$(poetry version -s)" .UsageIn developmentViewing the help message and versionEnsure thatThe project directory is the present working directory.The virtual environment with the project is activated, following the instructions provided in thedevelopment installationsection.Execute the following command to view the help message.$ (venv) mdapi --helpOutputUsage: mdapi [OPTIONS] COMMAND [ARGS]...

  A simple API for serving the metadata from the RPM repositories

Options:
  -c, --conffile PATH  Read configuration from the specified Python file
  --version            Show the version and exit.
  --help               Show this message and exit.

Commands:
  database  Fetch SQLite databases from all active Fedora Linux and EPEL...
  serveapp  Start the API server for querying repository metadataExecute the following command to view the project version.$ (venv) mdapi --versionOutputmdapi, version 3.0.0Testing the projectEnsure thatThe project directory is the present working directory.The virtual environment with the project is activated, following the instructions provided in thedevelopment installationsection.The storage partition on whichtest database directoryis located has at least 1.5 GiB of free space.Execute the following command to run the code quality checks and testcases.$ (venv) toxSetting up the configurationEnsure thatThe project directory is the present working directory.Make a copy of the default configuration on your local storage.$ cp mdapi/confdata/standard.py mdapi/confdata/myconfig.pyMake changes to the copied configuration file to suit the requirements.$ nano confdata/myconfig.pyFetching the databasesEnsure thatThe project directory is the present working directory.The virtual environment with the project is activated, following the instructions provided in thedevelopment installationsection.The storage partition on whichdatabase directoryis located has at least 6 GiB of free space.Execute the following command to start fetching the database, while referencing to the modified configuration file.$ (venv) mdapi --conffile myconfig.py databaseNote that the first run of the database fetching command will take a long time, depending on the internet connection.Serving the applicationEnsure thatThe project directory is the present working directory.The virtual environment with the project is activated, following the instructions provided in thedevelopment installationsection.Execute the following command to start serving the application, while referencing to the modified configuration file.$ (venv) mdapi --conffile myconfig.py serveappWhen done with serving the application, pressCtrl+Cto raise aKeyboardInterruptand exit out of the program.In container or podServing the applicationEnsure thatThe project directory is the present working directory.The virtual environment with the project is activated, following the instructions provided in thedevelopment installationsection.The container image is built and available locally.The databases are downloaded to thedatabase directory, following the instructions provided in thedatabase fetchingsection.Execute the following command to start the serving the application.$ (venv) podman run -v /var/tmp:/var/tmp -p 8080:8080 -ti mdapi:$(poetry version -s)This command assumes that the database directory is/var/tmp(which is thedefault) and the service port is8080(which is thedefault).