Page 1 of 1

Remotely updating code on multiple devices easily

Posted: Sat Mar 03, 2018 10:11 pm
by Total_Insomnia
I would like to start using some Raspberry Pis for some remote sensor monitoring stuff I am doing at work. The problem is I would want to be able to remotely update code on multiple devices at once.

It's not inconceivable for me to have 30+ Pi's deployed at a given time and if every time I needed to update code (which is unfortunately pretty regularly) I would have to do it individually for each Pi it would quickly grow to be a pain.

Any ideas on how I could do this automatically?

I'm thinking worst case scenario I could put the code in a cloud file storage place (preferably with an API) then have the Pi periodically check for updated code but that seems kinda sloppy.

Any ideas are much appreciated.

Re: Remotely updating code on multiple devices easily

Posted: Sun Mar 04, 2018 12:58 am
by KLL
you want to do it
remotely?
means operate each RPI ( like via SSH putty?)
or
automatically?
anyhow you have the problem that there is a OLD CODE RUNNING!
requires to stop that process / overwrite code / restart ( with new ) program.

you could change the autostart of the program at boot
to first check/get new version from cloud ( like dropbox...)
but that still would require that you need to spawn remotely a reboot
_____________________________________________________
short dropbox info:
-a- setup account and get token
-b- install uploader
git clone https://github.com/andreafabrizi/Dropbox-Uploader.git
-c- use a alias / like in
nano .bash_aliases
alias drop='/home/pi/Dropbox-Uploader/dropbox_uploader.sh'
-d- at first call of
drop must give that long token: aodsifgjn;qoivaweFV[...
then can use ( from the RPI where you developed the new code )
drop upload MYPROG.py .
and on each RPI what needs the copy
drop download MYPROG.py .

test if the file overwrite is working, even while the old version still is running?in use by python?

Re: Remotely updating code on multiple devices easily

Posted: Sun Mar 04, 2018 4:14 pm
by droleary
What you want is known as configuration management. There are many solutions available, which generally break down into the choice of pushing or pulling. I usually want as little extra software running on the RPi as possible (especially if I deploy the less powerful 0W), so I tend to go with Ansible and push out changes.

Re: Remotely updating code on multiple devices easily

Posted: Mon Mar 05, 2018 6:03 pm
by PingoBags
You could always create an app to automatically handle it via ssh.
Store all the pi user/pass and ip's in a text file.
Loop through them all to upload and run the new scripts if needed.

I do something similar from my win pc.

Re: Remotely updating code on multiple devices easily

Posted: Thu Apr 12, 2018 10:18 pm
by dr_genestealer
Seems that Ansible may be the way to go
viewtopic.php?t=208519