diff --git a/.github/workflows/automated-testing.yml b/.github/workflows/automated-testing.yml index a193bdca9..769740d4e 100644 --- a/.github/workflows/automated-testing.yml +++ b/.github/workflows/automated-testing.yml @@ -1,4 +1,4 @@ -name: automated_testing +name: Automated Testing env: AWS_REGION: eu-west-2 permissions: @@ -7,10 +7,10 @@ permissions: on: push: - branches: [ dev, markmac99 ] + branches: [dev, markmac99] pull_request: # The branches below must be a subset of the branches above - branches: [ master ] + branches: [dev, markmac99] jobs: conttests: runs-on: thelinux @@ -20,7 +20,7 @@ jobs: username: ${{ secrets.DH_LOGIN_MM }} password: ${{ secrets.DH_PATT_MM }} env: - BRANCH: ${{ github.head_ref || github.ref_name }} + BRANCH: ${{ github.head_ref || github.ref_name }} volumes: - testdata:/data steps: @@ -32,7 +32,6 @@ jobs: aws-region: ${{ env.AWS_REGION }} - name: remote tests run: | - chmod +x /tests.sh if [ ! -f /data/admin/cameraLocs.json ] ; then echo "getting test data" curl https://archive.ukmeteors.co.uk/browse/testdata/testdata.tar.gz -o /data/testdata.tar.gz @@ -40,13 +39,24 @@ jobs: else echo "test data available" fi - mkdir -p ~/.aws - cp /data/profile/credentials ~/.aws/ - /tests.sh + aws sts get-caller-identity + pip install --upgrade MeteorTools | grep -v 'already satisfied' + pip install pytest pytest-cov | grep -v 'already satisfied' + [ -d ./ukmda-dataprocessing ] && rm -Rf ./ukmda-dataprocessing + git clone https://github.com/ukmda/ukmda-dataprocessing.git + cd ./ukmda-dataprocessing/ + git checkout $BRANCH + cd ./archive/ukmon_pylib/ + curdir=$(pwd -P) + export DATADIR=/data + echo DATADIR is $DATADIR curdir is $curdir + export PYTHONPATH=/WesternMeteorPyLib:/RMS:${curdir} + pytest -v ./tests --cov=. --cov-report=term-missing + apitests: runs-on: ubuntu-latest steps: - - name: checkout code + - name: checkout code uses: actions/checkout@v3 - name: run api tests run: | diff --git a/.github/workflows/build_usermgmt.yml b/.github/workflows/build_usermgmt.yml deleted file mode 100644 index 5d078517c..000000000 --- a/.github/workflows/build_usermgmt.yml +++ /dev/null @@ -1,71 +0,0 @@ -name: build_usermgmt -env: - AWS_REGION: eu-west-2 -permissions: - id-token: write - contents: read - -on: - push: - branches: [ dev, markmac99, master ] - pull_request: - # The branches below must be a subset of the branches above - branches: [ master ] -jobs: - local_tests: - name: local test stage - runs-on: win10 - steps: - - name: "☁️ checkout repository" - uses: actions/checkout@v4 - - name: testing - run: | - echo "hello from test" - conda activate ukmon-admin - dir usermgmt\windows - build: - name: build stage - runs-on: win10 - needs: local_tests - steps: - - name: building - run: | - echo "running build step" - conda activate ukmon-admin - cd usermgmt\windows - pyinstaller ./stationMaint2.py --noconsole --onefile --windowed --icon .\camera.ico - dir dist - package: - name: package app - runs-on: win10 - needs: - - local_tests - - build - steps: - - name: packaging - run: | - echo "packaging the app now" - cd usermgmt\windows\dist - copy ../camera.ico . - ((get-content ..\stationmaint.cfg) -replace "adm_mark","") -replace "~/.ssh/ukmonhelper","" | set-content -path ./stationmaint.cfg - compress-archive -path . -update -destinationpath c:\temp\ukmon_usermgmt.zip - release: - name: release package - runs-on: win10 - needs: - - local_tests - - build - - package - steps: - - name: release - uses: xresloader/upload-to-github-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.MM_PAT }} - with: - file: c:\temp\ukmon_usermgmt.zip - #tags: true - draft: true - overwrite: true - tag_name: 2024.04.02 - default_release_name: User Management Tool - default_release_body_path: usermgmt\windows\release_notes.md diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 86dbe2e6b..77e99e8a1 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -13,12 +13,12 @@ name: "CodeQL" on: push: - branches: [ master ] + branches: [master] pull_request: # The branches below must be a subset of the branches above - branches: [ master ] + branches: [master] schedule: - - cron: '26 14 * * 6' + - cron: "26 14 * * 6" jobs: analyze: @@ -32,40 +32,40 @@ jobs: strategy: fail-fast: false matrix: - language: [ 'javascript', 'python' ] + language: ["javascript", "python"] # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] # Learn more: # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed steps: - - name: Checkout repository - uses: actions/checkout@v3 + - name: Checkout repository + uses: actions/checkout@v3 - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - # queries: ./path/to/local/query, your-org/your-repo/queries@main + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + # queries: ./path/to/local/query, your-org/your-repo/queries@main - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v2 + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v2 - # ℹ️ Command-line programs to run using the OS shell. - # 📚 https://git.io/JvXDl + # ℹ️ Command-line programs to run using the OS shell. + # 📚 https://git.io/JvXDl - # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines - # and modify them (or add more) to build your code if your project - # uses a compiled language + # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines + # and modify them (or add more) to build your code if your project + # uses a compiled language - #- run: | - # make bootstrap - # make release + #- run: | + # make bootstrap + # make release - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 diff --git a/.gitignore b/.gitignore index 531416e0f..e897bccc6 100644 --- a/.gitignore +++ b/.gitignore @@ -593,10 +593,19 @@ archive/samfunctions*/camDetails/pythoncode/camDetails.py archive/samfunctions*/camDetails/pythoncode/awskeys archive/containers/RMS-docker/rms_docker.tar archive/containers/RMS-docker/Dockerfile_orig.txt + +usermgmt/windows/csvkeys +usermgmt/windows/inifs +usermgmt/windows/jsonkeys +usermgmt/windows/keys +usermgmt/windows/sshkeys +usermgmt/windows/stationdetails +usermgmt/windows/users usermgmt/gmailkeys/* usermgmt/server/ukmonfundraising.txt usermgmt/server/ukmoncommittee.txt usermgmt/server/ukmon*.json + **/awskeys.test **/trajsolver_old/* archive/tmp/* @@ -605,3 +614,7 @@ tests/testing/RMS/ tests/testing/WesternMeteorPyLib/ archive/ukmon_pylib/tests/testdata.tar.gz servercopybkp/* +fbcollector/config.ini +usermgmt/windows/stationmaint.ini +usermgmt/windows/README.md +fbCollector/README.html diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json index c0662c555..1e99cf94d 100644 --- a/.vscode/c_cpp_properties.json +++ b/.vscode/c_cpp_properties.json @@ -5,8 +5,7 @@ "includePath": [ "${workspaceFolder}/**", "${vcpkgRoot}/x64-windows/include", - "${vcpkgRoot}/x86-windows/include", - "e:/dev/opencv3/opencv-3.4.11/build/install/include" + "${vcpkgRoot}/x86-windows/include" ], "defines": [ "_DEBUG", diff --git a/archive/analysis/consolidateOutput.sh b/archive/analysis/consolidateOutput.sh index 822038e57..34743434c 100644 --- a/archive/analysis/consolidateOutput.sh +++ b/archive/analysis/consolidateOutput.sh @@ -37,23 +37,29 @@ consdir=${DATADIR}/consolidated/temp mkdir -p ${DATADIR}/single/rawcsvs ls -1 $consdir/*.csv | while read csvf do - bn=$(basename $csvf) - typ=${bn:0:3} - if [ "$typ" != "M20" ] ; then - pref="P" - yr=${bn:7:4} + flen=$(wc -l $csvf | awk '{print $1}') + if [ $flen -lt 2 ] ; then + logger -s -t consolidateOutput "skipping empty file $csvf" + rm $csvf else - pref="M" - yr=${bn:1:4} - fi - mrgfile=${DATADIR}/consolidated/${pref}_${yr}-unified.csv - if [ ! -f $mrgfile ] ; then - cat $csvf >> $mrgfile - else - #echo $bn $mrgfile - sed '1d' $csvf >> $mrgfile + bn=$(basename $csvf) + typ=${bn:0:3} + if [ "$typ" != "M20" ] ; then + pref="P" + yr=${bn:7:4} + else + pref="M" + yr=${bn:1:4} + fi + mrgfile=${DATADIR}/consolidated/${pref}_${yr}-unified.csv + if [ ! -f $mrgfile ] ; then + cat $csvf >> $mrgfile + else + #echo $bn $mrgfile + sed '1d' $csvf >> $mrgfile + fi + mv $csvf ${DATADIR}/single/rawcsvs fi - mv $csvf ${DATADIR}/single/rawcsvs done logger -s -t consolidateOutput "pushing consolidated information back" diff --git a/archive/containers/trajsolver/Dockerfile b/archive/containers/trajsolver/Dockerfile index 276e5a11b..ff8b6ff5b 100644 --- a/archive/containers/trajsolver/Dockerfile +++ b/archive/containers/trajsolver/Dockerfile @@ -1,18 +1,20 @@ # Copyright (C) 2018-2023 Mark McIntyre -FROM continuumio/miniconda3:4.11.0 +#FROM continuumio/miniconda3:4.11.0 +FROM continuumio/miniconda3:24.7.1-0 -RUN conda install -y -c conda-forge "numpy<1.25.0" scipy cython pytz pyqt +#RUN conda install -y -c conda-forge "numpy<1.25.0" scipy cython pytz pyqt +RUN conda install -y -c conda-forge "numpy<2" scipy cython pytz pyqt RUN conda install -y -c conda-forge jplephem ephem RUN conda install -y -c conda-forge basemap basemap-data-hires RUN conda install -y -c conda-forge pandas cartopy -RUN conda install -y matplotlib=3.4.3 +RUN conda install -y matplotlib RUN pip install boto3 RUN apt-get update && apt-get -y upgrade RUN conda install -y -c conda-forge numba COPY WesternMeteorPyLib/ ./WesternMeteorPyLib -ENV PYTHONPATH ./WesternMeteorPyLib -ENV PROJ_LIB ./ +ENV PYTHONPATH=./WesternMeteorPyLib +ENV PROJ_LIB=./ COPY *.py ./ #ENV NUMPY_EXPERIMENTAL_DTYPE_API 1 diff --git a/archive/containers/trajsolver/build.ps1 b/archive/containers/trajsolver/build.ps1 index 8d63c8877..4a4dac048 100644 --- a/archive/containers/trajsolver/build.ps1 +++ b/archive/containers/trajsolver/build.ps1 @@ -17,7 +17,7 @@ write-output "building $imagename in $accid" $yn=read-host -prompt "update WMPL?" if ($yn.tolower() -eq "y") { bash -c "./update_wmpl.sh $env" } -if ($env -eq "test") { copy-item awskeys.test awskeys} +if ($env -eq "test") { move-item awskeys.test awskeys} docker build . -t ${imagename} if (! $?) @@ -26,7 +26,7 @@ if (! $?) exit } set-location $loc -if ($env -eq "test") { Remove-Item awskeys} +if ($env -eq "test") { move-item awskeys awskeys.test } $yn=read-host -prompt "upload to ECR?" if ($yn.tolower() -eq "y") { diff --git a/archive/containers/trajsolver/trajsolver.py b/archive/containers/trajsolver/trajsolver.py index 7155a2359..2d42835f7 100644 --- a/archive/containers/trajsolver/trajsolver.py +++ b/archive/containers/trajsolver/trajsolver.py @@ -36,7 +36,7 @@ def runCorrelator(dir_path, time_beg, time_end): trajectory_constraints.geometric_uncert = not uncerttime # Clock for measuring script time - t1 = datetime.datetime.utcnow() + t1 = datetime.datetime.now(datetime.timezone.utc) # If auto run is enabled, compute the time range to use event_time_range = None @@ -115,7 +115,7 @@ def runCorrelator(dir_path, time_beg, time_end): tc = TrajectoryCorrelator(dh, trajectory_constraints, velpart, data_in_j2000=True, distribute=distribute, enableOSM=True) tc.run(event_time_range=event_time_range) - print("Total run time: {:s}".format(str(datetime.datetime.utcnow() - t1))) + print("Total run time: {:s}".format(str(datetime.datetime.now(datetime.timezone.utc) - t1))) return @@ -136,9 +136,7 @@ def getSourceAndTargets(): webbucket = webpth[:webpth.find('/')] webpth = webpth[webpth.find('/')+1:] - oldoutb = os.getenv('OLDOUTB', default=None) - oldwebb = os.getenv('OLDWEBB', default=None) - return srcbucket, srcpth, outbucket, outpth, webbucket, webpth, oldwebb, oldoutb + return srcbucket, srcpth, outbucket, outpth, webbucket, webpth # extra args for setting the MIME type when uploading to S3. @@ -168,10 +166,31 @@ def getExtraArgs(fname): return extraargs +def checkIfFileNeeded(filename): + + # update this if there's an additional file created by WMPL that we want + # to use on the website + # NB THIS ALSO HAS TO BE CHANGED in maintenance.recreateOrbitPagesif more files needed + if 'orbit_top.png' in filename or 'orbit_side.png' in filename or 'ground_track.png' in filename: + return True + if 'velocities.png' in filename or 'lengths.png' in filename or 'lags_all.png' in filename: + return True + if 'abs_mag.png' in filename or 'abs_mag_ht.png' in filename or 'report.txt' in filename: + return True + if 'all_angular_residuals.png' in filename or 'all_spatial_total_residuals_height.png' in filename: + return True + if 'trajectory.pickle' in filename: + return True + return False + + #push solutions to the website, and push the pickle and report to shared bucket -def pushToWebsite(s3, localfldr, webbucket, webfldr, outbucket, outpth, oldwebb=None, oldoutb=None): +def pushToWebsite(s3, localfldr, webbucket, webfldr, outbucket, outpth): for root, _, files in os.walk(localfldr): for fil in files: + if not checkIfFileNeeded(fil): + print(f'skipping {fil}') + continue fullname = os.path.join(localfldr, root, fil) fname = os.path.split(fil)[1] orbname = os.path.split(root)[1] @@ -181,26 +200,10 @@ def pushToWebsite(s3, localfldr, webbucket, webfldr, outbucket, outpth, oldwebb= targkey = f'{webfldr}/{yr}/orbits/{ym}/{ymd}/{orbname}/{fname}' print(f'uploading {fname} to s3://{webbucket}/{targkey}') s3.meta.client.upload_file(fullname, webbucket, targkey, ExtraArgs = getExtraArgs(fname)) - if oldwebb: - print(f' and uploading to {oldwebb}') - try: - s3.meta.client.upload_file(fullname, oldwebb, targkey, ExtraArgs = getExtraArgs(fname)) - except: - print('unable to push to old website') - else: - print('not pushing to old website') if 'report' in fname or 'pickle' in fname: targkey = f'{outpth}/trajectories/{yr}/{ym}/{ymd}/{orbname}/{fname}' print(f'uploading {fname} to s3://{outbucket}/{targkey}') s3.meta.client.upload_file(fullname, outbucket, targkey, ExtraArgs = getExtraArgs(fname)) - if oldoutb: - print(f' and uploading to {oldoutb}') - try: - s3.meta.client.upload_file(fullname, oldoutb, targkey, ExtraArgs = getExtraArgs(fname)) - except: - print('unable to push to old share') - else: - print('not pushing to old share') return @@ -238,7 +241,7 @@ def startup(srcfldr, startdt, enddt, isTest=False): os.makedirs(canddir, exist_ok = True) s3 = getS3Client() - srcbucket, srcpth, outbucket, outpth, webbucket, webpth, oldwebb, oldoutb = getSourceAndTargets() + srcbucket, srcpth, outbucket, outpth, webbucket, webpth = getSourceAndTargets() if isTest is True: outpth = os.path.join(outpth, 'test') @@ -263,7 +266,7 @@ def startup(srcfldr, startdt, enddt, isTest=False): # reacquire tokens just in case the 1hour time limit on chained roles is exceeded s3 = getS3Client() - pushToWebsite(s3, trajfldr, webbucket, webpth, outbucket, outpth, oldwebb=oldwebb, oldoutb=oldoutb) + pushToWebsite(s3, trajfldr, webbucket, webpth, outbucket, outpth) fname = f'{srcfldr}.json' jsonfile = os.path.join(localfldr, 'processed_trajectories.json') diff --git a/archive/cronjobs/deleteDuplicateOrbit.sh b/archive/cronjobs/deleteDuplicateOrbit.sh new file mode 100644 index 000000000..03d129c4d --- /dev/null +++ b/archive/cronjobs/deleteDuplicateOrbit.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +here="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" +source $here/../config.ini >/dev/null 2>&1 +conda activate $HOME/miniconda3/envs/${WMPL_ENV} + +chkrunning=.delrunning +mkdir -p $DATADIR/manualuploads +cd $DATADIR/manualuploads +if [[ -f ./$chkrunning || -f ./running ]] ; then + echo "update already running" + exit +fi +touch ./$chkrunning +aws s3 sync $UKMONSHAREDBUCKET/fireballs/uploads . --exclude "*" --include "*.delete" --exclude "*.done" + +newfiles=$(ls -1 *.delete 2> /dev/null) +if [ "$newfiles" != "" ] ; then + for fil in $newfiles ; do + orbname=$(cat $fil) + echo $(date +%Y-%m-%dT%H:%M:%SZ) removing $orbname + $SRC/utils/deleteOrbit.sh $orbname + aws s3 mv $UKMONSHAREDBUCKET/fireballs/uploads/$fil $UKMONSHAREDBUCKET/fireballs/uploads/processed/$fil.done + rm $fil + done +fi +rm $DATADIR/manualuploads/$chkrunning +find $SRC/logs -name "deleteDuplicateOrbit*" -mtime +10 -exec rm -f {} \; diff --git a/archive/cronjobs/mergeNewOrbit.sh b/archive/cronjobs/mergeNewOrbit.sh index cfdf264b6..0738450f0 100644 --- a/archive/cronjobs/mergeNewOrbit.sh +++ b/archive/cronjobs/mergeNewOrbit.sh @@ -6,6 +6,11 @@ conda activate $HOME/miniconda3/envs/${WMPL_ENV} mkdir -p $DATADIR/manualuploads cd $DATADIR/manualuploads +if [ -f ./running ] ; then + echo "already running" + exit +fi +touch .running aws s3 sync $UKMONSHAREDBUCKET/fireballs/uploads . --exclude "*" --include "*.zip" --exclude "*.done" newfiles=$(ls -1 *.zip 2> /dev/null) @@ -57,4 +62,5 @@ EOD #else # echo nothing to process fi -find $SRC/logs -name "mergeNewOrbit*" -mtime +10 -exec rm -f {} \; \ No newline at end of file +rm $DATADIR/manualuploads/.running +find $SRC/logs -name "mergeNewOrbit*" -mtime +10 -exec rm -f {} \; diff --git a/archive/cronjobs/nightlyJob.sh b/archive/cronjobs/nightlyJob.sh index e96dcfddf..7f184a5fd 100644 --- a/archive/cronjobs/nightlyJob.sh +++ b/archive/cronjobs/nightlyJob.sh @@ -29,6 +29,7 @@ mkdir -p $DATADIR/browse/{annual,monthly,daily,showers} log2cw $NJLOGGRP $NJLOGSTREAM "updating the camera location/dir/fov database" nightlyJob python -c "from reports.CameraDetails import updateCamLocDirFovDB; updateCamLocDirFovDB();" aws s3 cp $DATADIR/admin/cameraLocs.json $UKMONSHAREDBUCKET/admin/ --profile ukmonshared --quiet +aws s3 cp $DATADIR/admin/cameraLocs.json $WEBSITEBUCKET/browse/ --profile ukmonshared --quiet aws s3 sync $UKMONSHAREDBUCKET/admin/ $DATADIR/admin --profile ukmonshared --quiet # create the CSV file of camera info and the html versions for search functions on the website diff --git a/archive/deployment/analysis.yml b/archive/deployment/analysis.yml index faeb27f7b..8e217f41d 100644 --- a/archive/deployment/analysis.yml +++ b/archive/deployment/analysis.yml @@ -1,7 +1,9 @@ --- - hosts: "{{host | default ('ukmonhelper2')}}" + vars_files: + - /mnt/c/Users/{{ lookup('env','USER' )}}/apikeys/mqvariables.enc vars: - srcdir: /mnt/e/dev/meteorhunting/ukmda-dataprocessing/archive + srcdir: "/mnt/c/Users/{{ lookup('env','USER' )}}/OneDrive/dev/ukmda-dataprocessing/archive" tasks: - name: import dev variables include_vars: ./dev-vars.yml diff --git a/archive/deployment/config.yml b/archive/deployment/config.yml index 2fa3d319e..b9823e58a 100644 --- a/archive/deployment/config.yml +++ b/archive/deployment/config.yml @@ -1,6 +1,8 @@ - hosts: "{{host | default ('ukmonhelper2')}}" + vars_files: + - /mnt/c/Users/{{ lookup('env','USER' )}}/apikeys/mqvariables.enc vars: - srcdir: /mnt/e/dev/meteorhunting/ukmda-datapocessing/archive + srcdir: "/mnt/c/Users/{{ lookup('env','USER' )}}/OneDrive/dev/ukmda-dataprocessing/archive" tasks: - name: import dev variables include_vars: dev-vars.yml diff --git a/archive/deployment/cronjobs.yml b/archive/deployment/cronjobs.yml index 1232a22ec..6a80c1b5e 100644 --- a/archive/deployment/cronjobs.yml +++ b/archive/deployment/cronjobs.yml @@ -1,7 +1,9 @@ --- - hosts: "{{host | default ('ukmonhelper2')}}" + vars_files: + - /mnt/c/Users/{{ lookup('env','USER' )}}/apikeys/mqvariables.enc vars: - srcdir: /mnt/e/dev/meteorhunting/ukmda-dataprocessing/archive + srcdir: "/mnt/c/Users/{{ lookup('env','USER' )}}/OneDrive/Dev/meteorhunting/ukmda-dataprocessing/archive" tasks: - name: import dev variables include_vars: ./dev-vars.yml @@ -19,6 +21,7 @@ - {src: '{{srcdir}}/cronjobs/nightlyJob.sh', dest: '{{destdir}}/cronjobs', mode: '754', backup: no } - {src: '{{srcdir}}/cronjobs/captureBright.sh', dest: '{{destdir}}/cronjobs', mode: '754', backup: no } - {src: '{{srcdir}}/cronjobs/getImoWSfile.sh', dest: '{{destdir}}/cronjobs', mode: '754', backup: no } - - {src: '{{srcdir}}//cronjobs/mergeNewOrbit.sh', dest: '{{destdir}}/cronjobs', mode: '754', backup: no } - - {src: '{{srcdir}}//cronjobs/gatherMonthlyVideos.sh', dest: '{{destdir}}/cronjobs', mode: '754', backup: no } + - {src: '{{srcdir}}/cronjobs/mergeNewOrbit.sh', dest: '{{destdir}}/cronjobs', mode: '754', backup: no } + - {src: '{{srcdir}}/cronjobs/deleteDuplicateOrbit.sh', dest: '{{destdir}}/cronjobs', mode: '754', backup: no } + - {src: '{{srcdir}}/cronjobs/gatherMonthlyVideos.sh', dest: '{{destdir}}/cronjobs', mode: '754', backup: no } - {src: '{{srcdir}}/cronjobs/README.md', dest: '{{destdir}}/cronjobs', mode: '644', backup: no } diff --git a/archive/deployment/database.yml b/archive/deployment/database.yml index 1baceec67..1b75b1f5f 100644 --- a/archive/deployment/database.yml +++ b/archive/deployment/database.yml @@ -1,7 +1,9 @@ --- - hosts: "{{host | default ('ukmonhelper2')}}" + vars_files: + - /mnt/c/Users/{{ lookup('env','USER' )}}/apikeys/mqvariables.enc vars: - srcdir: /mnt/e/dev/meteorhunting/ukmda-dataprocessing/archive + srcdir: "/mnt/c/Users/{{ lookup('env','USER' )}}/OneDrive/dev/ukmda-dataprocessing/archive" tasks: - name: import dev variables include_vars: ./dev-vars.yml diff --git a/usermgmt/deploy-server.yml b/archive/deployment/deploy-usermgmt.yml similarity index 51% rename from usermgmt/deploy-server.yml rename to archive/deployment/deploy-usermgmt.yml index ff6ebb521..8429780d3 100644 --- a/usermgmt/deploy-server.yml +++ b/archive/deployment/deploy-usermgmt.yml @@ -1,22 +1,18 @@ --- - hosts: "{{host | default ('ukmonhelper2')}}" + vars_files: + - /mnt/c/Users/{{ lookup('env','USER' )}}/apikeys/mqvariables.enc vars: - srcdir: /mnt/e/dev/meteorhunting/ukmda-dataprocessing/usermgmt/server + srcdir: "/mnt/c/Users/{{ lookup('env','USER' )}}/OneDrive/dev/meteorhunting/ukmda-dataprocessing/archive/usermgmt" + destdir: /home/ec2-user/keymgmt tasks: - - name: import dev variables - include_vars: ./dev-vars.yml - tags: dev - - name: import prod variables - include_vars: ./prod-vars.yml - tags: prod - name: Ensures {{destdir}} exists file: path={{destdir}} state=directory - tags: [dev,prod] - name: Copy files - tags: [dev,prod] copy: src={{ item.src }} dest={{ item.dest }} mode={{ item.mode }} with_items: - {src: '{{srcdir}}/addSftpUser.sh', dest: '{{destdir}}/', mode: '744', backup: yes, directory_mode: no } - {src: '{{srcdir}}/updateAwsKey.sh', dest: '{{destdir}}/', mode: '744', backup: yes, directory_mode: no } - - {src: '{{srcdir}}/ukmon.ini', dest: '{{destdir}}/', mode: '644', backup: yes, directory_mode: no } + - {src: '{{srcdir}}/addAdminUser.sh', dest: '{{destdir}}/', mode: '744', backup: yes, directory_mode: no } + - {src: '{{srcdir}}/addFBApiKey.sh', dest: '{{destdir}}/', mode: '744', backup: yes, directory_mode: no } diff --git a/archive/deployment/pylib.yml b/archive/deployment/pylib.yml index 90ae4e01d..46a4afc71 100644 --- a/archive/deployment/pylib.yml +++ b/archive/deployment/pylib.yml @@ -1,7 +1,9 @@ --- - hosts: "{{host | default ('ukmonhelper2')}}" + vars_files: + - /mnt/c/Users/{{ lookup('env','USER' )}}/apikeys/mqvariables.enc vars: - srcdir: /mnt/e/dev/meteorhunting/ukmda-dataprocessing/archive + srcdir: "/mnt/c/Users/{{ lookup('env','USER' )}}/OneDrive/dev/ukmda-dataprocessing/archive" tasks: - name: import dev variables include_vars: ./dev-vars.yml @@ -35,6 +37,7 @@ - {src: '{{srcdir}}/ukmon_pylib/converters/__init__.py', dest: '{{destdir}}/ukmon_pylib/converters', mode: '644', backup: no } - {src: '{{srcdir}}/ukmon_pylib/converters/README.md', dest: '{{destdir}}/ukmon_pylib/converters', mode: '644', backup: no } + - {src: '{{srcdir}}/ukmon_pylib/maintenance/compressOldArchiveData.py', dest: '{{destdir}}/ukmon_pylib/maintenance', mode: '644', backup: no } - {src: '{{srcdir}}/ukmon_pylib/maintenance/cleanDdbTables.py', dest: '{{destdir}}/ukmon_pylib/maintenance', mode: '644', backup: no } - {src: '{{srcdir}}/ukmon_pylib/maintenance/dataMaintenance.py', dest: '{{destdir}}/ukmon_pylib/maintenance', mode: '644', backup: no } - {src: '{{srcdir}}/ukmon_pylib/maintenance/deDuplicate.py', dest: '{{destdir}}/ukmon_pylib/maintenance', mode: '644', backup: no } diff --git a/archive/deployment/server_setup.yml b/archive/deployment/server_setup.yml index 4682ee3b5..f621dc278 100644 --- a/archive/deployment/server_setup.yml +++ b/archive/deployment/server_setup.yml @@ -1,7 +1,9 @@ --- - hosts: "{{host | default ('ukmonhelper2')}}" + vars_files: + - /mnt/c/Users/{{ lookup('env','USER' )}}/apikeys/mqvariables.enc vars: - srcdir: /mnt/e/dev/meteorhunting/ukmda-dataprocessing/archive + srcdir: "/mnt/c/Users/{{ lookup('env','USER' )}}/OneDrive/dev/ukmda-dataprocessing/archive" tasks: - name: import dev variables include_vars: ./dev-vars.yml diff --git a/archive/deployment/shwrinfo.yml b/archive/deployment/shwrinfo.yml index 0c5dbc78c..17a6110ee 100644 --- a/archive/deployment/shwrinfo.yml +++ b/archive/deployment/shwrinfo.yml @@ -1,7 +1,9 @@ --- - hosts: "{{host | default ('ukmonhelper2')}}" + vars_files: + - /mnt/c/Users/{{ lookup('env','USER' )}}/apikeys/mqvariables.enc vars: - srcdir: /mnt/e/dev/meteorhunting/ukmda-dataprocessing/archive + srcdir: "/mnt/c/Users/{{ lookup('env','USER' )}}/OneDrive/dev/ukmda-dataprocessing/archive" tasks: - name: import dev variables include_vars: ./dev-vars.yml diff --git a/archive/deployment/utils.yml b/archive/deployment/utils.yml index e6a47f723..f122d7cb5 100644 --- a/archive/deployment/utils.yml +++ b/archive/deployment/utils.yml @@ -1,7 +1,9 @@ --- - hosts: "{{host | default ('ukmonhelper2')}}" + vars_files: + - /mnt/c/Users/{{ lookup('env','USER' )}}/apikeys/mqvariables.enc vars: - srcdir: /mnt/e/dev/meteorhunting/ukmda-dataprocessing/archive + srcdir: "/mnt/c/Users/{{ lookup('env','USER' )}}/OneDrive/dev/ukmda-dataprocessing/archive" tasks: - name: import dev variables include_vars: ./dev-vars.yml diff --git a/archive/deployment/website.yml b/archive/deployment/website.yml index 427008f1d..1ee42364e 100644 --- a/archive/deployment/website.yml +++ b/archive/deployment/website.yml @@ -1,7 +1,9 @@ --- - hosts: "{{host | default ('ukmonhelper2')}}" + vars_files: + - /mnt/c/Users/{{ lookup('env','USER' )}}/apikeys/mqvariables.enc vars: - srcdir: /mnt/e/dev/meteorhunting/ukmda-dataprocessing/archive + srcdir: "/mnt/c/Users/{{ lookup('env','USER' )}}/OneDrive/dev/ukmda-dataprocessing/archive" tasks: - name: import dev variables include_vars: ./dev-vars.yml diff --git a/archive/deployment/website_static.yml b/archive/deployment/website_static.yml index edb791d7b..cbe146679 100644 --- a/archive/deployment/website_static.yml +++ b/archive/deployment/website_static.yml @@ -1,7 +1,9 @@ --- - hosts: "{{host | default ('ukmonhelper2')}}" + vars_files: + - /mnt/c/Users/{{ lookup('env','USER' )}}/apikeys/mqvariables.enc vars: - srcdir: /mnt/e/dev/meteorhunting/ukmda-dataprocessing/archive + srcdir: "/mnt/c/Users/{{ lookup('env','USER' )}}/OneDrive/dev/ukmda-dataprocessing/archive" tasks: - name: import dev variables include_vars: ./dev-vars.yml @@ -18,7 +20,7 @@ with_items: - {src: '{{srcdir}}/static_content/browse/', dest: '{{destdir}}/static_content/browse', mode: '754', backup: no, directory_mode: yes } - {src: '{{srcdir}}/static_content/css/', dest: '{{destdir}}/static_content/css', mode: '754', backup: no, directory_mode: yes } - - {src: '{{srcdir}}/static_content/data/', dest: '{{destdir}}/static_content/data', mode: '754', backup: no, directory_mode: yes } + #- {src: '{{srcdir}}/static_content/data/', dest: '{{destdir}}/static_content/data', mode: '754', backup: no, directory_mode: yes } - {src: '{{srcdir}}/static_content/docs/', dest: '{{destdir}}/static_content/docs', mode: '754', backup: no, directory_mode: yes } - {src: '{{srcdir}}/static_content/fonts/', dest: '{{destdir}}/static_content/fonts', mode: '754', backup: no, directory_mode: yes } - {src: '{{srcdir}}/static_content/img/', dest: '{{destdir}}/static_content/img', mode: '754', backup: no, directory_mode: yes } diff --git a/archive/samfunctions/getExtraFilesV2/pythoncode/Dockerfile b/archive/samfunctions/getExtraFilesV2/pythoncode/Dockerfile index 801df9512..26f9034fa 100644 --- a/archive/samfunctions/getExtraFilesV2/pythoncode/Dockerfile +++ b/archive/samfunctions/getExtraFilesV2/pythoncode/Dockerfile @@ -1,16 +1,17 @@ # Copyright (C) 2018-2023 Mark McIntyre -FROM public.ecr.aws/lambda/python:3.9 + +FROM public.ecr.aws/lambda/python:3.13 COPY requirements.txt ./ RUN python -m pip install -r requirements.txt -t . RUN python -m pip install numba watchdog basemap-data-hires -t . RUN python -m pip install cartopy -t . -RUN yum update -y -ENV LD_LIBRARY_PATH ./ +#RUN yum update -y +ENV LD_LIBRARY_PATH=./ COPY WesternMeteorPyLib/ ./WesternMeteorPyLib #COPY *.npy ./WesternMeteorPyLib/wmpl/share/ COPY *.py ./ -ENV PYTHONPATH ./WesternMeteorPyLib -ENV PROJ_LIB ./ +ENV PYTHONPATH=./WesternMeteorPyLib +ENV PROJ_LIB=./ CMD ["getExtraFiles.lambda_handler"] diff --git a/archive/samfunctions/getExtraFilesV2/pythoncode/createOrbitPageIndex.py b/archive/samfunctions/getExtraFilesV2/pythoncode/createOrbitPageIndex.py index 35f5497ac..ab4e24184 100644 --- a/archive/samfunctions/getExtraFilesV2/pythoncode/createOrbitPageIndex.py +++ b/archive/samfunctions/getExtraFilesV2/pythoncode/createOrbitPageIndex.py @@ -31,9 +31,9 @@ def createOrbitPageIndex(fldr, websitebucket, s3): lis = sumf.readlines() idxf.writelines(lis) - zipf = orbitname + '.zip' - if os.path.isfile(os.path.join(fldr, zipf)): - idxf.write(f"Click here to download a zip of the raw and processed data.\n") + #zipf = orbitname + '.zip' + #if os.path.isfile(os.path.join(fldr, zipf)): + # idxf.write(f"Click here to download a zip of the raw and processed data.\n") idxf.write("\n") idxf.write("
Detailed report below graphs
\n") idxf.write("The data here are released under the CC BY 4.0 license, so if you are using the data whether for scientific or other purposes, your must reference this web site in your work. diff --git a/archive/static_content/browse/daily/index.html b/archive/static_content/browse/daily/index.html index e03a52b93..0d6cc5807 100644 --- a/archive/static_content/browse/daily/index.html +++ b/archive/static_content/browse/daily/index.html @@ -63,6 +63,7 @@
This page provides a list of all detections in the last 72 hours from the camera network, primarily for the purposes of data exchange with diff --git a/archive/static_content/browse/index.html b/archive/static_content/browse/index.html index ceff96e73..23f8d2e43 100644 --- a/archive/static_content/browse/index.html +++ b/archive/static_content/browse/index.html @@ -41,6 +41,7 @@
Follow the links below to access downloadable datasets from our archive.
You can also use our REST APIs to retrieve some data programmatically. If you're interested in diff --git a/archive/static_content/browse/monthly/index.html b/archive/static_content/browse/monthly/index.html index cd1f5f72a..e0f8cf24b 100644 --- a/archive/static_content/browse/monthly/index.html +++ b/archive/static_content/browse/monthly/index.html @@ -41,6 +41,7 @@
The data here are released under the CC BY 4.0 license, so if you are using the data whether for scientific or other purposes, your must reference this web site in your work. diff --git a/archive/static_content/css/dragontail.css b/archive/static_content/css/dragontail.css index 35ca1de7a..ddefb159e 100644 --- a/archive/static_content/css/dragontail.css +++ b/archive/static_content/css/dragontail.css @@ -141,7 +141,7 @@ body { .sticky + .content { padding-top: 60px; } - + .sidebar .sidebar-nav.navbar-collapse { padding-right: 0; padding-left: 0; @@ -524,6 +524,12 @@ li > a:only-child:after { content: ''; } font-size: 15px; } +@media screen and (max-width: 1100px) { + .sidenav { + display: none !important; + } +} + .table { /*color: whitesmoke;*/ background-color: white; diff --git a/archive/static_content/docs/Code_of_Conduct.html b/archive/static_content/docs/Code_of_Conduct.html index 8d6024a51..20c9502d7 100644 --- a/archive/static_content/docs/Code_of_Conduct.html +++ b/archive/static_content/docs/Code_of_Conduct.html @@ -43,6 +43,7 @@
The Society is managed by a committee consisting of the following offices:
| President | -Currently Vacant | +Peter Campbell-Burns | ||
| Secretary | diff --git a/archive/static_content/docs/index.html b/archive/static_content/docs/index.html index c6003069b..4e32063c5 100644 --- a/archive/static_content/docs/index.html +++ b/archive/static_content/docs/index.html @@ -43,6 +43,7 @@||||
| '; dt = new Date(dtarr[0]*1000); @@ -109,7 +110,7 @@ function myFunc(myObj) { txt += " | "; txt += dtarr[3]; txt += " | "; - txt += dtarr[4]; + txt += cams; txt += " | ";
errimg = "onerror=\"this.onerror=null;this.src='/img/missing.png';\"";
txt += "
+ The data here are released under the CC BY 4.0 license, so if you are using the data whether for scientific or other purposes, your must reference this web site in your work. diff --git a/archive/website/templates/statreportindex.html b/archive/website/templates/statreportindex.html index a0fdae7fe..b62bd482a 100644 --- a/archive/website/templates/statreportindex.html +++ b/archive/website/templates/statreportindex.html @@ -46,7 +46,7 @@
-
+ The table below provides access to a summary report by station.
The data here are released under the CC BY 4.0 license, so if you are using the data
diff --git a/tests/test_apis.py b/tests/test_apis.py
index 7c81fe892..4394b5d16 100644
--- a/tests/test_apis.py
+++ b/tests/test_apis.py
@@ -172,7 +172,7 @@ def test_getECSV():
apiurl='https://api.ukmeteors.co.uk/getecsv?stat={}&dt={}'
res = requests.get(apiurl.format(stationID, dateStr))
assert res.status_code == 200
- assert res.text.split()[-1] == 'time'
+ assert res.text.split()[-1] == '593.580'
stationID = 'UK0080'
dateStr = '2024-02-25T20:02:00.1'
@@ -188,6 +188,6 @@ def test_getECSVbadDate():
dateStr = '2024-02-25T20:02:'
apiurl='https://api.ukmeteors.co.uk/getecsv?stat={}&dt={}'
res = requests.get(apiurl.format(stationID, dateStr))
- assert res.status_code == 200
- assert res.text.split()[-1] == 'format'
+ assert res.status_code == 502
+ #assert res.text.split()[-1] == 'format'
return
diff --git a/usermgmt/README.md b/usermgmt/README.md
deleted file mode 100644
index 4bb751c08..000000000
--- a/usermgmt/README.md
+++ /dev/null
@@ -1,64 +0,0 @@
-# UKMDA User Management
-
-This folder contains the scripts used to add/maintain new cameras to the network.
-
-## Basic Principles
-A camera consists of an RMS ID, location and pointing direction.
-
-Each _location_ is assigned a unique *AWS* user with credentials that grant suitable permissions to the S3 storage. For example, a contributor in Toytown might be assigned a unique AWS user "Toytown".
-
-AWS credentials are not shared between locations. If a location's credentials are compromised, they can be disabled without impacting the rest of the network and new credentials can then be issued. The *ukmon-pitools* toolset is designed so that new credentials will be picked up the next time *refreshTools.sh* is run on the impacted Pi (either at reboot or manually).
-
-Each _camera_ is allocated a unique *Unix* ID. The public ssh key provided by the operator is used to enable *ukmon-pitools* to login and collect configuration information for the camera. For example if the contributor at Toytown had two cameras facing North and South, the cameras might be named "toytown_s" and "toytown_n". Note that camera names are in lower case, must be unique and that SSH keys should not be shared between cameras. If the operator chooses to share keys they do so at their own risk and it means that if the key is compromised, all their cameras will be unable to connect.
-
-
-# User Management tool
-Unix and AWS User creation and configuration are managed by *stationMaint.ps1* which calls a python programme that uses native AWS and Unix libraries to execute the required commands. The tool requires AWS and SSH credentials which are restricted to administrators (see note below).
-
-## Setup
-Prerequisites:
-* anaconda or miniconda
-* An AWS profile with the usermaintenance IAM permissions. The default profile name is *ukmda_maint*.
-* An SSH key thats permissioned to connect to the server. The default key name is *ukmda_admin*.
-
-To install the app, copy the python files, requirements.txt and powershell script to a folder of your choosing, and update the environment variables in the powershell script as needed. Now run the powershell script which will create a suitable Conda environment, install the requirements and launch the tool.
-
-## Adding a new camera
-To add a new camera the camera operator must supply the following:
-* RMS ID (from the RMS .config file)
-* town or village (eg Toytown)
-* approx pointing direction (eg SW)
-* the SSH public key generated by *ukmon-pitools*.
-* Human name and email address of the operator.
-
-RMS ID, pointing direction and SSH key are unique to each camera. Other values will generally be shared
-by other cameras at the same location.
-
-Once the information has been gathered, select Camera/Add and fill in the boxes. Note that the boxes are part-prepopulated with values from whatever row your cursor was on, so that if you're adding another camera at an existing location, you can save a bit of typing.
-
-## Amending a camera
-The location and pointing direction cannot be changed once set. To change these values you'll need to follow the process to move a camera.
-All other values can be amended by selecting the line and updating the values.
-
-## Moving a camera
-To move a camera to a new location, select the row containing the camera then select Camera/Move. After you fill in any new information, a new unix and AWS user will be created and the configuration files for the old user will be updated. The old camera must then be marked disabled as explained next.
-
-IMPORTANT NOTE: the camera owner should NOT make any changes - the system will automatically update their configuration.
-
-## Disabling a camera
-To disable a camera, change the Active column from 1 to today's date in YYYYMMDD format eg 20220715. This removes the camera from current reporting, but retains the details for any historical reporting.
-
-# Disabling a location
-To disable a location, we revoke the corresponding AWS user's keys, and if necessary, delete the AWS user and Unix ID. No other user will be affected. This is not currently managed by the UI as it is a drastic action that we do not want to carry out accidentally!
-
-# Permissions Needed
-This tool requires two sets of permissions:
-* an AWS profile with permissions to add/amend/delete users in IAM. This is required to manage the AWS roles.
-* an SSH key with permissions to login to the Batch server. This is required to manage the Unix accounts.
-
-# Parameters
-The powershell script lists the parameters that need to be set, such as AWS profile to use, the buckets and so on. The ansible YAML script sets these values.
-
-
-# Copyright
-All code Copyright (C) 2018-2023 Mark McIntyre
\ No newline at end of file
diff --git a/usermgmt/build.ps1 b/usermgmt/build.ps1
deleted file mode 100644
index 325846018..000000000
--- a/usermgmt/build.ps1
+++ /dev/null
@@ -1 +0,0 @@
-pyinstaller .\stationMaint2.py --noconsole --onefile --windowed --icon .\camera.ico --clean
diff --git a/usermgmt/deploy-local.yml b/usermgmt/deploy-local.yml
deleted file mode 100644
index 76677f582..000000000
--- a/usermgmt/deploy-local.yml
+++ /dev/null
@@ -1,76 +0,0 @@
----
-- hosts: ukmonhelper2
- gather_facts: no
- tasks:
- - name: import dev variables
- include_vars: ./dev-vars.yml
- tags: dev
- - name: import prod variables
- include_vars: ./prod-vars.yml
- tags: prod
- - name: Ensures {{windestdir}} exists
- file: path={{windestdir}} state=directory
- delegate_to: localhost
- tags: [dev,prod]
- - name: Ensures {{windestdir}}/caminfo exists
- file: path={{windestdir}}/caminfo state=directory
- delegate_to: localhost
- tags: [dev,prod]
-
- - name: build exe
- ansible.builtin.shell: |
- conda activate ukmon-admin
- cd windows
- pyinstaller ./stationMaint2.py --noconsole --onefile --windowed --icon .\camera.ico
- args:
- executable: pwsh.exe
- delegate_to: localhost
- register: outdata
- tags: [dev,prod]
-
- - name: print debug
- debug:
- var: outdata.stdout
- - name: Copy files
- copy: src={{ item.src }} dest={{ item.dest }} mode={{ item.mode }}
- delegate_to: localhost
- tags: [dev,prod]
- with_items:
- - {src: '{{winsrcdir}}/dist/StationMaint2.exe', dest: '{{windestdir}}/', mode: '754', backup: yes, directory_mode: no }
- - {src: '{{winsrcdir}}/camera.ico', dest: '{{windestdir}}/', mode: '644', backup: yes, directory_mode: no }
- - {src: '{{winsrcdir}}/stationmaint.cfg', dest: '{{windestdir}}/', mode: '644', backup: yes, directory_mode: no }
- - name: update source bucket
- lineinfile:
- path: '{{windestdir}}/stationmaint.cfg'
- regexp: 'SRCBUCKET='
- line: 'SRCBUCKET={{srcbucket}}'
- delegate_to: localhost
- tags: [dev,prod]
- - name: update live bucket
- lineinfile:
- path: '{{windestdir}}/stationmaint.cfg'
- regexp: 'LIVEBUCKET='
- line: 'LIVEBUCKET={{livebucket}}'
- delegate_to: localhost
- tags: [dev,prod]
- - name: update web bucket
- lineinfile:
- path: '{{windestdir}}/stationmaint.cfg'
- regexp: 'WEBSITEBUCKET='
- line: 'WEBSITEBUCKET={{websitebucket}}'
- delegate_to: localhost
- tags: [dev,prod]
- - name: update helper ipaddress
- lineinfile:
- path: '{{windestdir}}/stationmaint.cfg'
- regexp: 'HELPERIP='
- line: 'HELPERIP={{serverip}}'
- delegate_to: localhost
- tags: [dev,prod]
- - name: update helper remotedir
- lineinfile:
- path: '{{windestdir}}/stationmaint.cfg'
- regexp: 'REMOTEDIR='
- line: 'REMOTEDIR={{remotedir}}'
- delegate_to: localhost
- tags: [dev,prod]
diff --git a/usermgmt/dev-vars.yml b/usermgmt/dev-vars.yml
deleted file mode 100644
index 5dfce2f67..000000000
--- a/usermgmt/dev-vars.yml
+++ /dev/null
@@ -1,11 +0,0 @@
- winsrcdir: /mnt/e/dev/meteorhunting/ukmda-dataprocessing/usermgmt/windows
- windestdir: /mnt/e/dev/meteorhunting/testing/usermgmt
- destdir: /home/ec2-user/dev/keymgmt
- srcbucket: mjmm-ukmon-shared
- livebucket: mjmm-ukmon-live
- websitebucket: mjmm-ukmonarchive.co.uk
- liveprofile: default
- archprofile: ukmda_admin
- helper: ukmonhelper2
- serverip: "3.11.55.160"
- remotedir: /home/ec2-user/dev/data
\ No newline at end of file
diff --git a/usermgmt/prod-vars.yml b/usermgmt/prod-vars.yml
deleted file mode 100644
index 63b88f793..000000000
--- a/usermgmt/prod-vars.yml
+++ /dev/null
@@ -1,9 +0,0 @@
- winsrcdir: /mnt/e/dev/meteorhunting/ukmda-dataprocessing/usermgmt/windows
- windestdir: /mnt/f/videos/MeteorCam/usermgmt
- destdir: /home/ec2-user/keymgmt
- srcbucket: ukmda-shared
- livebucket: ukmda-live
- websitebucket: ukmda-website
- helper: ukmonhelper2
- serverip: "3.11.55.160"
- remotedir: /home/ec2-user/prod/data
\ No newline at end of file
diff --git a/usermgmt/server/ukmon.ini b/usermgmt/server/ukmon.ini
deleted file mode 100644
index 59c2a1061..000000000
--- a/usermgmt/server/ukmon.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-# config data for this station
-export LOCATION=STATIONLOCATION
-export UKMONHELPER=3.11.55.160
-export UKMONKEY=~/.ssh/ukmon
-export RMSCFG=~/source/RMS/.config
diff --git a/usermgmt/windows/camera.ico b/usermgmt/windows/camera.ico
deleted file mode 100644
index 33fcafac1..000000000
Binary files a/usermgmt/windows/camera.ico and /dev/null differ
diff --git a/usermgmt/windows/release_notes.md b/usermgmt/windows/release_notes.md
deleted file mode 100644
index de9a86dd7..000000000
--- a/usermgmt/windows/release_notes.md
+++ /dev/null
@@ -1,18 +0,0 @@
-# The UKMON Station Management Tool
-
-This application is used to add, modify and disable RMS stations linked to UKMON. The app is intended for use only by the UKMON committee members responsible for managing users.
-
-## Before Installation
-First you should contact me, Mark McIntyre. You will need to send me your ssh public key, and i will then create a userid for you on our server and send you the details.
-
-## Installation
-Download the zip file and expand it to a location of your choice, for example `c:\programdata\ukmon`
-Create an SSH keypair.
-Edit the config file and add the userid i provided, plus the full path to the ssh private key.
-Save the config file and run the app.
-
-## Use
-The menus should be pretty self-explanatory.
-
-## Release Notes
-2024.04.2 - first release.
\ No newline at end of file
diff --git a/usermgmt/windows/requirements.txt b/usermgmt/windows/requirements.txt
deleted file mode 100644
index 3894e9b5f..000000000
--- a/usermgmt/windows/requirements.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-# Copyright (C) 2018-2023 Mark McIntyre
-boto3
-openpyxl
-pandas
-scp
-tksheet
-paramiko
-pyinstaller
diff --git a/usermgmt/windows/stationMaint.ps1 b/usermgmt/windows/stationMaint.ps1
deleted file mode 100644
index 28eeee7ef..000000000
--- a/usermgmt/windows/stationMaint.ps1
+++ /dev/null
@@ -1,18 +0,0 @@
-# Copyright (C) 2018-2023 Mark McIntyre
-push-Location $psscriptroot
-
-# create conda env if not aleady there
-$isadm=(conda env list | select-string "ukmon-admin")
-if ($isadm.count -eq 0) {
- conda env create -n ukmon-admin python=3.8
- pip install -r requirements.txt
-}
-conda activate ukmon-admin
-
-bash -c "rsync -avz --delete ukmonhelper2:keymgmt/sshkeys/ ./sshkeys"
-bash -c "rsync -avz --delete ukmonhelper2:keymgmt/sshkeys/ ./keys"
-bash -c "rsync -avz --delete ukmonhelper2:keymgmt/sshkeys/ ./csvkeys"
-bash -c "rsync -avz --delete ukmonhelper2:keymgmt/sshkeys/ ./inifs"
-
-python stationMaint2.py
-Pop-Location
\ No newline at end of file
diff --git a/usermgmt/windows/stationMaint2.py b/usermgmt/windows/stationMaint2.py
deleted file mode 100644
index 5e5c8a8c8..000000000
--- a/usermgmt/windows/stationMaint2.py
+++ /dev/null
@@ -1,946 +0,0 @@
-# Copyright (C) 2018-2023 Mark McIntyre
-
-from tksheet import Sheet
-import tkinter as tk
-from tkinter import ttk
-from tkinter import Frame, Menu
-from tkinter import simpledialog
-import tkinter.messagebox as tkMessageBox
-from tkinter.filedialog import askopenfilename
-import boto3
-import os
-import sys
-import paramiko
-import json
-import time
-import datetime
-import tempfile
-from scp import SCPClient
-from boto3.dynamodb.conditions import Key
-import pandas as pd
-from configparser import ConfigParser
-import logging
-import logging.handlers
-
-
-log = logging.getLogger("logger")
-
-
-def loadConfig(cfgdir):
- cfgfile = os.path.join(cfgdir, 'stationmaint.cfg')
- cfg = ConfigParser()
- if not os.path.isfile(cfgfile):
- tkMessageBox.showinfo('Warning', f'config file {cfgfile} not found')
- exit(0)
- cfg.read(cfgfile)
- server = cfg['helper']['helperip']
- user = cfg['helper']['user']
- keyfile = cfg['helper']['sshkey']
- k = paramiko.RSAKey.from_private_key_file(os.path.expanduser(keyfile))
- c = paramiko.SSHClient()
- c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
- c.connect(hostname = server, username = user, pkey = k)
- scpcli = c.open_sftp()
- try:
- handle, tmpfnam = tempfile.mkstemp()
- scpcli.get(f'{user}.csv', tmpfnam)
- except Exception:
- log.warning('unable to find AWS key')
- scpcli.close()
- c.close()
- try:
- lis = open(tmpfnam, 'r').readlines()
- os.close(handle)
- os.remove(tmpfnam)
- key, sec = lis[1].split(',')
- except Exception:
- log.warning('malformed AWS key')
- if key:
- log.info('retrieved key details')
- awskeys = {'key': key.strip(), 'secret': sec.strip()}
- else:
- awskeys = {}
- return cfg, awskeys
-
-
-def addRow(newdata=None, stationid=None, site=None, user=None, email=None, ddb=None,
- direction=None, camtype=None, active=None, createdate=None, tblname='camdetails'):
- '''
- add a row to the CamDetails table
- '''
- if not ddb:
- ddb = boto3.resource('dynamodb', region_name='eu-west-2')
- if not newdata:
- newdata = {'stationid': stationid, 'site': site, 'humanName':user, 'eMail': email,
- 'direction': direction, 'camtype': camtype, 'active': active, 'created': createdate,
- 'oldcode': stationid}
- table = ddb.Table(tblname)
- response = table.put_item(Item=newdata)
- if response['ResponseMetadata']['HTTPStatusCode'] != 200:
- log.info(response)
- return
-
-
-def loadLocationDetails(table='camdetails', ddb=None, loadall=False):
- if not ddb:
- ddb = boto3.resource('dynamodb', region_name='eu-west-2')
- table = ddb.Table(table)
- res = table.scan()
- # strictly, should check for LastEvaluatedKey here, in case there was more than 1MB of data,
- # however that equates to around 30,000 users which i hope we never have...
- values = res.get('Items', [])
- camdets = pd.DataFrame(values)
- camdets.sort_values(by=['stationid'], inplace=True)
- if not loadall:
- camdets.dropna(inplace=True, subset=['eMail','humanName','site'])
- camdets['camtype'] = camdets['camtype'].astype(int)
- camdets['active'] = camdets['active'].astype(int)
- return camdets
-
-
-def findLocationInfo(srchstring, ddb=None, statdets=None):
- if statdets is None:
- statdets = loadLocationDetails(ddb=ddb)
- statdets = statdets[statdets.active==1]
- s1 = statdets[statdets.stationid.str.contains(srchstring)]
- s2 = statdets[statdets.eMail.str.contains(srchstring)]
- s3 = statdets[statdets.humanName.str.contains(srchstring)]
- s4 = statdets[statdets.site.str.contains(srchstring)]
- srchres = pd.concat([s1, s2, s3, s4])
- srchres.drop(columns=['oldcode','active','camtype'], inplace=True)
- return srchres
-
-
-def cameraExists(stationid=None, location=None, direction=None, ddb=None, statdets=None):
- if statdets is None:
- statdets = loadLocationDetails(ddb=ddb)
- statdets = statdets[statdets.active==1]
- if stationid:
- if len(statdets[statdets.stationid == stationid]) > 0:
- return True
- if location and direction:
- s1 = statdets[statdets.site == location]
- if len(s1) > 0:
- if len(s1[s1.direction == direction]) > 0:
- return True
- return False
-
-
-def dumpCamTable(outdir, statdets=None, ddb=None, exportmindets=False):
- if statdets is None:
- statdets = loadLocationDetails(ddb=ddb)
- statdets = statdets[statdets.active==1]
- if exportmindets:
- statdets = statdets[['stationid', 'eMail']]
- statdets.to_csv(os.path.join(outdir,'camtable.csv'), index=False)
-
-
-def getCamUpdateDate(camid, ddb=None):
- if not ddb:
- ddb = boto3.resource('dynamodb', region_name='eu-west-2')
- table = ddb.Table('LiveBrightness')
- resp = table.query(KeyConditionExpression=Key('camid').eq(camid),
- IndexName = 'camid-CaptureNight-index',
- ScanIndexForward=False,
- Limit=1,
- Select='SPECIFIC_ATTRIBUTES',
- ProjectionExpression='CaptureNight')
- if len(resp['Items']) > 0:
- return int(resp['Items'][0]['CaptureNight'])
- else:
- return 0
-
-
-class srcResBox(tk.Toplevel):
- '''
- A class for the search dialog
- '''
- def __init__(self, title, message):
- tk.Toplevel.__init__(self)
- self.details_expanded = False
- self.title(title)
- self.geometry('600x250')
- self.minsize(700, 250)
- self.maxsize(700, 550)
- self.rowconfigure(0, weight=0)
- self.rowconfigure(1, weight=1)
- self.columnconfigure(0, weight=1)
-
- button_frame = tk.Frame(self)
- button_frame.grid(row=0, column=0, sticky='nsew')
- button_frame.columnconfigure(0, weight=1)
- button_frame.columnconfigure(1, weight=1)
-
- text_frame = tk.Frame(self)
- text_frame.grid(row=1, column=0, padx=(7, 7), pady=(7, 7), sticky='nsew')
- text_frame.rowconfigure(0, weight=1)
- text_frame.columnconfigure(0, weight=1)
-
- self.textbox = tk.Text(text_frame, height=6)
- self.textbox.insert('1.0', message)
- self.textbox.grid(row=0, column=0, sticky='nsew')
- self.geometry('700x550')
- self.details_expanded = True
-
-
-class infoDialog(simpledialog.Dialog):
- '''
- A class to gather or display info on a camera
- '''
- def __init__(self, parent, title, location, user, email, sshkey='', id=''):
- self.data = []
- self.data.append(id)
- self.data.append(location)
- self.data.append('')
- self.data.append(user)
- self.data.append(email)
- self.data.append(sshkey)
- self.parent = parent
-
- super().__init__(parent, title)
-
- def body(self, frame):
- self.camid_label = tk.Label(frame, width=25, text="RMS ID")
- self.camid_label.pack()
- self.camid_box = tk.Entry(frame, width=25)
- self.camid_box.insert(tk.END, self.data[0])
- self.camid_box.pack()
-
- self.location_label = tk.Label(frame, width=25, text="Location")
- self.location_label.pack()
- self.location_box = tk.Entry(frame, width=25)
- self.location_box.insert(tk.END, self.data[1])
- self.location_box.pack()
-
- self.direction_label = tk.Label(frame, width=25, text="direction")
- self.direction_label.pack()
- self.direction_box = tk.Entry(frame, width=25)
- self.direction_box.pack()
-
- self.ownername_label = tk.Label(frame, width=25, text="owner name")
- self.ownername_label.pack()
- self.ownername_box = tk.Entry(frame, width=25)
- self.ownername_box.insert(tk.END, self.data[3])
- self.ownername_box.pack()
-
- self.email_label = tk.Label(frame, width=25, text="email address")
- self.email_label.pack()
- self.email_box = tk.Entry(frame, width=25)
- self.email_box.insert(tk.END, self.data[4])
- self.email_box.pack()
-
- self.sshkey_label = tk.Label(frame, width=25, text="SSH key")
- self.sshkey_label.pack()
- self.sshkey_box = tk.Entry(frame, width=50)
- self.sshkey_box.insert(tk.END, self.data[5])
- self.sshkey_box.pack()
-
- def ok_pressed(self):
- self.data[0] = self.camid_box.get().strip()
- self.data[1] = self.location_box.get().strip().capitalize()
- self.data[2] = self.direction_box.get().strip().upper()
- self.data[3] = self.ownername_box.get().strip()
- self.data[4] = self.email_box.get().strip()
- self.data[5] = self.sshkey_box.get().strip()
- if cameraExists(location=self.data[1],direction=self.data[2], statdets=self.parent.stationdetails):
- msg = f'{self.data[1]}_{self.data[2]} already exists'
- tk.messagebox.showinfo(title="Information", message=msg)
- else:
- self.destroy()
-
- def cancel_pressed(self):
- self.data[0] = ''
- self.destroy()
-
- def buttonbox(self):
- self.ok_button = tk.Button(self, text='OK', width=5, command=self.ok_pressed)
- self.ok_button.pack(side="left")
- cancel_button = tk.Button(self, text='Cancel', width=5, command=self.cancel_pressed)
- cancel_button.pack(side="right")
- self.bind(" |