eManager Cloner Utility¶
The emanager_cloner is a tool developed by PickData that aims to clone eManager settings from one Master to n
Slave(s) eManagers (either eManager or eManager-Pro).
A clonation to one or more Slaves includes:
- Installing opkg packages.
- Copying network configuration.
- Copying
settings.js
Node-RED file. - Copying Node-RED flows.
- Copying Node-RED installation (modules & nodes).
- Copying
/data
directory. - And the directories and files that need to be cloned (custom paths).
The emanager_cloner uses a configuration file, called /etc/emanager_cloner.conf
.
Prerequisites¶
To be able to use emanager_cloner the following prerequisites must be met:
- All Master and Slave(s) must run on the same image release.
- Master configured as WiFi Access point / Hotspot (configured by default).
- Slaves Ethernet interface configured as dynamic IP address (DHCP).
- Router provinding DCHP server and internet connection with
n+1
Ethernet ports is needed. Heren
denotes the number of Slave(s). n+1
Ethernet cables will be needed.
Pro vs non Pro¶
- It's recommended that all Master and Slave(s) are the same model (either all are Pro or all are non Pro).
- No clonation will be carried out from a Pro to a non Pro.
- Clonations from Non Pro to Pro won't install opkg packages
Keep in mind¶
- Stale configuration from a not factory reset slave may produce undesired behaviour. Make sure that all slaves are factory new, for instance by carrying out a software update on each.
- The default clonation should be enough for an average Node-RED user. Users taking advantage of more specialized tools should consider using CUSTOM_PATH item located in the configuration file
/etc/emanager_cloner.conf
. - Slaves are rebooted after clonation is finished.
Modes of clonation¶
The emanager_cloner provides two modes of clonation:
1. Using credentials file (recommended)¶
In this mode no interaction with the user is required.
emanager_cloner.sh -f credentials_file.txt
where credentials_file.txt
should look like
hostname1 password1
hostname2 password2
hostname3 password3
...
Note
Passwords must not contain spaces.
Warning
For security reasons, remember to delete the credentials file after completion.
2. Interactively, typing passwords sequentially¶
In this mode every clonation starts with a user interaction where the terminal asks for the corresponding password.
emanager_cloner.sh [hostname1] [hostname2] ...
where [hostname1]
[hostname2]
denote Slave hostnames to be cloned.
Cloning process¶
Note
In this example credentials file is used.
-
Write down the hostname and password for every eManager (Master or Slave) in a credentials file:
credentials_file.txt
SlaveHostname1 password1 SlaveHostname2 password2 SlaveHostname3 password3 SlaveHostname4 password4
Note
Hostnames are usually of the form
eManager-XXXXXX
oreManager-Pro-XXXXXX
. -
Copy
credentials_file.txt
into the Master home (/home/root
). -
Connect Master and Slave eManagers to the router via Ethernet. Power them on.
-
Connect your computer to the Master WiFi Access Point.
-
Log in Master with ssh client using
MasterHostname.local
. Read the official documentation to learn about. -
Stop Node-RED service:
systemctl stop node-red
-
Now we are ready to start cloning. It might take several minutes.
emanager_cloner.sh -f /home/root/credentials_file.txt
Configuration file¶
Clonations can be customized by editting the /etc/emanager_cloner.conf
file in Master.
##############################################################
##############################################################
# emanager_cloner.conf
##############################################################
##############################################################
# Write y or n to enable/disable clonation steps.
##############################################################
# opkg installation
##############################################################
OPKG_PACKAGES=y
##############################################################
# Ethernet settings
##############################################################
ETHERNET_CONFIG=y
##############################################################
# WiFi settings
##############################################################
# If set to y, WiFi Hotspot configuration will be cloned
# (assuming that Master was configured as WiFi Hotspot for
# cloning purposes).
# If Master's Access Point is named after Master's hostname
# then Slave Access Point will named after Slave's hostname.
# I.e. master hostname won't be cloned as Access point name.
WIFI_CONFIG=n
##############################################################
# PPP service (SIM settings)
##############################################################
PPP_CONFIG=y
PPP_PIN=n # set to y for copying PIN
##############################################################
# Node-RED
##############################################################
NODERED_SETTINGS_JS=y
NODERED_FLOWS=y
NODERED_MODULES=y
##############################################################
# /data directory
##############################################################
DATA_FILE=y
##############################################################
# custom paths to clone
##############################################################
# Files and directories will be copied to the target Slave
# eManager keeping absolute paths.
# 1) Place absolute paths between double quotes.
# 2) Use parentheses to embrace multiple paths.
# Examples
# CUSTOM_PATHS="absolute/path/to/file"
# CUSTOM_PATHS=("absolute/path/to/directory 1" "/absolute/path/to/file 2")
CUSTOM_PATHS=n # edit this line
##############################################################
# reboot / poweroff
##############################################################
# if set to 'y' Slave(s) will be powered off. Otherwise they
# will be rebooted.
POWER_OFF=n
Logs¶
For every Slave, a log file clone_SLAVEHOSTNAME_TIMESTAMP.log
will be created at Master's /home/root
.
Some network considerations¶
eManager kernel images before setember 2022 use systemd-networkd for Ethernet/WiFi Network Management and Hostapd for Hotspot Management.
eManager kernel images after october 2022 use NetworkManager for Ethernet/WiFi/Hotspot Network Management. In this case, connection files
are copied from /etc/NetworkManager/system-connections
. New UUIDs are computed for the copies.