Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions src/launch_manager_daemon/config/config_schema/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
..
# *******************************************************************************
# Copyright (c) 2026 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0
#
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************


Launch Manager Configuration Schema
###################################

This folder contains the Launch Manager configuration JSON Schema. The schema defines and validates the structure of Launch Manager configuration files.

Overview
********

This project manages the Launch Manager configuration schema as a single, self-contained file. When you need to modify or extend the schema, you should directly edit `s-core_launch_manager.schema.json`.

**Project Structure:**

::

+-- s-core_launch_manager.schema.json # The Launch Manager schema.
+-- examples/ # Illustrative example configuration files for the schema.
+-- scripts/ # Utility scripts, including a validation tool.

Quick Start
***********

For Users & Developers
======================

Whether you're validating a Launch Manager configuration against the schema, or actively developing and modifying the schema itself, here's how to interact with this project:

1. **Locate the Schema:** The complete schema definition resides in ``s-core_launch_manager.schema.json``.
2. **Explore Examples:** The ``examples/`` folder provides various sample Launch Manager configuration files. These are invaluable for understanding how the schema applies in practice and how to structure your own configurations.
3. **Validate Your Configuration:** Use the provided validation script to check if your configuration file conforms to the schema:

.. code-block:: bash

scripts/validate.py --schema s-core_launch_manager.schema.json --instance your_config.json

Examples
********

The ``examples`` folder contains a set of sample Launch Manager configuration files. Each example demonstrates valid configurations according to the ``s-core_launch_manager.schema.json``.

**Recommendation:** If you are new to Launch Manager configurations, **start by reviewing these examples**. They offer practical insight into the expected structure, available properties, and common use cases defined by the schema.

Scripts
*******

The ``scripts`` folder houses utility scripts designed to assist with schema development.

validate.py
===========

The ``validate.py`` script is a crucial tool for verifying that any given Launch Manager configuration instance adheres to the rules defined in `s-core_launch_manager.schema.json`.

**Usage:**

To validate a configuration file (e.g., `example_conf.json` from the `examples` folder) against the schema:

.. code-block:: bash

scripts/validate.py --schema s-core_launch_manager.schema.json --instance examples/example_conf.json
Success --> examples/example_conf.json: valid

**When to use:**
* **During Development:** Run this script frequently whenever you're creating or modifying a Launch Manager configuration file. It provides immediate feedback on whether your changes are valid according to the schema.
* **Schema Development:** If you are making changes to `s-core_launch_manager.schema.json` itself, always run `validate.py` against the examples to ensure your schema changes haven't inadvertently broken existing, valid configurations.

Typical Workflow
****************

For schema developers or those creating new configurations:

1. **Modify** the ``s-core_launch_manager.schema.json`` file (if you're updating the schema definition) or your Launch Manager configuration file.
2. **Validate** your changes using the `scripts/validate.py` script against relevant example files or your new configuration. This iterative process helps ensure compliance and catch errors early.
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
{
"schema_version": 1,
"defaults": {
"deployment_config": {
"ready_timeout": 0.5,
"shutdown_timeout": 0.5,
"environmental_variables": {
"LD_LIBRARY_PATH": "/opt/lib"
},
"bin_dir": "/opt",
"working_dir": "/tmp",
"ready_recovery_action": {
"restart": {
"number_of_attempts": 0,
"delay_before_restart": 0
}
},
"recovery_action": {
"switch_run_target": {
"run_target": "Off"
}
},
"sandbox": {
"uid": 1000,
"gid": 1000,
"supplementary_group_ids": [],
"scheduling_policy": "SCHED_OTHER",
"scheduling_priority": 0
}
},
"component_properties": {
"application_profile": {
"application_type": "Reporting_And_Supervised",
"is_self_terminating": false,
"alive_supervision": {
"reporting_cycle": 0.5,
"failed_cycles_tolerance": 2,
"min_indications": 1,
"max_indications": 3
}
},
"depends_on": [],
"process_arguments": [],
"ready_condition": {
"process_state": "Running"
}
},
"run_target": {
"depends_on": [],
"transition_timeout": 5
},
"alive_supervision" : {
"evaluation_cycle": 0.5
},
"watchdog": {
"device_file_path": "/dev/watchdog",
"max_timeout": 2.0,
"deactivate_on_shutdown": true,
"require_magic_close": false
}
},
"components": {
"setup_filesystem_sh": {
"description": "Script to mount partitions at the right directories",
"component_properties": {
"binary_name": "bin/setup_filesystem.sh",
"application_profile": {
"application_type": "Native",
"is_self_terminating": true
},
"process_arguments": ["-a", "-b"],
"ready_condition": {
"process_state": "Terminated"
}
},
"deployment_config": {
"bin_dir": "/opt/scripts"
}
},
"dlt-daemon": {
"description": "Logging application",
"component_properties": {
"binary_name": "dltd",
"application_profile": {
"application_type": "Native"
},
"depends_on": ["setup_filesystem_sh"]
},
"deployment_config": {
"bin_dir" : "/opt/apps/dlt-daemon"
}
Comment on lines +89 to +91
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do we deal with different deployment configs e.g. for linux and qnx?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know that we were talking about this in the last review, but this is a bit harder to handle in the schema than it looks at first glance.

With current schema we should be able to create Linux specific configuration file and also QNX specific configuration file. If we accept this version as the alpha version of schema, we could proceed with API adaptation and we could have Run Target based LM soon.

As a next step we can have another story to work on differences between Linux and QNX configuration and see what adaptations to the schema we need.
Current version of the schema is already complicated and it would be beneficial to add additional functionality in stages.

Finger cross this is OK.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine with me for the first version as long as we have it on the radar for the next version :-) For the next version it's a must then as we will have deployments for different OSes.

},
"someip-daemon": {
"description": "SOME/IP application",
"component_properties": {
"binary_name": "someipd"
},
"deployment_config": {
"bin_dir" : "/opt/apps/someip"
}
},
"test_app1": {
"description": "Simple test application",
"component_properties": {
"binary_name": "test_app1",
"depends_on": ["dlt-daemon", "someip-daemon"]
},
"deployment_config": {
"bin_dir" : "/opt/apps/test_app1"
}
},
"state_manager": {
"description": "Application that manages life cycle of the ECU",
"component_properties": {
"binary_name": "sm",
"application_profile": {
"application_type": "State_Manager"
},
"depends_on": ["setup_filesystem_sh"]
},
"deployment_config": {
"bin_dir" : "/opt/apps/state_manager"
}
}
},
"run_targets": {
"Minimal": {
"description": "Minimal functionality of the system",
"depends_on": ["state_manager"],
"recovery_action": {
"switch_run_target": {
"run_target": "Off"
}
}
},
"Full": {
"description": "Everything running",
"depends_on": ["test_app1", "Minimal"],
"transition_timeout": 5,
"recovery_action": {
"switch_run_target": {
"run_target": "Minimal"
}
}
},
"Off": {
"description": "Nothing is running",
"recovery_action": {
"switch_run_target": {
"run_target": "Off"
}
}
}
},
"alive_supervision" : {
"evaluation_cycle": 0.5
},
"fallback_run_target": {
"description": "Switching off everything",
"depends_on": [],
"transition_timeout": 1.5
},
"initial_run_target": "Minimal",
"watchdog": {
"device_file_path": "/dev/watchdog",
"max_timeout": 2,
"deactivate_on_shutdown": true,
"require_magic_close": false
}
}
Loading
Loading