Deployment API Reference

The Freva deployment Class

Module to run the freva deployment.

class freva_deployment.deploy.DeployFactory(steps: Optional[list[str]] = None, config_file: Optional[Union[Path, str]] = None)[source]

Bases: object

Apply freva deployment and its services.

Parameters
  • project_name (str) – The name of the project to distinguish this instance from others.

  • steps (list[str], default: ["services", "core", "web"]) – The components that are going to be deployed.

  • config_file (os.PathLike, default: None) – Path to any existing deployment configuration file.

Examples

>>> from freva_deployment import DeployFactory as DF
>>> deploy = DF(steps=["solr"])
>>> deploy.play(ask_pass=True)
property aux_dir: Path

Directory with auxillary files.

property chain_key_file: str

Path to the private key file.

create_eval_config() None[source]

Create and dump the evaluation_systme.config.

create_playbooks()[source]

Create the ansible playbook form all steps.

property db_pass: str

Create a password for the database.

parse_config() str[source]

Create config files for anisble and evaluation_system.conf.

play(server_map: Optional[str] = None, ask_pass: bool = True, verbosity: int = 0) None[source]

Play the ansible playbook.

Parameters
  • server_map (str, default: None) – Hostname running the service that keeps track of the server infrastructure, if None given (default) no new deployed services are added.

  • ask_pass (bool, default: True) – Instruct Ansible to ask for the ssh passord instead of using a ssh key

  • verbosity (int, default: 0) – Verbosity level, default 0

property playbook_dir: Path

The location of all playbooks.

property private_key_file: str

Path to the private key file.

property public_key_file: str

Path to the public certificate file.

property python_prefix: Path

Get the path of the new conda evnironment.

step_order: tuple[str, ...] = ('vault', 'db', 'solr', 'core', 'web')
property steps: list[str]

Set all the deploment steps.

upload_server_info(server_map: str, inventory: str) None[source]

Upload information on server information to shared nextcloud.

The Deployment Text User Interface

The Freva deployment Text User Interface (TUI) helps to configure a deployment setup for a new instance of freva.

class freva_deployment.ui.deployment_tui.main_window.MainApp[source]

Bases: NPSAppManaged

property cache_dir: Path

The user cachedir.

change_form(name: str) None[source]
check_missing_config(stop_at_missing: bool = True) str | None[source]

Evaluate all forms.

config: dict[str, Any] = {}
exit_application(*args, **kwargs) None[source]
load_dialog(*args, **kwargs) None[source]

Create a dialoge that allows for loading a config file.

onStart() None[source]

When Application starts, set up the Forms that will be used.

read_cert_file(key: str) str[source]

Read the certificate file from the cache.

save_config_to_file(**kwargs) pathlib.Path | None[source]

Save the status of the tui to file.

save_dialog(*args, **kwargs) None[source]

Create a dialoge that allows for saving the config file.

property save_file: str

Read the file that stores the configuration from the cache.

start_auto_save() None[source]

(Re)-Start the auto save thread.

property steps: list[str]

Get the deploy steps.

class freva_deployment.ui.deployment_tui.base.BaseForm(*args, **keywords)[source]

Bases: FormMultiPageWithMenus, FormWithMenus

Base class for forms.

certificates: list[str] = []

The type of certificate files this step needs.

change_forms(*args, reverse=False, **keywords) None[source]

Cycle between the deployment config forms.

check_config(notify: bool = True) dict[str, str | dict[str, str | list | int | bool | None]] | None[source]

Check if the from entries are valid.

create() None[source]

Setup the form.

draw_form() None[source]

Overload the draw_from method from, this is done to add menus.

get_config(key) dict[str, str | bool | list[str]][source]

Read the configuration for a step.

get_host(key) str[source]

Read the host name(s) from the main windows config.

input_fields: dict[str, tuple[npyscreen.wgtitlefield.TitleText, bool]] = {}

the key of the dictionary represents the name of the key in the in config toml input files. Values represent a tuple of npysceen types that display the input information on this key to the user and a boolean indicating whether or not this variable is mandatory.

Type

Dictionary of input fileds

property num: str

Calculate the number for enumerations of any input field.

previews_form(*args, **keywords) None[source]
run_deployment(*args) None[source]

Switch to the deployment setup form.

class freva_deployment.ui.deployment_tui.base.FileSelector(*args, file_extentions: str | list[str] = ['.toml'], **kwargs)[source]

Bases: FileSelector

FileSelector widget that allows for filtering file extensions.

exit() None[source]

Exit the dialogue.

file_extentions: list[str]

List of allowed file extensions.

update_grid() None[source]
value: str

The value of this file selector.

freva_deployment.ui.deployment_tui.base.selectFile(starting_value: str = '', *args, **keywords)[source]
class freva_deployment.ui.deployment_tui.deploy_forms.CoreScreen(*args, **keywords)[source]

Bases: BaseForm

Form for the core deployment configuration.

certificates: list[str] = ['public']

The type of certificate files this step needs.

scheduler_index(scheduler_system: str = '')[source]

Get the index of the saved scheduler_system

property scheduler_systems

Define available scheduler systems.

step: str = 'core'

Name of this step.

class freva_deployment.ui.deployment_tui.deploy_forms.DBScreen(*args, **keywords)[source]

Bases: BaseForm

Form for the core deployment configuration.

step: str = 'db'
class freva_deployment.ui.deployment_tui.deploy_forms.RunForm(display_pages=True, pages_label_color='NORMAL', *args, **keywords)[source]

Bases: FormMultiPageAction

Definition of the form that applies the actual deployment.

create() None[source]

Custom definitions executed when the from gets created.

property num: str

Calculate the number for enumerations of any input field.

on_cancel() None[source]

Define what happens after the the cancel button is hit.

on_ok() None[source]

Define what happens once the ok for applying the deployment is hit.

class freva_deployment.ui.deployment_tui.deploy_forms.SolrScreen(*args, **keywords)[source]

Bases: BaseForm

Form for the solr deployment configuration.

step: str = 'solr'
class freva_deployment.ui.deployment_tui.deploy_forms.WebScreen(*args, **keywords)[source]

Bases: BaseForm

Form for the web deployment configuration.

certificates: list[str] = ['public', 'private', 'chain']

The type of certificate files this step needs.

get_index(choices: list[str], key: str)[source]

Get the key value pair for a combo box

step: str = 'web'
freva_deployment.ui.deployment_tui.deploy_forms.get_index(values: list[str], target: str, default: int = 0) int[source]

Get the target index of item in list.

values:

the list of values that is searched

target:

the item the list of values that is searched for

default:

if nothing is found return the default value

int: Index of the the target item in the list