From a1d8540845a0e14b4e82037c7a38dbdb66862af7 Mon Sep 17 00:00:00 2001 From: Angel Rodriguez Date: Fri, 29 Nov 2024 06:15:35 +0100 Subject: [PATCH] Add api/README-en.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Traducción al inglés del README.md --- api/README-en.md | 68 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 api/README-en.md diff --git a/api/README-en.md b/api/README-en.md new file mode 100644 index 0000000..0131b10 --- /dev/null +++ b/api/README-en.md @@ -0,0 +1,68 @@ +# GitLib + +The `gitapi.py` is an API for OgGit, written in Python/Flask. + +It is an HTTP server that receives commands and executes maintenance actions including the creation and deletion of repositories. + + +# Installing Python dependencies + +The conversion of the code to Python 3 currently requires the packages specified in `requirements.txt`. + +To install Python dependencies, the `venv` module is used (https://docs.python.org/3/library/venv.html), which installs all dependencies in an environment independent of the system. + + +# Usage + + +## Older Distributions (18.04) + + sudo apt install -y python3.8 python3.8-venv python3-venv libarchive-dev + python3.8 -m venv venvog + . venvog/bin/activate + python3.8 -m pip install --upgrade pip + pip3 install -r requirements.txt + +Run with: + + ./gitapi.py + + +## Usage + +**Note:** Run as `opengnsys`, as it manages the images located in `/opt/opengnsys/images`. + + $ . venvog/bin/activate + $ ./gitapi.py + + +# Documentation + +Python documentation can be generated using a utility like pdoc3 (there are multiple possible alternatives): + + # Install pdoc3 + pip install --user pdoc3 + + # Generate documentation + pdoc3 --force --html opengnsys_git_installer.py + +# Operation + +## Requirements + +The gitapi is designed to run within an existing opengnsys environment. It should be installed in an ogrepository. + +## API Example + +### Get list of branches + + $ curl -L http://localhost:5000/repositories/linux/branches + { + "branches": [ + "master" + ] + } + +### Synchronize with remote repository + + curl --header "Content-Type: application/json" --data '{"remote_repository":"foobar"}' -X POST -L http://localhost:5000/repositories/linux/sync \ No newline at end of file