I just came to the same git repo you found, looking into a ufw/docker issue, it made me think of this topic.
What exactly did you change (I mean I can see the added lines, but what does it mean?), and are these changes specifically for Discourse?
I used the default code in the repo and my UFW problem seemed to be fixed after that.
EDIT: When I use your edited code, the first moment I exec ufw reload I get the following error:
ERROR: Could not load logging rules