From c3cd48a70324699227571d40d804e43ed5258222 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Mon, 10 Jun 2024 12:00:40 +0100 Subject: [PATCH] Rename SuperWASP to STING. --- README.md | 17 ++-- dashboard.conf | 4 +- dashboard/__init__.py | 70 +++++++------- dashboard/templates/layout.html | 4 +- dashboard/templates/overview.html | 2 +- .../templates/{superwasp.html => sting.html} | 94 +++++++++---------- update-dashboard-data | 34 +++---- update-dashboard-overview | 4 +- update-dashboard-webcams | 2 +- 9 files changed, 116 insertions(+), 115 deletions(-) rename dashboard/templates/{superwasp.html => sting.html} (51%) diff --git a/README.md b/README.md index 4097377..694ad1a 100644 --- a/README.md +++ b/README.md @@ -29,14 +29,15 @@ CREATE TABLE `dashboard_sessions` ( The `dashboard_config` table is expected to contain three rows: -| `id` | `keyname` | Description | -| ---- | ------------ | -------------- | -| `1` | `SECRET_KEY` | A complex random value used for encrypting cookies and other data. This should be a string of at least 40 random characters.| -| `2` | `GITHUB_CLIENT_ID` | Part of the GitHub authentication support. This should be set to the "Client ID" listed in the "Warwick one-metre telescope" OAuth App in the organization settings on GitHub. | -| `3` | `GITHUB_CLIENT_SECRET` | Part of the GitHub authentication support. This should be set to the "Client Secret" listed in the "Warwick one-metre telescope" OAuth App in the organization settings on GitHub. | -| `4` | `WEBCAM_SUPERWASP_PASSWORD` | Webcam `root` accounnt password for toggling IR lights. | -| `5` | `WEBCAM_W1M_PASSWORD` | Webcam `root` accounnt password for toggling IR lights. | -| `6` | `WEBCAM_CLASP_PASSWORD` | Webcam `root` accounnt password for toggling IR lights. | +| `id` | `keyname` | Description | +|------|-----------------------------| -------------- | +| `1` | `SECRET_KEY` | A complex random value used for encrypting cookies and other data. This should be a string of at least 40 random characters.| +| `2` | `GITHUB_CLIENT_ID` | Part of the GitHub authentication support. This should be set to the "Client ID" listed in the "Warwick one-metre telescope" OAuth App in the organization settings on GitHub. | +| `3` | `GITHUB_CLIENT_SECRET` | Part of the GitHub authentication support. This should be set to the "Client Secret" listed in the "Warwick one-metre telescope" OAuth App in the organization settings on GitHub. | +| `4` | `WEBCAM_STING_PASSWORD` | Webcam `root` accounnt password for toggling IR lights. | +| `5` | `WEBCAM_W1M_PASSWORD` | Webcam `root` accounnt password for toggling IR lights. | +| `6` | `WEBCAM_CLASP_PASSWORD` | Webcam `root` accounnt password for toggling IR lights. | +| `7` | `WEBCAM_HALFMETRE_PASSWORD` | Webcam `root` accounnt password for toggling IR lights. | Once that is working, you can configure the dashboard and web-serving infrastructure to run at startup using: ``` diff --git a/dashboard.conf b/dashboard.conf index c086350..c258b07 100644 --- a/dashboard.conf +++ b/dashboard.conf @@ -23,7 +23,7 @@ server { proxy_pass http://10.2.6.48/axis-cgi/mjpg/video.cgi?resolution=1280x960&fps=10; } - location /video/superwasp { + location /video/sting { set $args ""; proxy_pass http://10.2.6.172/axis-cgi/mjpg/video.cgi?resolution=1280x960&fps=10; } @@ -81,7 +81,7 @@ server { proxy_set_header Connection "upgrade"; } - location /microphone/superwasp { + location /microphone/sting { proxy_pass http://10.2.6.169:9000/; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; diff --git a/dashboard/__init__.py b/dashboard/__init__.py index d36894e..c597dad 100644 --- a/dashboard/__init__.py +++ b/dashboard/__init__.py @@ -65,7 +65,7 @@ 'clip': 'ddashboard-HALFMETRE-clip.jpg', } -SUPERWASP_GENERATED_DATA = { +STING_GENERATED_DATA = { 'cam1/thumb': 'dashboard-1-thumb.jpg', 'cam1/clip': 'dashboard-1-clip.jpg', 'cam2/thumb': 'dashboard-2-thumb.jpg', @@ -251,20 +251,20 @@ def clasp_generated_data(path): abort(404) -@app.route('/superwasp/') -def superwasp_dashboard(): +@app.route('/sting/') +def sting_dashboard(): account = get_user_account() if 'satellites' not in account['permissions']: return redirect(url_for('site_overview')) - return render_template('superwasp.html', user_account=get_user_account()) + return render_template('sting.html', user_account=get_user_account()) -@app.route('/data/superwasp/') -def superwasp_generated_data(path): +@app.route('/data/sting/') +def sting_generated_data(path): account = get_user_account() - if 'satellites' in account['permissions'] and path in SUPERWASP_GENERATED_DATA: - return send_from_directory(GENERATED_DATA_DIR, SUPERWASP_GENERATED_DATA[path]) + if 'satellites' in account['permissions'] and path in STING_GENERATED_DATA: + return send_from_directory(GENERATED_DATA_DIR, STING_GENERATED_DATA[path]) abort(404) @@ -351,7 +351,7 @@ def site_overview(): SiteCamera('goto2', 'GOTO 2', authorised=authorised_goto, video=True, audio=True, light=True, infrared=True), SiteCamera('halfmetre', 'Half Metre', authorised=authorised_halfmetre, video=True, audio=True, light=True, infrared=True), SiteCamera('w1m', 'W1m', authorised=authorised_onemetre, video=True, audio=True, light=True, infrared=True), - SiteCamera('superwasp', 'SuperWASP', authorised=authorised_satellites, video=True, audio=True, light=True, infrared=True), + SiteCamera('sting', 'STING', authorised=authorised_satellites, video=True, audio=True, light=True, infrared=True), SiteCamera('clasp', 'CLASP', authorised=authorised_satellites, video=True, audio=True, light=True, infrared=True) ] @@ -363,7 +363,7 @@ def site_overview(): @app.route('/camera/') def camera_image(camera): authorised = len(get_user_account()['permissions']) > 0 - if camera in ['ext1', 'ext2', 'allsky', 'gtcsky', 'eumetsat'] or (authorised and camera in ['serverroom', 'goto1', 'goto2', 'halfmetre', 'w1m', 'superwasp', 'clasp']): + if camera in ['ext1', 'ext2', 'allsky', 'gtcsky', 'eumetsat'] or (authorised and camera in ['serverroom', 'goto1', 'goto2', 'halfmetre', 'w1m', 'sting', 'clasp']): return send_from_directory(os.path.join(GENERATED_DATA_DIR, 'cameras'), camera + '.jpg') abort(404) @@ -371,7 +371,7 @@ def camera_image(camera): @app.route('/camera//thumb') def camera_thumb(camera): authorised = len(get_user_account()['permissions']) > 0 - if camera in ['ext1', 'ext2', 'allsky', 'gtcsky', 'eumetsat'] or (authorised and camera in ['serverroom', 'goto1', 'goto2', 'halfmetre', 'w1m', 'superwasp', 'clasp']): + if camera in ['ext1', 'ext2', 'allsky', 'gtcsky', 'eumetsat'] or (authorised and camera in ['serverroom', 'goto1', 'goto2', 'halfmetre', 'w1m', 'sting', 'clasp']): return send_from_directory(os.path.join(GENERATED_DATA_DIR, 'cameras'), camera + '_thumb.jpg') abort(404) @@ -407,8 +407,8 @@ def switch_light(light, state): if light == 'goto2' and 'goto' in account['permissions']: return _toggle_leds(daemons.goto_dome2_gtecs_power, 'leds', account, state) - if light == 'superwasp' and 'satellites' in account['permissions']: - return _toggle_leds(daemons.superwasp_power, 'light', account, state) + if light == 'sting' and 'satellites' in account['permissions']: + return _toggle_leds(daemons.sting_power, 'light', account, state) if (light in ['halfmetre', 'serverroom']) and 'satellites' in account['permissions']: return _toggle_leds(daemons.halfmetre_power, 'ilight' if light == 'halfmetre' else 'clight', account, state) @@ -416,11 +416,11 @@ def switch_light(light, state): if light == 'clasp' and 'satellites' in account['permissions']: return _toggle_leds(daemons.clasp_power, 'light', account, state) - if light == 'superwaspir' and 'satellites' in account['permissions']: - return _toggle_webcam_ir('10.2.6.172', app.config['WEBCAM_SUPERWASP_PASSWORD'], state == 'on') + if light == 'stingir' and 'satellites' in account['permissions']: + return _toggle_webcam_ir('10.2.6.172', app.config['WEBCAM_STING_PASSWORD'], state == 'on') if light == 'halfmetreir' and 'satellites' in account['permissions']: - return _toggle_webcam_ir('10.2.6.118', app.config['WEBCAM_SUPERWASP_PASSWORD'], state == 'on') + return _toggle_webcam_ir('10.2.6.118', app.config['WEBCAM_HALFMETRE_PASSWORD'], state == 'on') if light == 'w1mir' and 'w1m' in account['permissions']: return _toggle_webcam_ir('10.2.6.208', app.config['WEBCAM_W1M_PASSWORD'], state == 'on') @@ -507,27 +507,27 @@ def halfmetre_log(): }) -@app.route('/data/superwasp/log') -def superwasp_log(): +@app.route('/data/sting/log') +def sting_log(): account = get_user_account() if 'satellites' not in account['permissions']: abort(404) return fetch_log_messages({ - 'powerd@superwasp': 'power', - 'lmountd@superwasp': 'mount', - 'superwasp_dome': 'dome', - 'opsd@superwasp': 'ops', - 'pipelined@superwasp': 'pipeline', - 'qhy_camd@swasp-cam1': 'cam1', - 'qhy_camd@swasp-cam2': 'cam2', - 'qhy_camd@swasp-cam3': 'cam3', - 'qhy_camd@swasp-cam4': 'cam4', - 'diskspaced@superwasp_cam1': 'disk_das1', - 'diskspaced@superwasp_cam2': 'disk_das2', - 'diskspaced@superwasp_cam3': 'disk_das3', - 'diskspaced@superwasp_cam4': 'disk_das4', - 'dehumidifierd@superwasp': 'dehumidifier', + 'powerd@sting': 'power', + 'lmountd@sting': 'mount', + 'sting_dome': 'dome', + 'opsd@sting': 'ops', + 'pipelined@sting': 'pipeline', + 'qhy_camd@sting-cam1': 'cam1', + 'qhy_camd@sting-cam2': 'cam2', + 'qhy_camd@sting-cam3': 'cam3', + 'qhy_camd@sting-cam4': 'cam4', + 'diskspaced@sting_cam1': 'disk_das1', + 'diskspaced@sting_cam2': 'disk_das2', + 'diskspaced@sting_cam3': 'disk_das3', + 'diskspaced@sting_cam4': 'disk_das4', + 'dehumidifierd@sting': 'dehumidifier', 'lensheaterd': 'lensheater' }) @@ -656,13 +656,13 @@ def goto_dashboard_data(): return response -@app.route('/data/superwasp/') -def superwasp_dashboard_data(): +@app.route('/data/sting/') +def sting_dashboard_data(): account = get_user_account() if 'satellites' not in account['permissions']: abort(404) - response = send_from_directory(GENERATED_DATA_DIR, 'superwasp.json.gz') + response = send_from_directory(GENERATED_DATA_DIR, 'sting.json.gz') response.headers['Access-Control-Allow-Origin'] = '*' response.headers['Content-Encoding'] = 'gzip' return response diff --git a/dashboard/templates/layout.html b/dashboard/templates/layout.html index 5ada7f6..965a177 100644 --- a/dashboard/templates/layout.html +++ b/dashboard/templates/layout.html @@ -3,7 +3,7 @@ ('w1m-dashboard', url_for('w1m_dashboard'), 'w1m', 'W1m'), ('halfmetre-dashboard', url_for('halfmetre_dashboard'), 'halfmetre', '0.5m'), ('clasp-dashboard', url_for('clasp_dashboard'), 'satellites', 'CLASP'), - ('superwasp-dashboard', url_for('superwasp_dashboard'), 'satellites', 'SuperWASP'), + ('sting-dashboard', url_for('sting_dashboard'), 'satellites', 'STING'), ] %} @@ -67,7 +67,7 @@ background-color: #000000 !important; } - .superwasp-thumb-panel { + .sting-thumb-panel { padding: 0 !important; height: 88px; width: 132px; diff --git a/dashboard/templates/overview.html b/dashboard/templates/overview.html index cebf6bc..ef48118 100644 --- a/dashboard/templates/overview.html +++ b/dashboard/templates/overview.html @@ -64,7 +64,7 @@
- SuperWASP + STING CLASP W1m 0.5m diff --git a/dashboard/templates/superwasp.html b/dashboard/templates/sting.html similarity index 51% rename from dashboard/templates/superwasp.html rename to dashboard/templates/sting.html index d25c345..9db87e3 100644 --- a/dashboard/templates/superwasp.html +++ b/dashboard/templates/sting.html @@ -1,39 +1,39 @@ {% extends "layout.html" %} -{% set title = 'SuperWASP » Dashboard' -%} -{% set active_page = 'superwasp-dashboard' -%} +{% set title = 'STING » Dashboard' -%} +{% set active_page = 'sting-dashboard' -%} {% set preview_cameras = ['cam1', 'cam2', 'cam3', 'cam4'] %} {% block body %}
- Environment - Int. Temp. - Int. Humidity - Dehumidifier + Environment + Int. Temp. + Int. Humidity + Dehumidifier
- UPS 1 - UPS 2 - ATS - Dome Light + UPS 1 + UPS 2 + ATS + Dome Light
- Mount - RA / Dec - Alt / Az - Sun / Moon Sep. + Mount + RA / Dec + Alt / Az + Sun / Moon Sep.
Sun Altitude - N. Shutter - S. Shutter - Heartbeat + N. Shutter + S. Shutter + Heartbeat
@@ -43,7 +43,7 @@
Action Queue -
+
@@ -51,12 +51,12 @@
- Dome Open + Dome Open
- Dome Close + Dome Close
@@ -74,43 +74,43 @@ State - - - - + + + + Exposure - - - - + + + + Cooling - - - - + + + + Temp. / RH. - - - - + + + + Lens Temp. - - - - + + + + Disk Space - - + + @@ -120,7 +120,7 @@
- +
@@ -128,8 +128,8 @@
{% for c in preview_cameras %} @@ -166,8 +166,8 @@ if ($("#thumb-" + initial_camera).length > 0) selectPreview(initial_camera); - pollDashboard('{{ url_for('superwasp_dashboard_data') }}'); - pollLog('{{ url_for('superwasp_log') }}'); + pollDashboard('{{ url_for('sting_dashboard_data') }}'); + pollLog('{{ url_for('sting_log') }}'); }); {% endblock %} diff --git a/update-dashboard-data b/update-dashboard-data index a295c5c..2eac397 100644 --- a/update-dashboard-data +++ b/update-dashboard-data @@ -209,8 +209,8 @@ def generate_onemetre_json(output_path, date, environment, status): write_output(output, output_path) -def generate_superwasp_json(output_path, date, environment, status): - """Queries daemons to generate the public data for the SuperWASP dashboard page""" +def generate_sting_json(output_path, date, environment, status): + """Queries daemons to generate the public data for the STING dashboard page""" output = {'date': date} if environment: output.update(extract_environment_data(environment, { @@ -219,25 +219,25 @@ def generate_superwasp_json(output_path, date, environment, status): 'pressure', 'median_wind_speed' ], 'rain': ['unsafe_boards'], - 'clasp_domealert': ['superwasp_temperature', 'superwasp_humidity'], - 'superwasp_diskspace_das1': ['data_fs_available_bytes'], - 'superwasp_diskspace_das2': ['data_fs_available_bytes'], + 'clasp_domealert': ['sting_temperature', 'sting_humidity'], + 'sting_diskspace_das1': ['data_fs_available_bytes'], + 'sting_diskspace_das2': ['data_fs_available_bytes'], 'tng': ['dust', 'seeing', 'solarimeter'], 'ephem': ['sun_alt', 'moon_alt', 'moon_percent_illumination'] })) output.update(extract_daemon_data([ - (daemons.superwasp_operations, 'superwasp_ops', lambda d: d.status()), - (daemons.superwasp_telescope, 'superwasp_telescope', lambda d: d.report_status()), - (daemons.superwasp_dome, 'superwasp_dome', lambda d: d.status()), - (daemons.superwasp_pipeline, 'superwasp_pipeline', lambda d: d.report_status()), - (daemons.superwasp_camvirt_das1, 'superwasp_cam_1', lambda d: d.report_camera_status('cam1')), - (daemons.superwasp_camvirt_das1, 'superwasp_cam_2', lambda d: d.report_camera_status('cam2')), - (daemons.superwasp_camvirt_das2, 'superwasp_cam_3', lambda d: d.report_camera_status('cam3')), - (daemons.superwasp_camvirt_das2, 'superwasp_cam_4', lambda d: d.report_camera_status('cam4')), - (daemons.superwasp_lensheater, 'superwasp_lensheater', lambda d: d.report_status()), - (daemons.superwasp_power, 'superwasp_power', lambda d: d.last_measurement()), - (daemons.superwasp_dehumidifier, 'superwasp_dehumidifier', lambda d: d.status()) + (daemons.sting_operations, 'sting_ops', lambda d: d.status()), + (daemons.sting_telescope, 'sting_telescope', lambda d: d.report_status()), + (daemons.sting_dome, 'sting_dome', lambda d: d.status()), + (daemons.sting_pipeline, 'sting_pipeline', lambda d: d.report_status()), + (daemons.sting_camvirt_das1, 'sting_cam_1', lambda d: d.report_camera_status('cam1')), + (daemons.sting_camvirt_das1, 'sting_cam_2', lambda d: d.report_camera_status('cam2')), + (daemons.sting_camvirt_das2, 'sting_cam_3', lambda d: d.report_camera_status('cam3')), + (daemons.sting_camvirt_das2, 'sting_cam_4', lambda d: d.report_camera_status('cam4')), + (daemons.sting_lensheater, 'sting_lensheater', lambda d: d.report_status()), + (daemons.sting_power, 'sting_power', lambda d: d.last_measurement()), + (daemons.sting_dehumidifier, 'sting_dehumidifier', lambda d: d.status()) ], status)) output.update(extract_preview_data({ @@ -339,7 +339,7 @@ def generate_data(): generate_onemetre_json('onemetre.json.gz', date, environment, status) generate_goto_json('goto.json.gz', date, environment, status) - generate_superwasp_json('superwasp.json.gz', date, environment, status) + generate_sting_json('sting.json.gz', date, environment, status) generate_clasp_json('clasp.json.gz', date, environment, status) generate_halfmetre_json('halfmetre.json.gz', date, environment, status) diff --git a/update-dashboard-overview b/update-dashboard-overview index 98dc001..e7c7943 100755 --- a/update-dashboard-overview +++ b/update-dashboard-overview @@ -24,7 +24,7 @@ import datetime import gzip import json import shutil -from warwick.observatory.common import daemons, log +from rockit.common import daemons, log BASE_OUTPUT_DIR = '/srv/dashboard/generated' STATUS_FILE = BASE_OUTPUT_DIR + '/update-dashboard-overview.json' @@ -115,7 +115,7 @@ def generate_json(output_path, date): (daemons.clasp_dome, daemons.clasp_operations, 'clasp'), (daemons.halfmetre_roof, daemons.halfmetre_operations, 'halfmetre'), (daemons.onemetre_dome, daemons.onemetre_operations, 'onemetre'), - (daemons.superwasp_dome, daemons.superwasp_operations, 'superwasp') + (daemons.sting_dome, daemons.sting_operations, 'sting') ] for dome_daemon, ops_daemon, key in rockit_telescopes: diff --git a/update-dashboard-webcams b/update-dashboard-webcams index 5426ba7..8d55352 100644 --- a/update-dashboard-webcams +++ b/update-dashboard-webcams @@ -40,7 +40,7 @@ WEBCAMS = { 'w1m': 'http://10.2.6.208/axis-cgi/jpg/image.cgi?resolution=1280x960', 'goto1': 'http://10.2.6.4/axis-cgi/jpg/image.cgi?resolution=1280x960', 'goto2': 'http://10.2.6.48/axis-cgi/jpg/image.cgi?resolution=1280x960', - 'superwasp': 'http://10.2.6.172/axis-cgi/jpg/image.cgi?resolution=1280x960', + 'sting': 'http://10.2.6.172/axis-cgi/jpg/image.cgi?resolution=1280x960', 'halfmetre': 'http://10.2.6.118/axis-cgi/jpg/image.cgi?resolution=1280x960', 'serverroom': 'http://10.2.6.119/axis-cgi/jpg/image.cgi?resolution=1280x960', 'clasp': 'http://10.2.6.193/axis-cgi/jpg/image.cgi?resolution=1280x960',