Closed ethanjli closed 2 years ago
I've changed the backend and deployment scripts to try to run the date
command using sudo
, because it turns out that the pufferfish_backentd.service
is configured to run in systemd as the pi user rather than root.
I've also been encountering some issues with the deployment scripts which require some workarounds and should be fixed in future PRs:
deploy.sh
without lock.sh
, the pufferfish_backend
and kiosk
services don't start because they depend on tampering.service
which is only provided by running lock.sh
. It would be better if deploy.sh
provided a dummy tampering.service
which never fails (so that the other services can proceed), and then lock.sh
provided the "real" tampering.service
which actually checks file integrity.pufferfish_backend.service
is trying to have its protobuf messages be written to the filesystem at /ventserver/statestore/
, which it doesn't have file permissions for, rather than /home/pi/pufferfish-software/backend/ventserver/statestore
. Ultimately we will want to write those messages to a separate USB drive, but in the meantime I've added commits to change the working directory of the systemd service to what the backend expects (commits af1c627 - a004ce4).media-pi-LOGS.mount
systemd unit isn't working, even though I have a USB drive named "LOGS" plugged in to the RPi at boot.Observations from testing:
on my wsl windows when i tried to run this branch without zenity:
If you don't have zenity installed, the program will simply log its failure to open the dialog box but otherwise continue as normal.
it did not continue as normal and infact terminated with failure:
FileNotFoundError: [Errno 2] No such file or directory: 'zenity': 'zenity'
installing zenity on my wsl seems to have a lot of unmet dependencies, for now, I'll just use it by removing await processes.make_dialog
it did not continue as normal and infact terminated with failure:
FileNotFoundError: [Errno 2] No such file or directory: 'zenity': 'zenity'
Oops, I hadn't tested that error-handling behavior! I've fixed it and tested it on my own system now (running Ubuntu, with Zenity uninstalled).
For records-keeping:
This PR:
SystemSettingsRequest
protobuf message from the frontend.monotonic_time
(from Python'stime.monotonic()
) for any timestamps needed to for durations/timeouts/intervals in the backend. Renames mosttime
/current_time
parameters in the backend towall_time
(as in the wall-clock time which is kept by the RPi and its RTC), to make it distinct frommonotonic_time
SystemSettings
protobuf message type as the response message forSystemSettingsRequest
, which already existed (but was namedSystemSettingRequest
)ValueSpinners
)This PR also does some refactoring of the backend:
ventserver.application
andventserver.simulator
is unified into functions defined inventserver.application
.input
andoutput
methods of the filters forventserver.protocols.backend.backend
andventserver.protocols.backend.server
, and deletion ofventserver.protocols.backend.SendFilter
which doesn't seem to be useful for our backend.kill_process
intoventserver.io.trio.processes
, which is a new file for all sorts of (simple) subprocesses our backend will spawn.Things to be aware of:
better_exceptions
as a package dependency, so you will need to runpoetry install
again for anything to be able to run.ventserver.simulator
tries to use zenity to show a popup at the start of the program warning you that you're running the simulator rather than the application. If you don't see this popup, you should install zenity. If you don't have zenity installed, the program will simply log its failure to open the dialog box but otherwise continue as normal.sudo /home/pi/.poetry/bin/poetry run python3 -m ventserver.simulator
. Before this works, you'll first need to runsudo /home/pi/.poetry/bin/poetry install
.@rohanpurohit If you're able to make sure you can run everything and change the system time on your RPi, that would be helpful. Since this PR did a big rename and also some refactoring of important parts of the backend, it'd be helpful if you could also test the backend to look for any possible issues with responsiveness or timing. I will perform an end-to-end test of whether everything works with a complete RPi deployment installation and a hardware RTC (so far I've just probed the state of the system using the
timedatectl status
command and looking at the time in the frontend after doing an "Apply Changes" on the frontend's settings screen).