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

Added flask-monitoringdashboard app #438

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ hasjob/static/gen
*.gz
*.bz2
hasjob/assets/node_modules
admindash-config.cfg
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Config should be stored in the instance folder.

flask_monitoringdashboard.db
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't use SQLite in production as there are multiple worker processes competing for control over this file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By default it uses sqlite and creates this file. I moved it to postgres.

5 changes: 5 additions & 0 deletions admindash-config-sample.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[dashboard]
USERNAME=username
PASSWORD=password
CUSTOM_LINK=monitor
GIT=./.git/
14 changes: 14 additions & 0 deletions hasjob/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from flask_rq import RQ
from flask_mail import Mail
from flask_redis import FlaskRedis
import flask_monitoringdashboard as dashboard
from flask_lastuser import Lastuser
from flask_lastuser.sqlalchemy import UserManager
from baseframe import baseframe, assets, Version
Expand Down Expand Up @@ -59,3 +60,16 @@
redis_store.init_app(app)
lastuser.init_app(app)
lastuser.init_usermanager(UserManager(db, models.User))


def get_user_id():
from coaster.auth import current_auth
if current_auth.user is not None:
return current_auth.user.username
else:
return 'anon'


dashboard.config.get_group_by = get_user_id
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Group by event session, not user.

dashboard.config.init_from(file='admindash-config.cfg')
dashboard.bind(app)
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ git+https://github.com/hasgeek/flask-lastuser
git+https://github.com/hasgeek/baseframe
Flask-Migrate
progressbar2
flask_monitoringdashboard