DockFlare v1.8.0 - Major Codebase Refactor! #80
ChrispyBacon-dev
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
DockFlare v1.8.0 - Major Codebase Refactor!
This release marks a significant internal overhaul of DockFlare's codebase, focused on enhancing modularity, maintainability, and future development. While the core functionality remains the same, the underlying structure has been substantially improved.
Key Changes & Improvements:
Major Codebase Refactoring:
app.py
has been deconstructed into a more organized, package-based structure:app/core/
: Contains distinct modules for core business logic:access_manager.py
: Manages Cloudflare Access Application interactions.cloudflare_api.py
: Centralizes all direct Cloudflare API calls.docker_handler.py
: Handles Docker event listening and container label processing.reconciler.py
: Implements state reconciliation and cleanup of expired rules.state_manager.py
: Manages application state (managed_rules
) and persistence tostate.json
.tunnel_manager.py
: Handles Cloudflare Tunnel initialization, configuration updates, andcloudflared
agent management.app/web/
: Contains Flask-specific components:routes.py
: Defines all web UI routes using Flask Blueprints.app/config.py
: Centralizes all environment variable loading and application constants.app/__init__.py
: Initializes the Flask application, logging, and global components.app/main.py
: Serves as the main entry point for running the application.Frontend JavaScript Externalized:
status_page.html
has been moved toapp/static/js/main.js
.status_page.html
is now cleaner and primarily focused on HTML structure.Build Process Refinements:
Dockerfile
updated to correctly build the application with the new directory structure, including the multi-stage frontend asset build.package.json
(forbuild:css
script) andtailwind.config.js
(forcontent
scanning) updated to align with the newapp/
subdirectory structure.docker-image.yml
) adjusted for the newDockerfile
location and build context.Bug Fixes & Stability Improvements (discovered and addressed during refactoring):
app
instance.state.json
not saving correctly due to Python's handling of module-level global variables during imports and re-initialization. Theload_state
function now correctly mutates the sharedmanaged_rules
dictionary.save_state
could hang if called by a thread that already held thestate_lock
, by changingstate_lock
to athreading.RLock()
(Re-entrant Lock).NameError
exceptions in UI route handlers by ensuring proper function calls (e.g., using module prefixes or correct imports).TypeError
in UI policy updates by ensuring all required arguments were passed togenerate_access_app_config_hash
.AttributeError
inupdate_cloudflared_container_status
related toNone.startswith()
.save_state
by avoidingcopy.deepcopy()
on entire rule objects and instead explicitly selecting fields for serialization.Enhanced Logging:
Impact for Users:
Thanks for your patience and collaboration during this extensive refactoring process!
This discussion was created from the release DockFlare v1.8.0 - Major Codebase Refactor!.
Beta Was this translation helpful? Give feedback.
All reactions