Package: adop
PyPI:https://pypi.org/project/adop/Downloads:https://gitlab.com/fholmer/adop/-/packagesDocumentation:https://fholmer.gitlab.io/adopSource Code:https://gitlab.com/fholmer/adopLicense: BSD LicenseSummaryAutomatic deployment on-prem from zip archives.FeaturesA REST API to upload, download and deploy zip-files.Listens for webhook requests, to continuously deploy zip-files on commits.Includes “package manager” like commands to upload and installing zip-files.WarningThis is a beta version. Not ready for production.InstallationOpen command line and and install using pip:$pipinstalladop[server]Usageadop is available as console script and library module$adop-h$python-madop-hServe the REST-API:$adopserve-apiServing on http://127.0.0.1:8000Find the generated authorization tokenWindows>type%USERPROFILE%\.adop\adop.ini|findstr write_tokenLinux$cat~/.adop/adop.ini|grepwrite_tokenTest the REST-API withcurlWindows>setADOP_TOKEN=copy-paste-token-here>curl -H"Token:%ADOP_TOKEN%""http://127.0.0.1:8000/api/v1/test"Linux$exportADOP_TOKEN=copy-paste-token-here$curl-H"Token:$ADOP_TOKEN""http://127.0.0.1:8000/api/v1/test"Upload and deploy a zip-library:$curl\-H"Token:$ADOP_TOKEN"\-H"Zip-Tag: 0.1.0"\--data-binary"@work/mylib.zip"\"http://127.0.0.1:8000/api/v1/deploy/zip/mylib"Zip file layoutZip files with exactly one root directory are valid and can be distributed.
The root directory name must be unique if many zip files are to be distributed.Example of a valid zip file layout:/mylib//README.rst/main.py/mypackage1//__init__.py/__main__.py/mypackage2//__init__.py/__main__.pyFollowing example isnotvalid:/README.rst/mylib1//__init__.py/__main__.py/mylib2//__init__.py/__main__.pyAPIEndpointsDescriptionMethodEndpointCheck that the API is available.GET/api/v1/testShasum for all deployed zip-files.GET/api/v1/stateShasum for given deployed root.GET/api/v1/state/<root>Known tags for given root.GET/api/v1/tags/<root>Check specific tag for given root.GET/api/v1/tags/<root>/<tag>List available zip-files.GET/api/v1/list/zipList available zip-files for given root.GET/api/v1/list/zip/<root>Start auto-fetch routine if enabled.GET/api/v1/trigger/fetchStart auto-fetch routine if enabled.POST/api/v1/trigger/fetch/<root>Download zip-file with given root.GET/api/v1/download/zip/<root>Upload a zip-file without deploying it.POST/PUT/api/v1/upload/zip/<root>Upload and deploy a zip-file.POST/PUT/api/v1/deploy/zip/<root>Deploy a preloaded zip-file.GET/api/v1/deploy/zip/<root>Zip-file unpacking progress.GET/api/v1/progress<root>Name of the root directory in the zip-file.HeadersHeaderDescriptionEndpointTokenThe authorization token for this API.AllZip-Sha256content hash of the zip-file to
deploy.GET /api/v1/deploy/zipZip-TagTag the Shasum. Optional.POST/PUT /api/v1/upload/zipGET/POST/PUT /api/v1/deploy/zipZip-RootName of root directory in zip-file
Optional.POST/PUT /api/v1/upload/zipPOST/PUT /api/v1/deploy/zipResultThe result is encoded as a json object. Most endpoints will return an object
withresultandresult_codeas keywords.$curl\-H"Token: paste-token-here"\http://127.0.0.1:8000/api/v1/test{
  "result": "It works",
  "result_code": 0
}Endpoints that take a long time will stream a progress log until
the result is returned.$curl\-H"Token: paste-token-here"\--data-binary"@work/mylib.zip"\http://127.0.0.1:8000/api/v1/deploy/zip/mylib// root: mylib
// store data
// verify data
// verify root dir
// verify zip data
// zip root: 'mylib'
// unpack zip data
// remove untracked files
{"root": "mylib", "result": "Success", "result_code": 0}The Json specification does not support comments,
so the client must ignore lines prefixed with//before decoding.$curl\-H"Token: paste-token-here"\--data-binary"@work/mylib.zip"\http://127.0.0.1:8000/api/v1/deploy/zip/mylib\|grep-v//\|python-mjson.tool{
    "root": "mylib",
    "result": "Success",
    "result_code": 0
}Status and result codesHTTP statusresult_codeDescripton2000OK. Indicates that the request has succeeded.2001Fail. The request has succeeded but result was
unsuccessful.2002In progress. The request as been interrupted and
returned to early to give the final result code.4014Unauthorized. Invalid token.5005Internal ErrorClient sideDefine requirements in arequires.inifile[requires]
mylib = tag:0.1.0Define the remote and install locations:$exportADOP_TOKEN=copy-paste-token-here$adopconfigadd-remotemyserverhttp://127.0.0.1:8000/api/v1-eADOP_TOKEN$adopconfigadd-installmylibs./lib/auto./lib/.cacheAnd then install:$adopzipinstallrequires.ini--remotemyserver--installmylibs