From 71d33bf7ec9b2b7a79fb1595e3e32bf2402101db Mon Sep 17 00:00:00 2001 From: Galen G Date: Sun, 3 Nov 2019 23:14:52 -0500 Subject: [PATCH 1/8] Add sentry with integrations (#32) * Add sentry with integrations * Remove raven references from python code --- config.py | 4 ++++ proxstar/__init__.py | 9 ++++++++- requirements.txt | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/config.py b/config.py index 7bead6d..d731604 100644 --- a/config.py +++ b/config.py @@ -60,3 +60,7 @@ WEBSOCKIFY_PATH = environ.get('PROXSTAR_WEBSOCKIFY_PATH', '/opt/app-root/bin/websockify') WEBSOCKIFY_TARGET_FILE = environ.get('PROXSTAR_WEBSOCKIFY_TARGET_FILE', '/opt/app-root/src/targets') + +# SENTRY +# Do not set the DSN for local development +SENTRY_DSN = environ.get("CONDITIONAL_SENTRY_DSN", "") \ No newline at end of file diff --git a/proxstar/__init__.py b/proxstar/__init__.py index a08da08..150e6be 100644 --- a/proxstar/__init__.py +++ b/proxstar/__init__.py @@ -13,6 +13,9 @@ from rq_scheduler import Scheduler from sqlalchemy import create_engine 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.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, delete_allowed_user, @@ -39,7 +42,11 @@ 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()] +) with open('proxmox_ssh_key', 'w') as ssh_key_file: ssh_key_file.write(app.config['PROXMOX_SSH_KEY']) diff --git a/requirements.txt b/requirements.txt index 677962f..6bf3af7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -19,3 +19,4 @@ tenacity==5.0.2 websockify==0.8.0 pylint==2.3.1 pylint-quotes==0.2.1 +sentry-sdk~=0.13.1 From 4b0f80505236277b7b72a45e1a2f25e3d29ec71c Mon Sep 17 00:00:00 2001 From: Devin Matte Date: Sun, 3 Nov 2019 23:20:33 -0500 Subject: [PATCH 2/8] Revert "Add sentry with integrations (#32)" (#33) This reverts commit 71d33bf7ec9b2b7a79fb1595e3e32bf2402101db. --- config.py | 4 ---- proxstar/__init__.py | 9 +-------- requirements.txt | 1 - 3 files changed, 1 insertion(+), 13 deletions(-) diff --git a/config.py b/config.py index d731604..7bead6d 100644 --- a/config.py +++ b/config.py @@ -60,7 +60,3 @@ WEBSOCKIFY_PATH = environ.get('PROXSTAR_WEBSOCKIFY_PATH', '/opt/app-root/bin/websockify') WEBSOCKIFY_TARGET_FILE = environ.get('PROXSTAR_WEBSOCKIFY_TARGET_FILE', '/opt/app-root/src/targets') - -# SENTRY -# Do not set the DSN for local development -SENTRY_DSN = environ.get("CONDITIONAL_SENTRY_DSN", "") \ No newline at end of file diff --git a/proxstar/__init__.py b/proxstar/__init__.py index 150e6be..a08da08 100644 --- a/proxstar/__init__.py +++ b/proxstar/__init__.py @@ -13,9 +13,6 @@ from rq_scheduler import Scheduler from sqlalchemy import create_engine 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.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, delete_allowed_user, @@ -42,11 +39,7 @@ 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()] -) + with open('proxmox_ssh_key', 'w') as ssh_key_file: ssh_key_file.write(app.config['PROXMOX_SSH_KEY']) diff --git a/requirements.txt b/requirements.txt index 6bf3af7..677962f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -19,4 +19,3 @@ tenacity==5.0.2 websockify==0.8.0 pylint==2.3.1 pylint-quotes==0.2.1 -sentry-sdk~=0.13.1 From dba7d0341c9734c4c66f44693c2a22cd65fc8424 Mon Sep 17 00:00:00 2001 From: Galen Guyer Date: Wed, 15 Jan 2020 20:00:39 -0500 Subject: [PATCH 3/8] Increase template delay and don't fail deleting VM if starrs doesn't have a record --- proxstar/tasks.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/proxstar/tasks.py b/proxstar/tasks.py index 92e5ef5..4130f5f 100644 --- a/proxstar/tasks.py +++ b/proxstar/tasks.py @@ -95,7 +95,12 @@ def delete_vm_task(vmid): starrs = connect_starrs() vm = VM(vmid) # do this before deleting the VM since it is hard to reconcile later - delete_starrs(starrs, vm.name) + retry = 0 + while retry < 3: + try: + delete_starrs(starrs, vm.name) + except: + continue if vm.status != 'stopped': vm.stop() retry = 0 @@ -167,7 +172,7 @@ def setup_template_task(template_id, name, user, ssh_key, cores, memory): while retry < timeout: if not VM(vmid).is_provisioned(): retry += 1 - time.sleep(3) + time.sleep(6) continue break if retry == timeout: From 865200cbec3ffde4ac6c655f2868fcc1a902e018 Mon Sep 17 00:00:00 2001 From: Galen Guyer Date: Wed, 15 Jan 2020 22:24:31 -0500 Subject: [PATCH 4/8] Increase timeout and fix infinite loop if starrs delete fails --- proxstar/tasks.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/proxstar/tasks.py b/proxstar/tasks.py index 4130f5f..84af3cb 100644 --- a/proxstar/tasks.py +++ b/proxstar/tasks.py @@ -99,7 +99,10 @@ def delete_vm_task(vmid): while retry < 3: try: delete_starrs(starrs, vm.name) + break except: + retry += 1 + time.sleep(3) continue if vm.status != 'stopped': vm.stop() @@ -167,12 +170,12 @@ def setup_template_task(template_id, name, user, ssh_key, cores, memory): logging.info( '[{}] Waiting until Proxmox is done provisioning.'.format(name)) set_job_status(job, 'waiting for Proxmox') - timeout = 20 + timeout = 25 retry = 0 while retry < timeout: if not VM(vmid).is_provisioned(): retry += 1 - time.sleep(6) + time.sleep(12) continue break if retry == timeout: From 79665e4be7a9309fa9fbe6dbc38cc6f107580274 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 12 Mar 2020 17:21:09 +0000 Subject: [PATCH 5/8] Bump psutil from 5.4.7 to 5.6.6 Bumps [psutil](https://github.com/giampaolo/psutil) from 5.4.7 to 5.6.6. - [Release notes](https://github.com/giampaolo/psutil/releases) - [Changelog](https://github.com/giampaolo/psutil/blob/master/HISTORY.rst) - [Commits](https://github.com/giampaolo/psutil/compare/release-5.4.7...release-5.6.6) Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 677962f..dfa4d45 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,7 +4,7 @@ flask-pyoidc==1.3.0 gunicorn==19.9.0 paramiko==2.4.2 proxmoxer==1.0.3 -psutil==5.4.7 +psutil==5.6.6 psycopg2-binary==2.7.5 python-dateutil==2.7.3 raven~=6.10.0 From bac2a078b22ebd676e74412306340cb3c3148b68 Mon Sep 17 00:00:00 2001 From: Dr-N0 Date: Tue, 28 Apr 2020 15:36:48 -0400 Subject: [PATCH 6/8] Updated README --- README.md | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index aacc663..76a4976 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,25 @@ -# proxstar +Proxstar +=========== + +Proxstar is a proxmox VM web management tool used by [Rochester Institute of Technology](https://rit.edu/)'s [Computer Science House](https://csh.rit.edu). + +## Overview + +Written using [Python](http://nodejs.org), [Flask](https://npmjs.com). + +Proxstar removes the need for CSH members to have direct access to the proxmox web interface. -Proxstar is a proxmox VM web management tool used by [Computer Science House](https://csh.rit.edu). -
-Written in Python Flask, proxstar removes the need for CSH members to have direct access to the proxmox web -interface. -
Proxstar is also used to enforce proxmox resource limits automagically. -
-Available to house members at proxstar.csh.rit.edu behind PYOIDC authentication. + +It is available to house members at [proxstar.csh.rit.edu](https://proxstar.csh.rit.edu) behind PYOIDC authentication. + +## Contributing + +1. [Fork](https://help.github.com/en/articles/fork-a-repo) this repository + - Optionally create a new [git branch](https://git-scm.com/book/en/v2/Git-Branching-Branches-in-a-Nutshell) if your change is more than a small tweak (`git checkout -b BRANCH-NAME-HERE`) +3. Make your changes locally, commit, and push to your fork +4. Create a [Pull Request](https://help.github.com/en/articles/about-pull-requests) on this repo for our Webmasters to review + +## Questions/Concerns + +Please file an [Issue](https://github.com/ComputerScienceHouse/proxstar/issues/new) on this repository. \ No newline at end of file From da5efbe1612b3c1c57f379c20d7241d1e49bae37 Mon Sep 17 00:00:00 2001 From: Dr-N0 Date: Tue, 28 Apr 2020 16:45:59 -0400 Subject: [PATCH 7/8] SQL Alchemy Version 1.3 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index dfa4d45..c8e7bf1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -13,7 +13,7 @@ requests==2.20.1 rq==0.12.0 rq-dashboard==0.4.0 rq-scheduler==0.8.3 -sqlalchemy==1.2.12 +sqlalchemy==1.3 sshtunnel==0.1.4 tenacity==5.0.2 websockify==0.8.0 From f7bd44861191a9144b67705c60f1933297eee329 Mon Sep 17 00:00:00 2001 From: Max Meinhold Date: Fri, 18 Sep 2020 10:55:45 -0400 Subject: [PATCH 8/8] Set default creation pool to current user RTPs get to create vms in any pool, and the default in the user creation list is not the current user, but the first pool returned (in practice, alphabetically). Setting 'selected' on the option should remove this small inconvenience. --- proxstar/templates/create.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proxstar/templates/create.html b/proxstar/templates/create.html index db68f6c..33973c4 100644 --- a/proxstar/templates/create.html +++ b/proxstar/templates/create.html @@ -72,7 +72,7 @@