eManager Cloner Utility
The eManager cloner is a tool 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).
- 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.
Installation
To install the cloner in your eManager you can use the following commands:
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.
where credentials_file.txt
should look like
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.
where [hostname1]
[hostname2]
denote Slave hostnames to be cloned.
Cloning process
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.txtSlaveHostname1 password1 SlaveHostname2 password2 SlaveHostname3 password3 SlaveHostname4 password4
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:
-
Now we are ready to start cloning. It might take several minutes.
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
##############################################################
# Network Global Settings
##############################################################
GLOBAL_NETWORK_CONFIG=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
##############################################################
# 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
##############################################################
# poweroff / reboot
##############################################################
# 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
.