Development intro¶
Getting support and contributing to Nua
To discuss Nua, report issues, or get support, please use the Discussion Forum and the Issue Tracker currently hosted on GitHub.
You can get direct support by funding the project.
The Nua application life cycle¶
Nua is a set of Python applications that can be controlled from the command line and that allow the management of the entire application life cycle:
- The build: these are the steps that lead to the creation and validation of a “Docker image” (more precisely, an OCI image).
- The run: the deployment of the application on a server containing the orchestrator and more generally the Nua execution environment, its monitoring, the management of security and backups, and the application of updates.
The build¶
The build consists of creating a container image to be executed in the deployment environment from a nua-config
file describing the application, its sources and possibly other useful files. This image includes
- A minimised operating system (in this case, Ubuntu LTS - this may change in the future).
- All the dependencies necessary for the application to work properly (system libraries, executables, libraries specific to the technology(ies) used by the application…).
- The compiled code of the application, in the case of a compiled language, or all the necessary scripts, in the case of a scripting language.
- All the additional files (configuration, templates, etc.) required.
It also includes the metadata files generated by Nua which will be used during the run phases.
The build is currently based on Docker: Nua generates an image dedicated to the build, a generic Dockerfile
, and launches a docker build
by injecting the necessary variables. Other build methods may be considered (as plugins) in the future.
Alternatively, this build phase can also be performed from a pre-existing dockerfile. In this case, Nua simply runs the Docker build and adds its metadata to the generated image.
More details on the nua-build
package
Deployment¶
From the image created during the build
, the Nua orchestrator will deploy one or more instances of the application, taking care to create or allocate the necessary providers, including a domain name (of course, Nu takes care of managing TLS certificates).
The deployment is currently done on a server configured with all the services required for the Nua environment, including a Docker server. Other runtime environments will be targeted in later releases of the platform: SlapOS, Podman, LXC, Firecracker, Kata Containers, Nomad, Kubernetes…
More details on the nua-orchestrator
package
Updates¶
The life of an application does not end with its deployment. Nua allows software upgrades and data schema migrations to be integrated into the deployment process. This phase, which can be risky when dealing with an application in production, is secured by the application of a test protocol.
Backups¶
Another essential, but sometimes neglected, aspect of any production system is backups and disaster recovery. Nua allows you to simply define a backup policy, either globally or for each application (or even for each type of data managed by an application). Nua provides strong, testable guarantees that a system can be recovered from a backup (stored on an external site, for example an object storage system compatible with the S3 API).
Configuration¶
If the software to be packaged is simple (or uses “best practices”), then the configuration files and the overall packaging process must also remain simple.
As a result, the application configuration should have reduced adhesion with the
chosen container format and rely on reasonable defaults.
The configuration is based on:
-
A
nua-config.toml
settings file. -
Python scripts, at least a build script to construct the package and a start script to start the application,
-
For Docker, a minimal
dockerfile
is proposed by default and can be used as is for many applications.
Indeed, the choice is made to use python as a priority for the configuration operations, which simplifies thedockerfile
accordingly.
More details on the nua-config.toml
file
nua-build
package¶
The nua-build
package provides utilities to help the packager:
-
shell.py
contains wrappers of basic Unix commands likecat
ormkdir -p
. -
exec.py
contains wrappers aboveos.execvpe
, for exampleexec_as_nua()
orexec_as_nua()
. -
actions.py
uses the two previous ones to carry out tasks likeapt_get_install()
orpip_install()
nua-build
contains both the tools allowing the developer to package the application and a bootstrap which will be
installed in the container.