Hilscher Forum
Automatic setup of NetPI (for production) - Printable Version

+- Hilscher Forum (https://forum.hilscher.com)
+-- Forum: netPI - Ruggedized Industrial Ethernet Raspberry Pi (https://forum.hilscher.com/Forum-netPI-Ruggedized-Industrial-Ethernet-Raspberry-Pi)
+--- Forum: Software (https://forum.hilscher.com/Forum-Software)
+--- Thread: Automatic setup of NetPI (for production) (/Thread-Automatic-setup-of-NetPI-for-production)

Automatic setup of NetPI (for production) - Martin Serik - December-12th-2019

Dear forum members,

I have a question for you regarding NetPI's setup. In our company, we have setup users for NetPI’s Control Panel and Portainer. Also, we have created and configured 3 docker containers. This is the setup we want to use for production. But setting users and creating and configuring containers for every new NetPI is error prone. We would like to avoid this manual procedure.
Is there a way how to do the device setup automatically, thus eliminating possibility for errors?
One way, that we have thought about, is to create an image from NetPI’s SD card (when configured) and then to use it as a base image for new NetPIs, by recovering that image to their SD cards.

Thanks for reply,

RE: Automatic setup of NetPI (for production) - Armin@netPI - December-12th-2019

Hello Martin,

your option with the SD card copy will not work. Each image is personalized for each netPI. So an image from one netPI will not start on any other, since netPI CPU chip has a different MAC-Address and CPU serial number and the values are checked during boot times against the ones found on the image.

But there another way to do it. You have to use

a.) netPI's RestFul API from your remote application - so it is a simple https request - to do the very same handling as you do manually in your web browser like login, password, time setup, enable docker. We discusses this topic already here https://forum.hilscher.com/Thread-Managing-netPI-s-Docker-from-remote-via-RESTful-API-for-netPI-versions-1-1-4-0
b.) User the RestFul API of portainer Web-UI for docker to deploy the containers. We discussed this topic already here https://forum.hilscher.com/Thread-netPI-Docker-REST-API-for-versions-V1-1-4-0

If you want to debug the RestFul API right aways with your present netPI for a quick check then use your web-browser e.g. firefox and you can visualize all telegrams the browser is sending/receiving to/from netPI if you active the "web developer" menu item and then watch the network traffic recorded. If your remote application would now send/receive the very same telegrams you can do everything what the browser does controlled by your clicks with your application instead.


RE: Automatic setup of NetPI (for production) - Martin Serik - December-12th-2019

Hello Armin,

thank you for the answer. This indeed sounds as a viable solution for this kind of task. I will have a closer look on it.

In the meantime, I would like to share my experience with the SD card image backup/restore method. I have found out about this boot behaviour, your have pointed out, the hard way (one NetPI's BOOT and RESC partitions have been lost, thus we have non functional device).
Then I have tried a slightly different approach. I have created backup only from the third partition (partition with SYSTEM and BACKUP volumes), shrinked it a bit (so it will fit any SD card /each card differ slightly in size/) and then replaced only this third partition on new NetPI with the backup.
With this approach I've got a working NetPI with all the settings and containers set as required for production.

So we will examine both methods and choose one (I personally like your idea more, we will see).


RE: Automatic setup of NetPI (for production) - Armin@netPI - December-12th-2019

Yes Martin your version could work also, even if I have not tried it..

netPI's SD card indeed has 4 partitions. If you keep the partitions intact that are containing the key and credentials then of course you can overwrite the SYSTEM and BACKUP partition with any image you like. But this needs physical intervention oh the device to get out the SD card. My proposed version does not need this.