4
0
forked from Mirror/wfb-ng
wfb-ng/README_template.md

5.4 KiB

Configuration Template

This template script allows you to configure various settings using environment variables. This provides flexibility and ease of configuration for different environments.

Usage

To use the template script, you need to set the appropriate environment variables before running the script. The script will replace placeholders with the values of these environment variables.

Environment Variables

Below is a list of environment variables you can set to configure the script:

  • CONF_DIR: Directory for configuration files. Default is /etc.
  • BIN_DIR: Directory for binary files. Default is /usr/bin.
  • TMP_DIR: Directory for temporary files. Default is /tmp.
  • LOG_DIR: Directory for log files. Default is /var/log.
  • DEBUG: Enable or disable debug mode. Default is False.
  • PRIMARY: Set to True for primary instance. Default is True.
  • LOG_FILE: Log file name. Default is None.
  • BINARY_LOG_FILE: Binary log file name. Default is None.
  • SET_NM_UNMANAGED: Set radio interface unmanaged in NetworkManager. Default is True.
  • RADIO_MTU: Maximum transmission unit for radio. Default is 1445.
  • TUNNEL_AGG_TIMEOUT: Aggregation timeout for tunnel packets. Default is 0.005.
  • MAVLINK_AGG_TIMEOUT: Aggregation timeout for mavlink packets. Default is 0.1.
  • MAVLINK_ERR_RATE: Inject RX error rate. Default is True.
  • LOG_INTERVAL: Interval for statistics reporting. Default is 1000.
  • TX_SEL_RSSI_DELTA: RSSI delta for antenna selection. Default is 3.
  • TX_SEL_COUNTER_ABS_DELTA: Packet counter delta for antenna selection. Default is 3.
  • TX_SEL_COUNTER_REL_DELTA: Relative packet counter delta for antenna selection. Default is 0.1.
  • TX_RCV_BUF_SIZE: UDP receive buffer size. Default is 2097152.
  • WIFI_CHANNEL: WiFi channel. Default is 165.
  • WIFI_REGION: WiFi region. Default is BO.
  • WIFI_TXPOWER: WiFi transmission power. Default is None.
  • TEMP_MEASUREMENT_INTERVAL: Interval for temperature measurement. Default is 10.
  • TEMP_OVERHEAT_WARNING: Overheat warning threshold. Default is 60.

SSH and Server Configuration

  • SSH_USER: Default SSH user. Default is root.
  • SSH_PORT: Default SSH port. Default is 22.
  • SSH_KEY: Path to SSH private key. Default is None.
  • CUSTOM_INIT_SCRIPT: Custom initialization script. Default is None.
  • SERVER_ADDRESS: IP address reachable from all cluster nodes. Default is None.

Cluster Configuration

For cluster configuration, you can define multiple nodes using the following environment variables:

  • NODE_COUNT: Number of nodes in the cluster.
  • NODE_<i>_IP: IP address of node i.
  • NODE_<i>_WLANS: WLAN interfaces of node i.
  • NODE_<i>_TXPOWER: Transmission power of node i.
  • NODE_<i>_SERVER_ADDRESS: Server address for node i.
  • NODE_<i>_SSH_USER: SSH user for node i.
  • NODE_<i>_SSH_PORT: SSH port for node i.
  • NODE_<i>_SSH_KEY: SSH key for node i.
  • NODE_<i>_CUSTOM_INIT_SCRIPT: Custom initialization script for node i.

Cluster configuration defaults

  • SSH_USER: Default SSH user. Default is root.
  • SSH_PORT: Default SSH port. Default is 22.
  • SSH_KEY: Path to SSH private key. Default is None.
  • CUSTOM_INIT_SCRIPT: Custom initialization script. Default is None.
  • SERVER_ADDRESS: IP address reachable from all cluster nodes. Default is None.

Replace <i> with the node number (e.g., NODE_1_IP, NODE_2_IP, etc.).

GS Stream Configuration

For GS stream configuration, you can define multiple streams using the following environment variables:

  • GS_STREAM_COUNT: Number of streams for the GS.
  • GS_STREAM_<i>_NAME: Name of stream i.
  • GS_STREAM_<i>_RX: RX stream ID for stream i.
  • GS_STREAM_<i>_TX: TX stream ID for stream i.
  • GS_STREAM_<i>_SERVICE_TYPE: Service type for stream i.
  • GS_STREAM_<i>_PROFILES: Profiles for stream i.

Replace <i> with the stream number (e.g., GS_STREAM_1_NAME, GS_STREAM_2_NAME, etc.).

Drone Configuration

  • DRONE_STATS_PORT: TCP port for drone statistics API. Default is 8002.
  • DRONE_API_PORT: TCP port for drone public JSON API. Default is 8102.
  • DRONE_LINK_DOMAIN: Link domain for drone. Default is default.

Drone Stream Configuration

For drone stream configuration, you can define multiple streams using the following environment variables:

  • DRONE_STREAM_COUNT: Number of streams for the drone.
  • DRONE_STREAM_<i>_NAME: Name of stream i.
  • DRONE_STREAM_<i>_RX: RX stream ID for stream i.
  • DRONE_STREAM_<i>_TX: TX stream ID for stream i.
  • DRONE_STREAM_<i>_SERVICE_TYPE: Service type for stream i.
  • DRONE_STREAM_<i>_PROFILES: Profiles for stream i.

Replace <i> with the stream number (e.g., DRONE_STREAM_1_NAME, DRONE_STREAM_2_NAME, etc.).

GS Configuration

  • GS_STATS_PORT: TCP port for GS statistics API. Default is 8003.
  • GS_API_PORT: TCP port for GS public JSON API. Default is 8103.
  • GS_LINK_DOMAIN: Link domain for GS. Default is default.

To run the script with custom settings, you can export the environment variables and then execute the script:

export CONF_DIR="/custom/etc"
export DEBUG="True"
export NODE_COUNT=2
export NODE_1_IP="192.168.1.1"
export NODE_1_WLANS="wlan0,wlan1"
export NODE_2_IP="192.168.1.2"
export NODE_2_WLANS="wlan2,wlan3"

./scripts/template.sh output.conf

This will generate a configuration file output.conf with the specified settings.