Skip to content

Latest commit

 

History

History
204 lines (128 loc) · 6.8 KB

File metadata and controls

204 lines (128 loc) · 6.8 KB

Dvestezar Terminal Manager - Debian Based

(ChatGPT)

v1.3.1

Preview

Application Description

Dvestezar Terminal Manager is a tool for managing Debian-based systems such as Ubuntu, Raspbian, OrangePi, and other distributions. It provides a simple terminal-based menu for controlling various system functionalities.

This tool is designed as a modular framework that can be easily extended with new sub-applications and features as needed.

Current application features:

  1. User Management:

    • Manage system users, including adding, deleting, and setting passwords.
    • Generate and manage SSH keys with automatic saving to authorized_keys.
    • Manage user access to sudo.
  2. Node-RED Instance Manager:

    • Create, edit, back up, and delete Node-RED instances.
    • Manage templates for quick deployment of new instances.
    • Automatically check and configure services for each instance.

Extension Invitation

The application is ready for extension with additional modules and sub-applications. If you have ideas for new functionality or wish to add support for a specific service, contributions are welcome!

New modules can be added simply as new sub-applications in the libs/app/menus/<app_dir> directory. This structure allows easy integration into the main menu and clean code management.


Application Menu Creation

The main menu is generated by iterating through libs/app/menus/<app_dir> where <app_dir> must contain:

  • menu.py with the following:
    • A _MENU_NAME_ property holding the text displayed as the main menu option.
    • A menu class to be called as the default menu for the application.

Node-RED Instance Control

Node-RED Instance Control is a management tool for configuring and maintaining individual Node-RED instances on the server. It provides a user-friendly terminal menu for performing various tasks, such as creating, editing, backing up, and deleting Node-RED instances. This tool is designed for efficient management in multi-user environments, where each user can have their own Node-RED instance.

Key Features:

  1. Setting up and editing instances:

    • Create a new Node-RED instance for a specific system user.
    • Edit existing instances, including changing the name, password, port, or installation type (e.g., fresh installation or from an archive).
    • Configure the service for read-only or full access.
  2. Node-RED service management:

    • Start, stop, and disable Node-RED services.
    • Check the service status for a specific user.
  3. Backup and restore:

    • Automatically back up all or individual Node-RED instances.
    • Create backups of the current configuration and user data.
  4. Service templates:

    • Create Node-RED service templates to serve as defaults for new instances.
    • Uninstall or remove service templates.
  5. User management:

    • Add new users.
    • Configure and adjust user access to the Node-RED dashboard.
    • Set users to read-only or full access modes.

Menus and Controls

  • Main Menu provides an overview of the configuration, including the server URL, backup directories, temporary directories, and default instances. You can perform actions like creating or editing instances, backing up, or creating templates.
  • Edit Menu allows detailed configuration of specific instances, such as changing ports, names, access levels, and other parameters.
  • User Menu offers options for adding users, configuring access, and managing individual user profiles.

Installation Types

  • Fresh: Clean installation from the repository, suitable for new users or creating entirely new instances.
  • Copy: Installation from an existing archive, allowing quick restoration or cloning of previous configurations.

Additional Features

  • Security and Access: Users can be set with "full" or "read-only" access levels, which are ideal for audit or control purposes.

This tool simplifies the management of multiple Node-RED instances in a single environment and offers flexibility in user management, ensuring operational efficiency and consistency.

SSH MANAGER

The manager handles SSH certificates for terminal connections but can be used for various purposes.

Primarily intended for server administrators, such as managing Node-RED instances, where an SSH key is created for the user to enable debugging.

Directly manages the authorized_keys file of users:

  • System user management:
    • Create system users.
    • Set system user passwords.
    • Delete system users, first backing up their home directories before completely removing the user, including the home directory data.
  • Creates a ~/.ssh/sshManager directory in the user's home directory for storing generated keys.
  • Generated keys can:
    • Display the private key for the user to copy.
    • Include or exclude the key from authorized_keys.

Main File

Run the application using !run.py.

Requirements

Files

Required:

  • config.ini must be created before the first run based on cfg.py.

Recommended:

  • /home/defaultNodeInstance.7z optional prepackaged Node-RED instance directory. This file may contain a complete Node-RED instance, including installed modules and a basic flow. The root directory inside the archive must be named defaultNodeInstance.

System

Tested on Ubuntu 22+.

Python

Tested on Python 3.10+.

Python Libraries

See requirements.txt. Installable using:

pip install -r requirements.txt

Applications from apt

7zip:

apt install p7zip-full

Node.js:

For proper functionality, Node.js must be installed globally. For the current LTS 22 version:

curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
sudo apt-get install -y nodejs

Submodules

This app uses the submodule 'JBLibs-python'. After cloning the repository, initialize the submodule with:

git submodule update --init --recursive

Or directly add it if submodules aren't functioning:

git submodule add -b <branch> https://github.com/dvestezarzlkl/JBLibs-python.git libs/JBLibs

Root Directory Files

!run.py

Main application file.

sys_apps.sh

Script for launching !run.app via a symlink.

Example:

ln -s /path/to/script/sys_apps.sh /usr/local/bin/sys_apps

rq.sh

Generates a requirements.txt for non-standard Python libraries.

update_from_git.sh

Updates the local repository to match the current state of the Git repository.

makeRelease.py

Packages the directory into a ZIP file containing only necessary files and directories. Output is stored in a release subdirectory.


Set executable permissions where needed:

chmod +x '!run.py' 'sys_apps.sh'