mirror of
https://github.com/markqvist/Reticulum.git
synced 2026-06-08 22:21:54 -07:00
Updated docs
This commit is contained in:
+3
-245
@@ -683,258 +683,16 @@ another one, which will be created if it does not already exist
|
||||
The rngit Utility
|
||||
=================
|
||||
|
||||
The ``rngit`` utility provides full Git repository hosting and interaction over Reticulum. It allows you to host Git repositories on Reticulum nodes, and to interact with remote repositories using standard Git commands through the ``rns://`` URL scheme.
|
||||
The ``rngit`` utility provides full Git repository hosting and interaction over Reticulum, as well as many other useful features for software development, collaboration and publishing. It allows you to host Git repositories on Reticulum nodes, interact with remote repositories using standard Git commands through the ``rns://`` URL scheme, and to publish software releases.
|
||||
|
||||
The system consists of two parts: The ``rngit`` node that hosts repositories, and the ``git-remote-rns`` helper that enables Git to communicate with rngit nodes. As soon as you have RNS installed on your system, you can transparently use Git with Reticulum-hosted repositories just like any other type of remote. Git over Reticulum uses URLs in the following format: ``rns://DESTINATION_HASH/group/repo``.
|
||||
The system consists of two parts: The ``rngit`` node that hosts and manages repositories, and the ``git-remote-rns`` helper that enables Git to communicate with rngit nodes. As soon as you have RNS installed on your system, you can transparently use Git with Reticulum-hosted repositories just like any other type of remote. Git over Reticulum uses URLs in the following format: ``rns://DESTINATION_HASH/group/repo``.
|
||||
|
||||
If you set a branch to track a Reticulum remote as the default upstream, you can simply use ``git`` as you normally would; all commands work transparently and as expected.
|
||||
|
||||
.. warning::
|
||||
**The rngit program is a new addition to RNS!** This functionality was introduced in RNS 1.2.0. While great care has been taken to design a secure, but highly configurable and flexible permission system for allowing many users to interact with many different repositories on a single node, ``rngit`` has not been tested extensively in the wild! Be careful when hosting repositories, especially if they are public or semi-public.
|
||||
|
||||
**Usage Examples**
|
||||
|
||||
Run ``rngit`` to start a repository node:
|
||||
|
||||
.. code:: text
|
||||
|
||||
$ rngit
|
||||
|
||||
[Notice] Starting Reticulum Git Node...
|
||||
[Notice] Reticulum Git Node listening on <0d7334d411d00120cbad24edf355fdd2>
|
||||
|
||||
On the first run, ``rngit`` will create a default configuration file. You will then need to edit this, to point to your repository locations, configure access permissions, and perform any other necessary configuration.
|
||||
|
||||
View your identity and destination hashes:
|
||||
|
||||
.. code:: text
|
||||
|
||||
$ rngit --print-identity
|
||||
|
||||
Git Peer Identity : <959e10e5efc1bd9d97a4083babe51dea>
|
||||
Repository Node Identity : <153cb870b4665b8c1c348896292b0bad>
|
||||
Repositories Destination : <0d7334d411d00120cbad24edf355fdd2>
|
||||
|
||||
If the page server is enabled, the output will also include the Nomad Network destination hash.
|
||||
|
||||
You can run ``rngit`` in service mode with logging to file:
|
||||
|
||||
.. code:: text
|
||||
|
||||
$ rngit -s
|
||||
|
||||
Clone a repository from a remote ``rngit`` node:
|
||||
|
||||
.. code:: text
|
||||
|
||||
$ git clone rns://50824b711717f97c2fb1166ceddd5ea9/public/myrepo
|
||||
|
||||
Add a Reticulum remote to an existing repository:
|
||||
|
||||
.. code:: text
|
||||
|
||||
$ git remote add some_remote rns://50824b711717f97c2fb1166ceddd5ea9/public/myrepo
|
||||
|
||||
Push changes to the Reticulum remote:
|
||||
|
||||
.. code:: text
|
||||
|
||||
$ git push some_remote master
|
||||
|
||||
Get changes from a remote repository:
|
||||
|
||||
.. code:: text
|
||||
|
||||
$ git pull rns_remote master
|
||||
|
||||
**Repository Structure**
|
||||
|
||||
The ``rngit`` node organizes repositories into groups. Each group is a directory containing bare Git repositories. The repository path format is ``group_name/repo_name``. For example, a repository at ``/var/git/public/myrepo`` would be accessible as ``public/myrepo`` via the URL ``rns://DESTINATION_HASH/public/myrepo``.
|
||||
|
||||
**Configuration**
|
||||
|
||||
The ``rngit`` node configuration file is located at ``~/.rngit/config`` (or ``/etc/rngit/config`` for system-wide installations). The default configuration includes:
|
||||
|
||||
- Repository group paths defining where to find bare repositories
|
||||
- Access permissions for groups and individual repositories
|
||||
- Announce intervals for network visibility
|
||||
- Optional statistics recording for repository activity
|
||||
|
||||
Access permissions can be configured at the group level in the config file, or per-repository using ``.allowed`` files. Permissions use the format ``permission:target`` where permission is ``r`` (read), ``w`` (write), ``rw`` (read/write), ``c`` (create) or ``s`` (stats) and target is ``all``, ``none``, or a specific identity hash.
|
||||
|
||||
The ``s`` (stats) permission allows viewing repository activity statistics, including views, fetches and pushes over time. To enable statistics recording, set ``record_stats = yes`` in the ``[rngit]`` section of the configuration file. You can also exclude specific identities from statistics by adding their hashes to ``stats_ignore_identities``.
|
||||
|
||||
Repository-specific ``.allowed`` files can be static text files or executable scripts that output permission rules to stdout. A ``group.allowed`` file in a repository group directory applies to all repositories within that group.
|
||||
|
||||
**All Command-Line Options (rngit)**
|
||||
|
||||
.. code:: text
|
||||
|
||||
usage: rngit.py [-h] [--config CONFIG] [--rnsconfig RNSCONFIG] [-s] [-i] [-v]
|
||||
[-q] [--version]
|
||||
|
||||
Reticulum Git Repository Node
|
||||
|
||||
options:
|
||||
-h, --help show this help message and exit
|
||||
--config CONFIG path to alternative config directory
|
||||
--rnsconfig RNSCONFIG
|
||||
path to alternative Reticulum config directory
|
||||
-p, --print-identity print identity and destination info and exit
|
||||
-s, --service rngit is running as a service and should log to file
|
||||
-i, --interactive drop into interactive shell after initialisation
|
||||
-v, --verbose increase verbosity
|
||||
-q, --quiet decrease verbosity
|
||||
--version show program's version number and exit
|
||||
|
||||
**All Command-Line Options (git-remote-rns)**
|
||||
|
||||
The ``git-remote-rns`` helper is automatically invoked by Git when interacting with ``rns://`` URLs. It is not typically run directly by users, but accepts the following environment variables for configuration:
|
||||
|
||||
- ``RNGIT_CONFIG`` - Path to alternative client configuration directory
|
||||
- ``RNS_CONFIG`` - Path to alternative Reticulum configuration directory
|
||||
|
||||
The client configuration file is located at ``~/.rngit/client_config`` and allows adjusting parameters such as the reference batch size for transfers.
|
||||
|
||||
**Serving Pages Over Nomad Network**
|
||||
|
||||
In addition to providing Git repository access via the Git remote helper protocol, ``rngit`` can also run a `Nomad Network <https://github.com/markqvist/nomadnet>`_ compatible page node. This allows users to browse repository information, view file contents, inspect commit history and access repository statistics through any Nomad Network client.
|
||||
|
||||
When enabled, the page node provides a complete interface to your repositories, with automatic Markdown to Micron conversion, syntax-highlighted code browsing, and detailed commit, diff and statistics views.
|
||||
|
||||
**Enabling the Git Page Node**
|
||||
|
||||
To enable the page node, add the following to your ``~/.rngit/config`` file:
|
||||
|
||||
.. code:: text
|
||||
|
||||
[pages]
|
||||
serve_nomadnet = yes
|
||||
|
||||
When the page node is enabled, ``rngit`` will listen on a Nomad Network node destination in addition to the Git repository destination. You can view the destination hash by running:
|
||||
|
||||
.. code:: text
|
||||
|
||||
$ rngit --print-identity
|
||||
|
||||
Git Peer Identity : <959e10e5efc1bd9d97a4083babe51dea>
|
||||
Repository Node Identity : <153cb870b4665b8c1c348896292b0bad>
|
||||
Repositories Destination : <0d7334d411d00120cbad24edf355fdd2>
|
||||
Nomad Network Destination : <50824b711717f97c2fb1166ceddd5ea9>
|
||||
|
||||
**Accessing Repository Pages**
|
||||
|
||||
Once the page server is running, you can access it from any Nomad Network client by connecting to the Nomad Network destination. The page node provides the following views:
|
||||
|
||||
- **Front Page** - Lists all repository groups accessible to your identity
|
||||
- **Group Page** - Shows all repositories within a group
|
||||
- **Repository Page** - Displays repository overview, description and README
|
||||
- **File Browser** - Browse directory trees and view file contents
|
||||
- **Commits View** - View commit history with pagination
|
||||
- **Commit Details** - Detailed commit information with file changes and diffs
|
||||
- **Refs View** - List branches and tags
|
||||
- **Statistics** - Activity charts showing views, fetches and pushes over time
|
||||
|
||||
All pages respect the same permission system used for Git access. If an identity does not have read access to a repository, they will not be able to view its pages.
|
||||
|
||||
**Syntax Highlighting**
|
||||
|
||||
If the ``pygments`` Python module is installed on your system, the page server will automatically apply syntax highlighting to code files. The highlighting supports a wide range of programming languages and uses a color theme optimized for terminal display.
|
||||
|
||||
To enable syntax highlighting, install pygments:
|
||||
|
||||
.. code:: text
|
||||
|
||||
pip install pygments
|
||||
|
||||
**Markdown & Micron Support**
|
||||
|
||||
README files and other Markdown documents are automatically converted to Micron markup for display in Nomad Network clients. You can also write your README files directly in Micron, in which case they will display and render as such in any Nomad Network client. The file browser also supports viewing both rendered and raw Markdown and Micron documents.
|
||||
|
||||
Code blocks in Markdown can include language hints for syntax highlighting:
|
||||
|
||||
.. code:: text
|
||||
|
||||
```python
|
||||
def hello_world():
|
||||
print("Hello, Reticulum!")
|
||||
```
|
||||
|
||||
**Customizing Templates**
|
||||
|
||||
The page server uses a template system that allows complete customization of the generated pages. Templates are stored in the ``~/.rngit/templates/`` directory as Micron files.
|
||||
|
||||
The following template files are supported:
|
||||
|
||||
- ``base.mu`` - Base template wrapping all pages (must include ``{PAGE_CONTENT}``)
|
||||
- ``front.mu`` - Front page listing all groups
|
||||
- ``group.mu`` - Group page listing repositories
|
||||
- ``repo.mu`` - Repository overview page
|
||||
- ``tree.mu`` - File browser pages
|
||||
- ``blob.mu`` - File content display
|
||||
- ``commits.mu`` - Commit history listing
|
||||
- ``commit.mu`` - Individual commit detail page
|
||||
- ``refs.mu`` - Branches and tags listing
|
||||
- ``stats.mu`` - Statistics page
|
||||
|
||||
Templates can include the following variables:
|
||||
|
||||
- ``{PAGE_CONTENT}`` - The main content of the page (required)
|
||||
- ``{NODE_NAME}`` - The configured node name
|
||||
- ``{NAVIGATION}`` - Breadcrumb navigation links
|
||||
- ``{VERSION}`` - The rngit version number
|
||||
- ``{GEN_TIME}`` - Page generation time
|
||||
|
||||
**Dynamic Templates**
|
||||
|
||||
Templates can be made executable to generate dynamic content. If a template file has the executable bit set, it will be executed and its stdout used as the template content.
|
||||
|
||||
**Icon Sets**
|
||||
|
||||
By default, the page server uses Nerd Font icons. If you prefer simpler icons or your terminal does not support Nerd Fonts, you can enable Unicode icons instead:
|
||||
|
||||
.. code:: text
|
||||
|
||||
[pages]
|
||||
serve_nomadnet = yes
|
||||
unicode_icons = yes
|
||||
|
||||
**Repository Statistics**
|
||||
|
||||
When statistics recording is enabled (see the ``record_stats`` configuration option), the page server can display activity charts for each repository. The statistics page shows:
|
||||
|
||||
- Total and peak views, fetches and pushes
|
||||
- Daily activity charts over a 90-day period
|
||||
- Combined activity visualization
|
||||
|
||||
To view statistics, a user must have the ``s`` (stats) permission for the repository. See the Access Configuration section for details on setting permissions.
|
||||
|
||||
**Repository Thanks**
|
||||
|
||||
The page server includes a "Thanks" feature that allows users to express appreciation for a repository. On each repository page, a "Thanks" link is displayed showing the current thanks count. Clicking this link registers a thank you for the repository.
|
||||
|
||||
**Configuration Example**
|
||||
|
||||
A complete page server configuration might look like this:
|
||||
|
||||
.. code:: text
|
||||
|
||||
[rngit]
|
||||
node_name = My Git Server
|
||||
announce_interval = 360
|
||||
record_stats = yes
|
||||
|
||||
[repositories]
|
||||
public = /var/git/public
|
||||
internal = /var/git/internal
|
||||
|
||||
[access]
|
||||
public = r:all
|
||||
internal = rw:9710b86ba12c42d1d8f30f74fe509286
|
||||
|
||||
[pages]
|
||||
serve_nomadnet = yes
|
||||
unicode_icons = no
|
||||
For the full documentation on the `rngit` system, see the :ref:`Using Git Over Reticulum<git-main>` chapter of this manual.
|
||||
|
||||
|
||||
The rnx Utility
|
||||
|
||||
Reference in New Issue
Block a user