Skip to content

API Documentation for nua-agent

Package nua.agent

Agent libray of Nua, embedded in each Nua Docker image.

Module nua.agent.auto_install

Apply automated installation detection heuristics.

detect_and_install

detect_and_install(directory)

Apply automated installation detection heuristics.

Package nua.agent.detectors

Module nua.agent.detectors.base_detector

Base class for detect and install project.

BaseDetector

Base class for detect and install project.

BaseDetector.priority: permits to sort the tests order (lower value is higher
priority) of each detector upon a source directory. Thus testing dual installation
(ie: python+node) before single ones.

Module nua.agent.detectors.nodejs_yarn

Auto install Nodejs/Yarn.

Module nua.agent.detectors.python_source

Auto install Python project.

Module nua.agent.detectors.python_wheels

Auto install Python wheels.

Package nua.agent.scripts

Module nua.agent.scripts.app_builder

Install the configured application inside the container.

  • information come from a mandatory local file: “nua-config.toml|json|yaml|yml”
  • origin may be a source tar.gz or a git repository, python wheel
  • build locally if source is python package

AppBuilder

AppBuilder()

Class to hold config and other state information during build.

collect_meta_packages

collect_meta_packages()

Return meta packages collected from the nua-config requirements and
connectors required by providers.

collect_packages

collect_packages()

Return packages collected from the nua-config requirements.

pre_build

pre_build()

Process installation of packages prior to running install script.

make_custom_document_root

make_custom_document_root()

If the app defines a specific document root (i.e. /var/www/html).

copy_metadata

copy_metadata()

Dump the content of the nua-config file in /nua/metadata/nua- config.json.

run_build_script

run_build_script(code_installed)

Process the ‘build.py’ script if exists or the ‘build’ command.

The script is run from the directory of the nua-config.toml file.

build_with_command

build_with_command()

Process the ‘build’ commands.

The script is run from the source directory.

build_with_script

build_with_script(script_path)

Build with a python script.

build_with_auto_detection

build_with_auto_detection(code_installed, pip_installed)

Build with a auto detect/install.

detect_and_install() is launched as root (the current user),

it’s the responsability of auto installer to switch to user nua.

merge_files

merge_files()

Copy content of various /nua/build/nua subfolders in /nua.

test_build

test_build()

Execute a configured shell command to check build is successful.

main

main()

Setup app in Nua container.

Module nua.agent.templates

Utils to fill templates at the start of the container.

Template must be filled
  • after volume mounts and environment initialization,
  • before application start script.

Templater dataclass

render_config_templates

render_config_templates()

Find files and templates in the /nua/templates folder and fill them.

Destination files may be on Docker-mounted volumes.

This function is expected to be run as root. Files are stored with 755 rights.
Files ending with .j2 are considered as Jinja2 templates.

Module nua.agent.version