sam-sam98 / MIDI-Autofill

2 stars 4 forks source link

Raspberry PI distro setup and research #4

Open MasonAsh opened 3 years ago

MasonAsh commented 3 years ago

Here is a tracking issue for us to discuss the operating system setup for the raspberry pi.

We have a lot of distro choices here. Given that the Raspberry PI can run pretty much any ARM Linux distro, and our use case is very specific, we need to carefully choose how to set this up. We will want something very lightweight.

MasonAsh commented 3 years ago

Single application setup

AFAIK, the PI only needs to run one GUI app. To save resources, we should have a single application running on our PI.

Here is an interesting solution: https://raspberrypi.stackexchange.com/questions/11866/how-can-i-start-x11-only-for-a-single-application

This will make the PI not run any desktop environment, and simply run chromium in kiosk mode.

MasonAsh commented 3 years ago

As discussed in our meeting, we want to automate the process of building custom raspberry pi images. This way we can have reliable replication of our entire system configuration. With this, we will be able to test in an emulated environment so we don't all have to buy raspberry pis. We can have confidence that the emulated environment will mirror the results on actual hardware.

This seems like the perfect solution for that: https://github.com/RPi-Distro/pi-gen/

With this, we can:

  1. Take a default raspberry pi image
  2. Apply system configuration stuff (such as the .xinitrc change in the previous comment)
  3. Pull the latest version of our apps
  4. Write the results into a final image

This image can then be loaded into QEMU as an emulated environment, GUI and all.

pi-gen can be run within docker, which means it can be hooked up to CI, so every time we push configuration changes to the OS, it will pull the latest version of ours apps (which presumably will also be CI'd), and start building a new system image.

@jfochezato @sam-sam98, thoughts?

MasonAsh commented 3 years ago

I found a much better solution. Packer and packer-builder-arm can build images much faster and use less disk space. We have a much better chance of getting this working in a GitHub Action than we do with pi-gen.

jfochezato commented 3 years ago

Mason,

I think, if we can have this up and running before starting the actual development process will have a huge impact on the result, and the smoothness of the process.

This, together with the standardization of our tools and flows, would release enough bandwidth to focus purely in the problems of the project.

I’m so happy to read this! Looking forward to see it working and learn how to continuously deploy our code there.

Thanks a lot man!

-Jorge


From: MasonAsh notifications@github.com Sent: Sunday, February 21, 2021 4:50:16 PM To: sam-sam98/MIDI-Autofill MIDI-Autofill@noreply.github.com Cc: Jorge Fochezato jorge.fochezato@Knights.ucf.edu; Mention mention@noreply.github.com Subject: Re: [sam-sam98/MIDI-Autofill] Raspberry PI distro setup and research (#4)

I found a much better solution. Packer https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.packer.io%2F&data=04%7C01%7Cjorge.fochezato%40knights.ucf.edu%7C9c2b15395f734658c12808d8d6b2acef%7C5b16e18278b3412c919668342689eeb7%7C0%7C0%7C637495410176701220%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=wVa0biJcXGtJSFCjQSV7df6xVpSMZfgwW9j7SR4pfMw%3D&reserved=0 and packer-builder-armhttps://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fmkaczanowski%2Fpacker-builder-arm&data=04%7C01%7Cjorge.fochezato%40knights.ucf.edu%7C9c2b15395f734658c12808d8d6b2acef%7C5b16e18278b3412c919668342689eeb7%7C0%7C0%7C637495410176711213%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=B6eolkdVzLdEwUVkIn6dKj46%2Bi%2BSDZZc878r%2B6Fw8do%3D&reserved=0 can build images much faster and use less disk space. We have a much better chance of getting this working in a GitHub Action than we do with pi-gen.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fsam-sam98%2FMIDI-Autofill%2Fissues%2F4%23issuecomment-782933129&data=04%7C01%7Cjorge.fochezato%40knights.ucf.edu%7C9c2b15395f734658c12808d8d6b2acef%7C5b16e18278b3412c919668342689eeb7%7C0%7C0%7C637495410176711213%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=tp7yroYAV4v04vk2Z3ChTFr47s9ofYx88SdtHJQHY7g%3D&reserved=0, or unsubscribehttps://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FALDKNZTLEA2ZTQBS2JMLPEDTAF5ZRANCNFSM4X4R5AGA&data=04%7C01%7Cjorge.fochezato%40knights.ucf.edu%7C9c2b15395f734658c12808d8d6b2acef%7C5b16e18278b3412c919668342689eeb7%7C0%7C0%7C637495410176721210%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=ONMBxvESQx3IWszTXtsotI7jm%2FJGc1AJoPih2dMNtMI%3D&reserved=0.

MasonAsh commented 3 years ago

Thanks Jorge! I'm working on getting a prototype together to see if this is viable.

MasonAsh commented 3 years ago

I did a little bit of testing here. Packer and packer-builder-arm works great!

I have a demo project with packer and raspberry pi emulation. It can generate a raspbian image that can be flashed directly to an SD card and loaded onto a PI. I modify the raspbian json file provided by packer-builder-arm and add provisioners to it to setup packages, copy files, modify permissions, etc. The entire setup of the operating system can be automated very easily this way.

What doesn't work so great is the emulation. I used dockerpi to emulate a basic raspberry pi board, but the performance is atrocious. It's fine for basic ssh usage, but doesn't work so well for testing UI over VNC which was my original goal. The VNC does work, but it takes several minutes to even load a blank webpage with chromium.

Based on this, I think we should still generate images with packer, but use some dedicated hardware for testing the images. We should look into the possibility of having a PI that can be accessed over a private VPN connection for us to have a shared development environment.