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.pyhas 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, andcloudflaredagent 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.htmlhas been moved toapp/static/js/main.js.status_page.htmlis now cleaner and primarily focused on HTML structure.Build Process Refinements:
Dockerfileupdated to correctly build the application with the new directory structure, including the multi-stage frontend asset build.package.json(forbuild:cssscript) andtailwind.config.js(forcontentscanning) updated to align with the newapp/subdirectory structure.docker-image.yml) adjusted for the newDockerfilelocation and build context.Bug Fixes & Stability Improvements (discovered and addressed during refactoring):
appinstance.state.jsonnot saving correctly due to Python's handling of module-level global variables during imports and re-initialization. Theload_statefunction now correctly mutates the sharedmanaged_rulesdictionary.save_statecould hang if called by a thread that already held thestate_lock, by changingstate_lockto athreading.RLock()(Re-entrant Lock).NameErrorexceptions in UI route handlers by ensuring proper function calls (e.g., using module prefixes or correct imports).TypeErrorin UI policy updates by ensuring all required arguments were passed togenerate_access_app_config_hash.AttributeErrorinupdate_cloudflared_container_statusrelated toNone.startswith().save_stateby 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