Posts: 1
Joined: Wed Feb 28, 2018 5:05 pm

Remotely updating code on multiple devices easily

Sat Mar 03, 2018 10:11 pm

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.

User avatar
Posts: 1453
Joined: Wed Jan 09, 2013 3:05 pm
Location: thailand
Contact: Website

Re: Remotely updating code on multiple devices easily

Sun Mar 04, 2018 12:58 am

you want to do it
means operate each RPI ( like via SSH putty?)
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
-c- use a alias / like in
nano .bash_aliases
alias drop='/home/pi/Dropbox-Uploader/'
-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 .
and on each RPI what needs the copy
drop download .

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

Posts: 174
Joined: Fri Feb 09, 2018 3:45 am
Location: Minneapolis, MN USA
Contact: Website Skype

Re: Remotely updating code on multiple devices easily

Sun Mar 04, 2018 4:14 pm

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.

Posts: 47
Joined: Mon Nov 06, 2017 10:53 pm
Location: NS, Canada

Re: Remotely updating code on multiple devices easily

Mon Mar 05, 2018 6:03 pm

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.

User avatar
Posts: 2
Joined: Thu Aug 24, 2017 3:43 pm
Location: UK
Contact: Website

Re: Remotely updating code on multiple devices easily

Thu Apr 12, 2018 10:18 pm

Seems that Ansible may be the way to go

Return to “Beginners”