Closed smathermather closed 3 years ago
child_pi_setup.sh
calls provisioning/database_setup_child.sh
for this in the deployment process currently. provisioning/database_setup_child.sh
runs provisioning/dbase_child.sql
which does lots of stuff, including setting the UUID and setting the hostname and hosts file using this info:
# retrieve the child's uuid and change the hostname of child accordingly
hostname_prefix=`sudo -u postgres psql -d odm360 -t -c "SELECT (device_uuid) FROM device;"`
echo $hostname_prefix | sudo tee /etc/hostname
sudo sed -i "s/raspberrypi/$hostname_prefix/g" /etc/hosts
So to run an update, we need to:
device
tabledevice
table with a new ID/etc/hostname
and /etc/hosts
Ok, pull request to patch: https://github.com/OpenDroneMap/odm360/pull/153
Suggestion: give the child a unique id once it connects to a parent the first time. In this way we can ensure we can use ready-made images for SD cards instead of a tedious install process requiring logging into pis.
I would say this is complete with https://github.com/localdevices/odm360/blob/main/child_pi_setup_rename.sh, but we should open a separate issue for API triggering of changes to child pi.
Setting up a child pi takes a lot of time. For a 7-8 camera rig, the process might take 4-8 hours, including downloading updates. The process can be particularly slow if run on a pi0, which is the recommended platform.
Child Pi deployment scripts currently generate an identity for they pi and set that to hostname, etc.. This means that simple cloning of the SD isn't enough to speed up the above process. We need to deploy each and every time, which can be 30-60 minutes per pi. For simplicity, the generation of an ID on deployment makes sense, but we should add a script which will regenerate the pi id.