• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Automatic setup of NetPI (for production)
#1
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,
Martin.
  Reply
#2
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-Managi...ns-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-...s-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.

Thx
Armin
You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

  Reply
#3
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).

Regards,
Martin.
  Reply
#4
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.

Thx
Armin
You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Initial Setup of Control Panel with admin + admin thorws error Michi 4 2,661 January-28th-2022, 09:28 AM
Last Post: Michi
  netPI setup procedure tad 1 2,042 March-15th-2021, 05:48 AM
Last Post: Armin@netPI
  Setup trusted Docker registry on a Raspberry Pi to host netPI containers Armin@netPI 12 11,941 January-31st-2019, 06:47 PM
Last Post: Armin@netPI
  Automatic setup of the netPI PBulach 1 2,384 April-27th-2018, 11:32 AM
Last Post: Armin@netPI
  Problems with NTP setup adeeljsid 4 3,401 March-17th-2018, 06:42 AM
Last Post: Armin@netPI
  NTP setup (Network time protocol) zulliger@software-natives.ch 1 2,488 February-7th-2018, 09:05 PM
Last Post: Armin@netPI

Forum Jump:


Users browsing this thread: 1 Guest(s)