diff --git a/proxstar/__init__.py b/proxstar/__init__.py index 150e6be..5e76b54 100644 --- a/proxstar/__init__.py +++ b/proxstar/__init__.py @@ -15,6 +15,7 @@ from sqlalchemy.orm import sessionmaker from flask import Flask, render_template, request, redirect, session, abort, url_for import sentry_sdk from sentry_sdk.integrations.flask import FlaskIntegration +from sentry_sdk.integrations.rq import RqIntegration from sentry_sdk.integrations.sqlalchemy import SqlalchemyIntegration from proxstar.db import (Base, datetime, get_pool_cache, renew_vm_expire, set_user_usage_limits, get_template, get_templates, get_allowed_users, add_ignored_pool, delete_ignored_pool, add_allowed_user, @@ -42,11 +43,13 @@ else: app.config.from_pyfile(config) app.config['GIT_REVISION'] = subprocess.check_output( ['git', 'rev-parse', '--short', 'HEAD']).decode('utf-8').rstrip() + # Sentry setup sentry_sdk.init( dsn=app.config['SENTRY_DSN'], - integrations=[FlaskIntegration(), SqlalchemyIntegration()] + integrations=[FlaskIntegration(), RqIntegration(), SqlalchemyIntegration()] ) + with open('proxmox_ssh_key', 'w') as ssh_key_file: ssh_key_file.write(app.config['PROXMOX_SSH_KEY']) diff --git a/rqsettings.py b/rqsettings.py new file mode 100644 index 0000000..35df8d5 --- /dev/null +++ b/rqsettings.py @@ -0,0 +1,9 @@ +import os + +import sentry_sdk +from sentry_sdk.integrations.rq import RqIntegration + +sentry_sdk.init( + os.environ.get('PROXSTAR_SENTRY_DSN'), + integrations=[RqIntegration()] +) diff --git a/start_worker.sh b/start_worker.sh index b5722da..2f609f3 100755 --- a/start_worker.sh +++ b/start_worker.sh @@ -1,3 +1,3 @@ #!/bin/sh -/opt/app-root/bin/rq worker -u "$PROXSTAR_REDIS_URL" --sentry-dsn "$PROXSTAR_SENTRY_DSN" +/opt/app-root/bin/rq worker -u "$PROXSTAR_REDIS_URL" --sentry-dsn "" -c rqsettings