chore: add current provisioning state before migration
This commit is contained in:
parent
a9703b4748
commit
50745b0f22
660 changed files with 88126 additions and 0 deletions
40
taskservs/radicle/default/env-radicle.j2
Normal file
40
taskservs/radicle/default/env-radicle.j2
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
# Radicle Environment Configuration
|
||||
# Generated by provisioning system
|
||||
|
||||
RADICLE_VERSION={{ radicle.version }}
|
||||
RADICLE_RUN_USER={{ radicle.run_user.name }}
|
||||
RADICLE_RUN_GROUP={{ radicle.run_user.group }}
|
||||
RADICLE_RUN_USER_HOME={{ radicle.run_user.home }}
|
||||
RADICLE_WORK_PATH={{ radicle.work_path }}
|
||||
RADICLE_CONFIG_PATH={{ radicle.config_path }}
|
||||
RADICLE_RUN_PATH={{ radicle.run_path }}
|
||||
RADICLE_STORAGE_PATH={{ radicle.storage_path }}
|
||||
|
||||
# Network Configuration
|
||||
RADICLE_BIND_ADDR={{ radicle.bind_addr }}
|
||||
RADICLE_BIND_PORT={{ radicle.bind_port }}
|
||||
RADICLE_PEER_PORT={{ radicle.peer_port }}
|
||||
RADICLE_WEB_UI_PORT={{ radicle.web_ui_port }}
|
||||
|
||||
# Node Configuration
|
||||
RADICLE_CONNECT_TIMEOUT={{ radicle.connect_timeout }}
|
||||
RADICLE_ANNOUNCE={{ radicle.announce | lower }}
|
||||
RADICLE_LOG_LEVEL={{ radicle.log_level }}
|
||||
|
||||
# Seeds and External Addresses
|
||||
{% if radicle.seeds %}
|
||||
RADICLE_SEEDS="{{ radicle.seeds | join(',') }}"
|
||||
{% endif %}
|
||||
{% if radicle.external_addresses %}
|
||||
RADICLE_EXTERNAL_ADDRESSES="{{ radicle.external_addresses | join(',') }}"
|
||||
{% endif %}
|
||||
|
||||
# HTTP Daemon Configuration
|
||||
{% if radicle.httpd is defined %}
|
||||
RADICLE_HTTPD_ENABLED={{ radicle.httpd.enabled | lower }}
|
||||
RADICLE_HTTPD_BIND_ADDR={{ radicle.httpd.bind_addr }}
|
||||
RADICLE_HTTPD_BIND_PORT={{ radicle.httpd.bind_port }}
|
||||
{% if radicle.httpd.assets_path is defined %}
|
||||
RADICLE_HTTPD_ASSETS_PATH={{ radicle.httpd.assets_path }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
157
taskservs/radicle/default/install-radicle.sh
Executable file
157
taskservs/radicle/default/install-radicle.sh
Executable file
|
|
@ -0,0 +1,157 @@
|
|||
#!/bin/bash
|
||||
# Info: Script to install Radicle
|
||||
# Author: Provisioning System
|
||||
# Release: 1.0
|
||||
# Date: 2025-07-24
|
||||
|
||||
USAGE="install-radicle.sh"
|
||||
[ "$1" == "-h" ] && echo "$USAGE" && exit 1
|
||||
|
||||
[ -r "env-radicle" ] && . ./env-radicle
|
||||
|
||||
RADICLE_VERSION=${RADICLE_VERSION:-1.0.0}
|
||||
|
||||
RADICLE_URL=https://github.com/radicle-dev/radicle-node/releases/download
|
||||
ARCH="$(uname -m | sed -e 's/x86_64/x86_64/' -e 's/aarch64$/aarch64/')"
|
||||
RADICLE_FILE=v${RADICLE_VERSION}/radicle-node-v${RADICLE_VERSION}-${ARCH}-unknown-linux-gnu.tar.xz
|
||||
RADICLE_ARCHIVE=radicle-node-v${RADICLE_VERSION}-${ARCH}-unknown-linux-gnu.tar.xz
|
||||
|
||||
RADICLE_RUN_PATH=${RADICLE_RUN_PATH:-/usr/local/bin}
|
||||
RADICLE_SYSTEMCTL_MODE=${RADICLE_SYSTEMCTL_MODE:-enabled}
|
||||
|
||||
RADICLE_CONFIG_PATH=${RADICLE_CONFIG_PATH:-/etc/radicle}
|
||||
RADICLE_WORK_PATH=${RADICLE_WORK_PATH:-/var/lib/radicle}
|
||||
RADICLE_STORAGE_PATH=${RADICLE_STORAGE_PATH:-/var/lib/radicle/storage}
|
||||
|
||||
RADICLE_RUN_USER=${RADICLE_RUN_USER:-radicle}
|
||||
RADICLE_RUN_GROUP=${RADICLE_RUN_GROUP:-radicle}
|
||||
RADICLE_RUN_USER_HOME=${RADICLE_RUN_USER_HOME:-/home/radicle}
|
||||
|
||||
RADICLE_BIND_ADDR=${RADICLE_BIND_ADDR:-0.0.0.0}
|
||||
RADICLE_BIND_PORT=${RADICLE_BIND_PORT:-8776}
|
||||
RADICLE_PEER_PORT=${RADICLE_PEER_PORT:-8777}
|
||||
RADICLE_WEB_UI_PORT=${RADICLE_WEB_UI_PORT:-8080}
|
||||
|
||||
RADICLE_LOG_LEVEL=${RADICLE_LOG_LEVEL:-info}
|
||||
|
||||
echo "Installing Radicle ${RADICLE_VERSION}..."
|
||||
|
||||
# Create user and group
|
||||
if ! id "$RADICLE_RUN_USER" &>/dev/null; then
|
||||
groupadd -r "$RADICLE_RUN_GROUP"
|
||||
useradd -r -g "$RADICLE_RUN_GROUP" -d "$RADICLE_RUN_USER_HOME" -s /bin/bash -c "Radicle service user" "$RADICLE_RUN_USER"
|
||||
fi
|
||||
|
||||
# Create directories
|
||||
mkdir -p "$RADICLE_CONFIG_PATH"
|
||||
mkdir -p "$RADICLE_WORK_PATH"
|
||||
mkdir -p "$RADICLE_STORAGE_PATH"
|
||||
mkdir -p "$RADICLE_RUN_USER_HOME"
|
||||
|
||||
# Download and install Radicle
|
||||
cd /tmp
|
||||
echo "Downloading Radicle from ${RADICLE_URL}/${RADICLE_FILE}..."
|
||||
curl -L -o "$RADICLE_ARCHIVE" "${RADICLE_URL}/${RADICLE_FILE}"
|
||||
|
||||
if [ ! -f "$RADICLE_ARCHIVE" ]; then
|
||||
echo "Failed to download Radicle archive"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Extract and install binaries
|
||||
echo "Extracting Radicle..."
|
||||
tar -xf "$RADICLE_ARCHIVE"
|
||||
EXTRACT_DIR=$(tar -tf "$RADICLE_ARCHIVE" | head -1 | cut -f1 -d"/")
|
||||
cd "$EXTRACT_DIR"
|
||||
|
||||
# Install binaries
|
||||
cp rad "$RADICLE_RUN_PATH/"
|
||||
cp radicle-node "$RADICLE_RUN_PATH/"
|
||||
cp radicle-httpd "$RADICLE_RUN_PATH/"
|
||||
|
||||
# Make binaries executable
|
||||
chmod +x "$RADICLE_RUN_PATH/rad"
|
||||
chmod +x "$RADICLE_RUN_PATH/radicle-node"
|
||||
chmod +x "$RADICLE_RUN_PATH/radicle-httpd"
|
||||
|
||||
# Set ownership
|
||||
chown -R "$RADICLE_RUN_USER:$RADICLE_RUN_GROUP" "$RADICLE_WORK_PATH"
|
||||
chown -R "$RADICLE_RUN_USER:$RADICLE_RUN_GROUP" "$RADICLE_STORAGE_PATH"
|
||||
chown -R "$RADICLE_RUN_USER:$RADICLE_RUN_GROUP" "$RADICLE_RUN_USER_HOME"
|
||||
chown -R "$RADICLE_RUN_USER:$RADICLE_RUN_GROUP" "$RADICLE_CONFIG_PATH"
|
||||
|
||||
# Initialize Radicle node if not already initialized
|
||||
if [ ! -f "$RADICLE_STORAGE_PATH/node.json" ]; then
|
||||
echo "Initializing Radicle node..."
|
||||
sudo -u "$RADICLE_RUN_USER" RAD_HOME="$RADICLE_WORK_PATH" "$RADICLE_RUN_PATH/rad" auth --init
|
||||
fi
|
||||
|
||||
# Create systemd service file
|
||||
cat > /etc/systemd/system/radicle-node.service << EOF
|
||||
[Unit]
|
||||
Description=Radicle Node
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=$RADICLE_RUN_USER
|
||||
Group=$RADICLE_RUN_GROUP
|
||||
Environment=RAD_HOME=$RADICLE_WORK_PATH
|
||||
WorkingDirectory=$RADICLE_WORK_PATH
|
||||
ExecStart=$RADICLE_RUN_PATH/radicle-node --listen $RADICLE_BIND_ADDR:$RADICLE_PEER_PORT --log $RADICLE_LOG_LEVEL
|
||||
Restart=always
|
||||
RestartSec=10
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
# Create systemd service file for HTTP daemon
|
||||
if [ "${RADICLE_HTTPD_ENABLED:-true}" = "true" ]; then
|
||||
cat > /etc/systemd/system/radicle-httpd.service << EOF
|
||||
[Unit]
|
||||
Description=Radicle HTTP Daemon
|
||||
After=network.target radicle-node.service
|
||||
Requires=radicle-node.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=$RADICLE_RUN_USER
|
||||
Group=$RADICLE_RUN_GROUP
|
||||
Environment=RAD_HOME=$RADICLE_WORK_PATH
|
||||
WorkingDirectory=$RADICLE_WORK_PATH
|
||||
ExecStart=$RADICLE_RUN_PATH/radicle-httpd --listen ${RADICLE_HTTPD_BIND_ADDR:-$RADICLE_BIND_ADDR}:${RADICLE_HTTPD_BIND_PORT:-$RADICLE_WEB_UI_PORT}
|
||||
Restart=always
|
||||
RestartSec=10
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
# Enable and start HTTP daemon service
|
||||
systemctl daemon-reload
|
||||
systemctl "$RADICLE_SYSTEMCTL_MODE" radicle-httpd.service
|
||||
if [ "$RADICLE_SYSTEMCTL_MODE" = "enabled" ]; then
|
||||
systemctl start radicle-httpd.service
|
||||
fi
|
||||
fi
|
||||
|
||||
# Enable and start node service
|
||||
systemctl daemon-reload
|
||||
systemctl "$RADICLE_SYSTEMCTL_MODE" radicle-node.service
|
||||
|
||||
if [ "$RADICLE_SYSTEMCTL_MODE" = "enabled" ]; then
|
||||
systemctl start radicle-node.service
|
||||
fi
|
||||
|
||||
# Cleanup
|
||||
cd /
|
||||
rm -rf /tmp/"$RADICLE_ARCHIVE" /tmp/"$EXTRACT_DIR"
|
||||
|
||||
echo "Radicle installation completed!"
|
||||
echo "Node service: radicle-node.service"
|
||||
if [ "${RADICLE_HTTPD_ENABLED:-true}" = "true" ]; then
|
||||
echo "HTTP daemon service: radicle-httpd.service"
|
||||
echo "Web UI available at: http://${RADICLE_HTTPD_BIND_ADDR:-$RADICLE_BIND_ADDR}:${RADICLE_HTTPD_BIND_PORT:-$RADICLE_WEB_UI_PORT}"
|
||||
fi
|
||||
echo "Storage path: $RADICLE_STORAGE_PATH"
|
||||
22
taskservs/radicle/default/prepare
Executable file
22
taskservs/radicle/default/prepare
Executable file
|
|
@ -0,0 +1,22 @@
|
|||
#!/bin/bash
|
||||
# Info: Radicle preparation script
|
||||
# Author: Provisioning System
|
||||
# Release: 1.0
|
||||
|
||||
echo "Preparing Radicle installation..."
|
||||
|
||||
# Load environment variables
|
||||
[ -r "env-radicle" ] && . ./env-radicle
|
||||
|
||||
# Check if required tools are available
|
||||
command -v curl >/dev/null 2>&1 || { echo "curl is required but not installed." >&2; exit 1; }
|
||||
command -v tar >/dev/null 2>&1 || { echo "tar is required but not installed." >&2; exit 1; }
|
||||
command -v systemctl >/dev/null 2>&1 || { echo "systemctl is required but not installed." >&2; exit 1; }
|
||||
|
||||
# Validate configuration
|
||||
if [ -z "$RADICLE_VERSION" ]; then
|
||||
echo "RADICLE_VERSION must be set" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Preparation completed successfully."
|
||||
2
taskservs/radicle/default/provisioning.toml
Normal file
2
taskservs/radicle/default/provisioning.toml
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
info = "radicle"
|
||||
release = "1.0"
|
||||
18
taskservs/radicle/info.md
Normal file
18
taskservs/radicle/info.md
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
Radicle taskserv has been successfully added to the provisioning system! The service includes:
|
||||
|
||||
Created files:
|
||||
- taskservs/radicle/kcl/radicle.k - KCL schema definitions for Radicle configuration
|
||||
- taskservs/radicle/default/provisioning.toml - Service metadata
|
||||
- taskservs/radicle/default/env-radicle.j2 - Environment variable template
|
||||
- taskservs/radicle/default/install-radicle.sh - Installation script
|
||||
- taskservs/radicle/default/prepare - Preparation script
|
||||
|
||||
Features:
|
||||
- Configurable Radicle node with peer-to-peer networking
|
||||
- Optional HTTP daemon for web interface
|
||||
- Systemd service integration
|
||||
- User and permission management
|
||||
- Configurable ports, storage paths, and logging
|
||||
- Automatic service discovery (no manual registry needed)
|
||||
|
||||
The service can now be deployed using: ./core/nulib/provisioning taskserv create radicle
|
||||
Loading…
Add table
Add a link
Reference in a new issue