erondem
Posts: 23
Joined: Wed Jul 11, 2018 12:19 pm

OTA Software update of a c++ program in a RP3

Wed Jul 25, 2018 7:46 am

Hi all,

I have a running program inside my raspberry and it is running on the field. When I add a new feature to the program or need to fix a bug or change something in the software what I do is going to the near raspberry because I am not able to access its network for some reasons. Instead of doing this I want to publish some software updates of program I wrote without going to the raspberry?

Raspberry has internet access. Idea which came to my mind is, -I dont know if possibble- can Raspberry look into a git repository or some sort of server and if there is change in the version download and run new software?(Again I wont be able to ssh to the raspberry from desk)

Can someone suggest me something?

User avatar
topguy
Posts: 6527
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: OTA Software update of a c++ program in a RP3

Wed Jul 25, 2018 2:00 pm

Git is not a bad idea..
You need to install a script on the pi which "cron" ( or similar service ) will start at regular intervals.
The script does the follwing:
- Do a "git pull",
- look at resultcode or output to see if something new is sucessfully downloaded.
- delete old file, copy in new file.
- kill and restart your program.

A smoother (and less hacky) way is to create a .deb package of your application. And install your application as a systemd service.
- You can add/remove files when needed because all is in the deb-package and old files are automatically removed. ( dont need to manually delete/copy files )
- You can add scripts that automatically restarts the service after installation or the new version. ( dont need to manually restart program )
- You can even have the ( now quite short) upgrade script as part of the package.
-- But you have to learn a thing or two about deb-packages and systemd.

User avatar
B.Goode
Posts: 10356
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: OTA Software update of a c++ program in a RP3

Wed Jul 25, 2018 3:08 pm

can Raspberry look into a git repository or some sort of server and if there is change in the version download and run new software? [ ... ]

Can someone suggest me something?


Resin.IO ? https://resin.io

erondem
Posts: 23
Joined: Wed Jul 11, 2018 12:19 pm

Re: OTA Software update of a c++ program in a RP3

Wed Aug 01, 2018 6:54 am

B.Goode wrote:
can Raspberry look into a git repository or some sort of server and if there is change in the version download and run new software? [ ... ]

Can someone suggest me something?


Resin.IO ? https://resin.io

I think resin.io is not free service :/
topguy wrote: Git is not a bad idea..
You need to install a script on the pi which "cron" ( or similar service ) will start at regular intervals.
The script does the follwing:
- Do a "git pull",
- look at resultcode or output to see if something new is sucessfully downloaded.
- delete old file, copy in new file.
- kill and restart your program.

A smoother (and less hacky) way is to create a .deb package of your application. And install your application as a systemd service.
- You can add/remove files when needed because all is in the deb-package and old files are automatically removed. ( dont need to manually delete/copy files )
- You can add scripts that automatically restarts the service after installation or the new version. ( dont need to manually restart program )
- You can even have the ( now quite short) upgrade script as part of the package.
-- But you have to learn a thing or two about deb-packages and systemd.

I am totally stranger to the second way. First one looks easier to me. But first I need to do some research. Do you know any good tutorial or documentation about second suggestion?
Also I have a question about second one. Do you have any idea how am i going to change files from a far network? I think again I would need a script which will check for differences between files.


Edit: I found something called capistrano. Would it be my solution?

Return to “Advanced users”