delfick / photons

Python3.6+ asyncio framework for interacting with LIFX devices
https://photons.delfick.com
MIT License
73 stars 6 forks source link

Make a interactor image for raspberry pi. #33

Closed Final-Hawk closed 3 years ago

Final-Hawk commented 3 years ago

Hi,

Wanted to get your opinion on this and I am quite happy to make this in my repository and just simply link it here. I was thinking (mainly from This comment on reddit) that we could make an img file for easy photons installation on a raspberry pi zero. The install would consist of the photons interactor on docker so you can control the effects from your phone. (like this post) What do you think? and should i do it? I was mainly targeting towards use on a raspberry pi zero because its small and cheap and can just be plugged in and left.

delfick commented 3 years ago

If you want to make the infrastructure that can generate a new image at the press of a button and where to host it, then go for it!

Last time I looked at making an rPi image it looked a little annoying.

Final-Hawk commented 3 years ago

Yea i think it will be a pain in the ass but i will see what i can do

delfick commented 3 years ago

:)

Djelibeybi commented 3 years ago

It's actually not that difficult at all. Pi-gen is used to create the ~Raspian~ Raspberry Pi OS images, so you can use that to create a custom Photons image based on Raspian.

Final-Hawk commented 3 years ago

Yea, I was thinking about installing everything on a small sd card and making that an image. I have created a simple batch script as well to simplify adding the Pi to the wifi. Just waiting for a rpi zero to come so I can test. But it's all really just help make photons more available to not so tech savvy people

delfick commented 3 years ago

speaking from experience, you don't want a manual process.

Also you need to make sure the image you burn is for a small partition so you can burn it onto small SD cards (I.e. if you burn a 32GB partition, you can't put that image on a 16GB SD card). Note that you can put a special file on it and raspian will expand the partition on boot to the whole SD card.

That (and using xerofree) makes the image smaller to download and burn too.

Either way, you don't want an obligation to manually do stuff with SD cards with each release :)

On Tue, 29 Dec 2020, 7:35 pm Joshua, notifications@github.com wrote:

Yea, I was thinking about installing everything on a small sd card and making that an image. I have created a simple batch script as well to simplify adding the Pi to the wifi. Just waiting for a rpi zero to come so I can test. But all to really just help make photons more available to not so tech savvy people

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/delfick/photons/issues/33#issuecomment-751995814, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA2V5IFVTQVCK42Y3JKLYLSXGIGBANCNFSM4VMUF4IA .

delfick commented 3 years ago

I think the more appropriate thing to spend effort on (and unfortunately I don't personally really have the spare cycles to do this) is create a deb that installs photons without docker.

So essentially bundle a virtualenv with everything installed on it and a systemd script.

Also makes it easy to add to an existing rPi if you want more than just photons on it. Also, docker is kinda unnecessary here :)

Final-Hawk commented 3 years ago

Ah ok, I will have a look into that as I don't know how to do that. I'll do a google and see what I can do. My main aim was to just create a image, as you already have instructions on how to install it manually. But I will also have a look into that. Even if I just make a simple shell script to run all the install commands in one click.

delfick commented 3 years ago

Having as a deb also makes uninstallation and upgrading trivial, whereas having random bash scripts acting as pseudo package managers become a bit more difficult for that :)

Also, from a security perspective, it's a lot easier for someone to inspect a deb rather than inspecting a multiple GB large .img

Djelibeybi commented 3 years ago

FPM can create debs and RPMs from Python modules: https://fpm.readthedocs.io/en/latest/

delfick commented 3 years ago

and have a systemd script like

[Unit]
Description=The Photons interactor
After=network.target
Before=graphical.target

[Service]
ExecStart=/opt/photons/interactor/bin/lifx lan:interactor
WorkingDirectory=$HOME/.photons/interactor
Environment=LIFX_CONFIG=$HOME/.photons/interactor/lifx.yml
KillMode=process
Restart=on-failure

[Install]
WantedBy=multi-user.target
Final-Hawk commented 3 years ago

Alright cool, thanks @Djelibeybi for the FPM suggestion, and thanks @delfick for doing up the systemd service. I'll have a look into fpm and see what I can do.

Djelibeybi commented 3 years ago

https://github.com/spotify/dh-virtualenv may also be an option.

Djelibeybi commented 3 years ago

@delfick this should probably be moved to a discussion, considering you have those enabled now. 😄

Final-Hawk commented 3 years ago

If you wanted me to close this issue since it's being worked on I can do that. But I do agree that a discussion might be good so I can notify when it's done and we can talk about how it's going. Most of it's on my repository, just waiting for a spare raspberry Pi zero to come in the mail so I can insure it works before posting the image itself

Djelibeybi commented 3 years ago

@Final-Hawk exactly! A discussion would be good so we can continue to collaborate on packaging efforts. Motivated by this thread, I've started noodling with creating RPMs for Photons, so it would be good to share tips and tricks, etc.

delfick commented 3 years ago

oohh, let's try a discussion, I'm interested to see what that feature is actually like :)

Djelibeybi commented 3 years ago

Started the discussion over at #36

Final-Hawk commented 3 years ago

closed