Skip to content
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

New BrewPi-Script Daemon, Eliminate Circus, and Refactor Backups #724

Merged
merged 84 commits into from
Jun 23, 2023
Merged

Conversation

thorrak
Copy link
Owner

@thorrak thorrak commented Jun 18, 2023

This PR introduces a number of substantial changes from the previous release of Fermentrack.

Major Changes

BrewPi-Script Manager Rewrite

Since the early days of Fermentrack, Circus has been used to launch & manage individual instances of brewpi-script for each individual BrewPi Device. Unfortunately, Circus imposes a number of upstream dependencies that make keeping Fermentrack up-to-date an extremely onerous task. This PR replaces Circus with a custom BrewPi-Script management daemon.

Backup/Restore Refactor

The original implementation of backup/restore relied on an internal Django management command to read the database and write out database object descriptions to a JSON file. Although this works in theory, in practice this means that the backup is fairly dumb given that it is not aware of the nuance of Fermentrack's object relationships.

This PR replaces the use of the internal Django management command with new logic that generates a "smart" backup, which includes a Fermentrack-generated (rather than database-driven) representation of Fermentrack objects in JSON.

Changes from the previous logic when using newly-generated backups

  • Backup/restore no longer requires a fresh installation of Fermentrack for restoration to work
  • Backup/restore will no longer restore user accounts
  • Restoring controllers will no longer restart logging if they were logging when the backup was generated
  • Restoring controllers will no longer trigger a temperature profile to be applied if one was applied when the backup was generated

UUIDs

As part of the backup/restore refactoring, I have added UUIDs to every object that is likely to be exported. These UUIDs allow Fermentrack to recognize when an object in a backup file already exists in the Fermentrack database, and will update that object (rather than attempting to install a second instance).

New Upgrade Workflow

Unfortunately, Docker resets containers to their "downloaded" state which means that the previous upgrade workflow no longer functions as intended. The ability to "upgrade from GitHub" has now been removed in favor of providing instructions on how to re-run the install script which pulls the latest image from Docker Hub.

TiltBridge Jr (New Tilt Bluetooth support)

The existing Tilt Bluetooth daemon has been removed in favor of a new, standalone bluetooth daemon called "TiltBridge Jr." This should hopefully allow for Tilt support to be upgraded/improved independently from Fermentrack while simultaneously providing a better experience.

Full Changelog (so far)

Added

  • BrewPi-Script instances are now controlled via a custom process manager
  • Officially added arm64v8 to supported platforms
  • Added support for new versions of the BrewPi Firmware for certain ESP-based BrewPi Controllers
  • Added support for extended settings on new BrewPi Firmware for certain ESP-based BrewPi Controllers
  • Added board types for ESP32, ESP32-C3, and ESP32-S2
  • Added examples for HTTPS support (Thanks @HuggableShark)
  • Added UUIDs to most exportable objects to allow for easier import/export
  • Added "TiltBridge Jr." (new Tilt bluetooth daemon) support

Changed

  • Removed Circus support in favor of managing processes via Supervisord
  • Removed libzmq requirement
  • Removed environment tests for Tilt hydrometers (Obviated via Docker)
  • Switch to use latest LTS version of Django
  • Update to Python 3.9
  • Changed most references to ESP8266 to reference ESP32 as appropriate
  • Rewrote backup & restore functions to no longer rely on Django management code
  • Changed restoration of legacy backups to explicitly utilize the staging folder
  • Removed GitHub upgrade workflow from UI

Removed

  • Removed Fermentrack-specific Bluetooth daemon - now handled by TiltBridge Jr.

thorrak and others added 30 commits March 20, 2022 13:48
Includes support for Inkbird bluetooth temp sensors, Tilt temp sensors, and TPLink Kasa wireless switches
* Switch from Chaussette to Gunicorn
* Add uvicorn to requirements
* Update start script and add asgi.py
* Add websocket.py
* Update nginx.conf
* Tweak AlmostJsonWrapper
* Switch to supervisord
* Switch to FileHandler
* Fix permissions & test build caching
* Cache builds to GH packages
* Move Huey and Tilt to supervisord
* Add backup functionality
* Convert from standard BrewPi-Script to Multiprocessing daemon
* Add brewpi_script_monitor to supervisord
* Eliminate circus almost everywhere
* Remove non-docker item in upgrade script
* Change supervisor restart, prevent upgrades via lockfile
These are no longer necessary, as Docker ensures the packages are available.
@cdnninja
Copy link

After install of this my tilt reconnected but the brewpi Arduino isn't connected.

Traceback (most recent call last): File "/usr/local/lib/python3.9/runpy.py", line 197, in _run_module_as_main return _run_code(code, main_globals, None, File "/usr/local/lib/python3.9/runpy.py", line 87, in _run_code exec(code, run_globals) File "/app/brewpi-script/brewpi.py", line 31, in <module> from scriptlibs.brewpiScriptConfig import BrewPiScriptConfig ModuleNotFoundError: No module named 'scriptlibs'

image

@thorrak
Copy link
Owner Author

thorrak commented Jun 18, 2023

You switched to the testing (or docker-dev) images? Did you upgrade by using the install.sh script or by clicking the button inside Fermentrack?

@cdnninja
Copy link

I used the update within the app. I will update via docker and report back.

This was referenced Jun 20, 2023
@thorrak thorrak merged commit 93ecdba into master Jun 23, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment