docs: update references to renamed commons repository (#11)
This commit is contained in:
1 parent
6b0a893c86
commit
8dba55272c
12 files changed
+461
-3
No files matched your search
@@ -0,0 +1,12 @@
|
||||
---
|
||||
title: Guides
|
||||
description: Step-by-step guides for installation and action development.
|
||||
weight: 20
|
||||
---
|
||||
|
||||
Step-by-step guides for installing and developing within the Root infrastructure framework.
|
||||
|
||||
{{% cards %}}
|
||||
{{< card link="installation" title="Installation" icon="arrow-down" subtitle="Initial setup of the Root framework on a new host." >}}
|
||||
{{< card link="action-development" title="Action development" icon="code" subtitle="Creating and managing atomic automation tasks." >}}
|
||||
{{% /cards %}}
|
||||
@@ -0,0 +1,67 @@
|
||||
---
|
||||
title: Action development
|
||||
description: Developing atomic automation tasks in the Root framework.
|
||||
weight: 30
|
||||
---
|
||||
|
||||
[Actions](/root/glossary#action) are atomic automation tasks. Following the "Stupid Action" philosophy, they must remain declarative and rely on the library for complex operations.
|
||||
|
||||
## Creating a new action {#create}
|
||||
|
||||
{{% steps %}}
|
||||
|
||||
### Step 1: Create the script file
|
||||
|
||||
Place your script in `scripts/actions/{group}/{name}`. Do not use file extensions.
|
||||
|
||||
### Step 2: Implement metadata
|
||||
|
||||
Every action must provide a description and argument list for the help system.
|
||||
|
||||
```bash filename="scripts/actions/utils/my-action"
|
||||
action_metadata() {
|
||||
cat <<EOF
|
||||
description: "Brief summary of the task."
|
||||
args:
|
||||
- NODE: "The node name"
|
||||
- PARAM: "A custom parameter"
|
||||
EOF
|
||||
}
|
||||
```
|
||||
|
||||
### Step 3: Initialize context
|
||||
|
||||
Use the `root_require_node` helper to establish the environment. This must be the first functional step in your script.
|
||||
|
||||
```bash filename="scripts/actions/utils/my-action"
|
||||
root_require_node "${1:-}"
|
||||
shift
|
||||
```
|
||||
|
||||
### Step 4: Use namespaced helpers
|
||||
|
||||
Perform operations using the `root_*` library functions. Rely on `ROOT_` environment variables for all pathing.
|
||||
|
||||
```bash filename="scripts/actions/utils/my-action"
|
||||
root_log_info "Processing node $ROOT_NODE"
|
||||
root_sys_restart_service "my-service"
|
||||
```
|
||||
|
||||
{{% /steps %}}
|
||||
|
||||
## Library namespaces {#libraries}
|
||||
|
||||
Actions have access to the following modules:
|
||||
|
||||
- `root_core_*`: Logging and Telegram notifications.
|
||||
- `root_init_*`: Declarative service initialization and package management.
|
||||
- `root_sys_*`: Systemd and unit file management.
|
||||
- `root_template_*`: Envsubst-based rendering and configuration injection.
|
||||
- `root_validate_*`: Input, file, and OS validation.
|
||||
|
||||
---
|
||||
|
||||
**See also:**
|
||||
|
||||
- [Reference: ROOT_ API reference](/root/reference/root-api)
|
||||
- [Concept: Infrastructure architecture](/root/concepts/architecture)
|
||||
@@ -0,0 +1,60 @@
|
||||
---
|
||||
title: Installation
|
||||
description: Initial setup of the Root framework on a new host.
|
||||
weight: 25
|
||||
---
|
||||
|
||||
This guide covers the initial setup of the Root framework on a new host.
|
||||
|
||||
## Prerequisites {#prerequisites}
|
||||
|
||||
- A Debian-based Linux distribution (Debian or Ubuntu).
|
||||
- Git installed.
|
||||
- Sudo privileges.
|
||||
|
||||
## Initializing the repository {#init}
|
||||
|
||||
{{% steps %}}
|
||||
|
||||
### Step 1: Clone the configuration repository
|
||||
|
||||
Clone the repository containing your [Node](/root/glossary#node) configurations.
|
||||
|
||||
```bash
|
||||
git clone <your-configs-repo-url> ~/repo
|
||||
cd ~/repo
|
||||
```
|
||||
|
||||
### Step 2: Run the initialization script
|
||||
|
||||
The `init.sh` script sets up the [Commons](/root/glossary#commons) submodule, configures Git hooks, and adds the `root` wrapper to your `PATH`.
|
||||
|
||||
```bash
|
||||
./init.sh
|
||||
```
|
||||
|
||||
### Step 3: Refresh your shell
|
||||
|
||||
Source your `.bashrc` to activate the `root` command.
|
||||
|
||||
```bash
|
||||
source ~/.bashrc
|
||||
```
|
||||
|
||||
{{% /steps %}}
|
||||
|
||||
## Provisioning a node {#provision}
|
||||
|
||||
Once the framework is installed, you can provision a specific [Node](/root/glossary#node).
|
||||
|
||||
```bash
|
||||
root configure/base <node_name>
|
||||
root configure/ufw <node_name>
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
**See also:**
|
||||
|
||||
- [Concept: Infrastructure architecture](/root/concepts/architecture)
|
||||
- [Reference: ROOT_ API reference](/root/reference/root-api)
|
||||
Reference in new issue
Block a user