-
-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added support for TP4 in Docker #626
Conversation
There is a breaking change here for previous versions which is due to needing to move the database to /TerrariumPI/data
Hi, thanks for the update. Nice work. I have a found a list of 'issues' and feedback for this. And I do not know what is possible. But i think you also need to 'patch' the calendar. As I create an *.ics file. https://github.com/theyosh/TerrariumPI/blob/4.x.y.z/terrariumCalendar.py#L13 and custom logging: https://github.com/theyosh/TerrariumPI/blob/4.x.y.z/terrariumLogging.py#L83 I would put the calendar at the 'data' volume and the custom logging config file in the And I expect Bluetooth not to be working which we do need. https://github.com/theyosh/TerrariumPI/blob/4.x.y.z/install.sh#L282 here I set some special rights to a certain file so a normal user can run it. Else I need root rights to use Bluetooth. And how about the following install lines: And how is the correct timezone configured? Is that depending on the host or can the container run in its own timezone? Here https://github.com/theyosh/TerrariumPI/blob/4.x.y.z/install.sh#L74 I force the user to select the correct timezone so that I can convert date and time to the correct timezone of the user. I do miss the application And I see you are using a build stage. So is it possible to add this: https://theyosh.github.io/TerrariumPI/hardware/relay/energenie-usb/#outdated-software The package And there are some people using: https://github.com/theyosh/TerrariumPI/tree/4.x.y.z/3rdparty/DenkoviRelayCommandLineTool But I guess just adding a volume is not enough. Because a volume cannot have this readme inside it during install. It needs to be clean the first time you add/create a volume? Or is there a trick.... Then I have a special setup for logging. As it does lot of writing. I write it to memory, and once a day it will be rotated at disk. This way, I have reduced the writing on the SD a lot. https://github.com/theyosh/TerrariumPI/blob/4.x.y.z/install.sh#L312-L318 And I got some feedback that Raspian Bullseye is not working. So Buster does work. And I do not know if it will work with Docker if the host is Bullseye.#622 and #623 So I hope this is not scaring you. You have done a lot, but there are still some 'issues' left. And I can update my installer to move some existing files like the database and calendar file. That way, the file structure is the same for Docker and native/direct. And again, thanks for you time for testing and trying to make this work |
Hi, this feedback is great, it's nice to have someone that can provide this kind of information so thank you. As there is quite a lot to work through I have tried to convert each item you listed to an issue and added them to the checklist above. I created the issues on my PR fork (https://github.com/alec-pinson/TerrariumPI/issues) so we can get them all (hopefully) resolved prior to full PR review. I have commented on each one if you have time to check them that would be great! Thanks for your time also :) |
So I am trying to build the docker image on my Pi. Just to see how it works, and first thing I have, is that my docker is to old. It does not understand the argument Something for the documentation of this? So, I can make some changes, and make PRs on your version per issue. I am not sure what is the most used way for this. |
For me the build instruction
Im an running ubuntu focal (20.04). So, how does that cross building work? |
If you're building on an actual Pi you should need to specify the |
Hmm I think this error normally relates to trying to run an application on the wrong architecture. I'd never built cross-architecture images before but this was the example I used: https://www.docker.com/blog/multi-arch-images/ |
Added new mounts, timezone option and removed unnecessary packages
Another question about this. Why is my image 1.16GB? Sounds a bit big....
|
Ahh right docker compresses the images, that will be the size of the image once unpacked. |
By the way if you ever need to full clear docker cache this command is very useful
I think buildx has its own aswell maybe something like
This will remove cached image layers and make build times slower for future but still useful to know if you're struggling for space. |
compiled and copied sispmctl 4.9 to image
Fix webcam motion detection for Docker usage.
attempted 2 fixes for logging + pi camera
update calendar.ics location to data dir
patch custom log location, move to log/
@theyosh if you can test this image I can create a PR afterwards for any missing documentation. |
Just spotted the watchdog/healthcheck issue, added that to the list. |
Maybe a bit late, but I have managed to check which OS packages are needed. I did not test your version, because I build my own yesterday. And this is working for me. during build stage:
during image make stage:
|
I am now building a new image for testing the healthcheck |
Added a new line to the Dockerfile: |
So, I think we can merge this. If you could add the line above to your Dockerfile, and update with my 4.x.y.z branch, then this PR can be merged. I made some updates in the documentation folder. |
…nto 4.x.y.z-docker
No problem, just synced everything, and I am now building a complete new image (cleared build cache). But I think you should get the credits for this, so that is why I asked. |
I think this should now be ready? I'm currently building a local version to test also |
If you are testing a version, just try to attach it with a bash shell :) Should be nice... And yes, I think we are there. I did found something that could help the health check, but I will fix that after the merge. It is not that big of a issue. |
I've just come back and this bit is failing not sure why yet but I've gotta go out again now, will try figure it out later. |
Before merge, have you setup |
Those have been setup for a week now :) I think, I will merge this tonight, as I am currently at work. |
…imeout. So timeout needs 60 seconds more then the startup timeout
TLDR @ BOTTOM
Related Issue
[FEATURE]: Docker Image - #620
Information
Allows TP4 to run within a Docker container, this gives many benefits:
Checklist
BREAKING CHANGE NOTICE
There is some breaking changes here for previous versions which is due to needing to move the database/calendar/logging from
/TerrariumPI/terrariumpi.db
to/TerrariumPI/data/terrariumpi.db
/TerrariumPI/calendar.ics
to/TerrariumPI/data/calendar.ics
/TerrariumPI/logging.custom.cfg
to/TerrariumPI/log/logging.custom.cfg
Notes
I have successfully tested with a SHT3x humidity/temperature sensor (this is all I have at the moment)
If anyone would like to test the image I have temporarily pushed it to Dockerhub. Alternatively you can build the image yourself from this branch (see below). You will need Docker and Docker-compose installed. Instructions can be found here (not yet tested) - https://www.upswift.io/post/install-docker-compose-on-raspberry-pi for this.
Once installed you will need to copy the below to a file named
docker-compose.yaml
Then run the below to start in
detached
mode:Useful commands
You can view the running container with:
You can stop the running container with:
You can view/tail the logs with:
There are some extra options you can provide see below example.
Docker Environment Options
/boot/config.txt
and/etc/modules
to enable the i2c interface (requires reboot if not already enabled). If set to false will not make any changes to/boot/config.txt
or/etc/modules
./boot/config.txt
to enable the 1 wire interface (requires reboot if not already enabled). If set to false will not make any changes to/boot/config.txt
./boot/config.txt
to enable the camera support (requires reboot if not already enabled). If set to false will not make any changes to/boot/config.txt
./boot/config.txt
to enable the serial interface (requires reboot if not already enabled). If set to false will not make any changes to/boot/config.txt
./boot/cmdline.txt
to enable support for CO2 sensors (requires reboot if not already enabled). If set to false will not make any changes to/boot/cmdline.txt
.How to pass environment options:
Docker Build
Build time: 1 hour depending on the speed of your machine, once main layers are cached this time reduces to a minute or so
Build command: Build for Raspberry Pi architecture only
Size: 475MB
TLDR;
docker-compose.yaml
with contents:docker-compose up