Skip to content

Commit

Permalink
Merge pull request #311 from ioos/main
Browse files Browse the repository at this point in the history
update branch from main
  • Loading branch information
leilabbb authored Dec 12, 2023
2 parents 9326d0b + d69e4b4 commit 942dcfc
Show file tree
Hide file tree
Showing 55 changed files with 113 additions and 146 deletions.
16 changes: 0 additions & 16 deletions .github/workflows/shellcheck.yml

This file was deleted.

10 changes: 7 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
# - id: trailing-whitespace
# - id: end-of-file-fixer
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-added-large-files

- repo: https://github.com/codespell-project/codespell
Expand All @@ -17,6 +17,10 @@ repos:
args:
- --ignore-words-list=nd,ot

- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.9.0.6
hooks:
- id: shellcheck

ci:
autofix_commit_msg: |
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@ This is the main repository for the IOOS Glider DAC site, scripts, and tools.

Detailed documentation on contact information, file format, user account registration, deployment registration and file submission can be found on the [IOOS National Glider DAC wiki](https://ioos.github.io/glider-dac/index.html).

Inquires should be sent to glider **dot** dac **dot** support **at** noaa **dot** gov

Inquires should be sent to [email protected]
3 changes: 2 additions & 1 deletion config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ COMMON: &common
REDIS_HOST: localhost
REDIS_PORT: 6379
REDIS_DB: 8
SESSION_PERMANENT: True
SESSION_TYPE: redis

JSON_DIR: '/data/data/priv_erddap/'
path2priv: '/data/data/priv_erddap/'
Expand All @@ -68,4 +70,3 @@ COMMON: &common
DEVELOPMENT: &development
<<: *common
DEBUG: True

1 change: 0 additions & 1 deletion console
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@ from bson import ObjectId

with app.app_context():
embed()

1 change: 0 additions & 1 deletion deploy/dap.supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,3 @@ directory=/home/glider
autostart=true
redirect_stderr=true
stdout_logfile=logs/tunnel.log

1 change: 0 additions & 1 deletion deploy/env
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,3 @@ export RSYNC_TO_PATH='{{ rsync_to_path }}'
export MONGO_URI='{{ mongo_db }}'
export ADMINS='{{ admins }}'
export USER_DB_FILE='{{ user_db_file }}'

1 change: 0 additions & 1 deletion deploy/supervisord-perms-monitor.conf
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,3 @@ stopsignal=TERM
autostart=false
redirect_stderr=true
stdout_logfile=/root/perms-monitor.log

1 change: 0 additions & 1 deletion deploy/supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,3 @@ stopsignal=TERM
autostart=true
redirect_stderr=true
stdout_logfile=logs/db-sync-monitor.log

2 changes: 1 addition & 1 deletion dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
pytest
-r requirements.txt
-r requirements.txt
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ services:
# TODO: THREDDS and ERDDAP will need volume configurations
thredds:
container_name: thredds
image: unidata/thredds-docker:5.3
image: unidata/thredds-docker:5.4
ports:
- 8082:8080
volumes:
Expand All @@ -101,7 +101,7 @@ services:

erddap:
container_name: erddap
image: axiom/docker-erddap
image: axiom/docker-erddap:latest-jdk17-openjdk
ports:
- 8080:8080
deploy:
Expand Down
10 changes: 7 additions & 3 deletions glider_dac/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from flasgger import Swagger, LazyString, LazyJSONEncoder
from flask import Flask, request
from flask_kvsession import KVSessionExtension
from flask_session import Session
from flask_cors import CORS, cross_origin
from flask_wtf import CSRFProtect
from simplekv.memory.redisstore import RedisStore
Expand Down Expand Up @@ -47,16 +47,21 @@
except KeyError:
app.config.update(config_dict["DEVELOPMENT"])

app.secret_key = app.config["SECRET_KEY"]
app.config["SESSION_TYPE"] = "redis"
app.config["SESSION_REDIS"] = redis.from_url(app.config["REDIS_URL"])
Session(app)

import redis
redis_pool = redis.ConnectionPool(host=app.config.get('REDIS_HOST'),
port=app.config.get('REDIS_PORT'),
db=app.config.get('REDIS_DB'))
redis_connection = redis.Redis(connection_pool=redis_pool)
strict_redis = redis.StrictRedis(connection_pool=redis_pool)


store = RedisStore(strict_redis)

KVSessionExtension(store, app)

from rq import Queue
queue = Queue('default', connection=redis_connection)
Expand Down Expand Up @@ -192,4 +197,3 @@ def slugify(value):
# Import everything
import glider_dac.views
import glider_dac.models

2 changes: 0 additions & 2 deletions glider_dac/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,3 @@
MAIL_DEFAULT_SENDER = os.environ.get('MAIL_DEFAULT_SENDER')
MAIL_DEFAULT_TO = os.environ.get('MAIL_DEFAULT_TO')
MAIL_DEFAULT_LIST = os.environ.get('MAIL_DEFAULT_LIST', None)


1 change: 0 additions & 1 deletion glider_dac/development.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
DEBUG = True
LOG_FILE = True

16 changes: 14 additions & 2 deletions glider_dac/glider_emails.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,18 @@
handler.setLevel(logging.INFO)
root_logger.addHandler(handler)


def send_email_wrapper(message):
"""
Email sending function with exceptions to catch and log exceptions
"""
try:
mail.send(message)
except:
app.logger.exception("Exception occurred while attempting to send "
"email: ")


def send_registration_email(username, deployment):
if not app.config.get('MAIL_ENABLED', False): # Mail is disabled
app.logger.info("Email is disabled")
Expand All @@ -43,7 +55,7 @@ def send_registration_email(username, deployment):
thredds_url=get_thredds_catalog_url(),
erddap_url=get_erddap_catalog_url())

mail.send(msg)
send_email_wrapper(msg)

def send_deployment_cchecker_email(user, failing_deployments, attachment_msgs):
if not app.config.get('MAIL_ENABLED', False): # Mail is disabled
Expand All @@ -67,7 +79,7 @@ def send_deployment_cchecker_email(user, failing_deployments, attachment_msgs):
return
msg.body = message

mail.send(msg)
send_email_wrapper(msg)

def get_thredds_catalog_url():
args = {
Expand Down
1 change: 0 additions & 1 deletion glider_dac/models/institution.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,3 @@ class Institution(Document):
'unique': True,
},
]

9 changes: 4 additions & 5 deletions glider_dac/reverse_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
'''
glider_dac.reverse_proxy
Ruthlessly stolen from:
Ruthlessly stolen from:
http://flask.pocoo.org/snippets/35/
'''

class ReverseProxied(object):
'''Wrap the application in this middleware and configure the
front-end server to add these headers, to let you quietly bind
this to a URL other than / and to an HTTP scheme that is
'''Wrap the application in this middleware and configure the
front-end server to add these headers, to let you quietly bind
this to a URL other than / and to an HTTP scheme that is
different than what is used locally.
In nginx:
Expand Down Expand Up @@ -38,4 +38,3 @@ def __call__(self, environ, start_response):
if scheme:
environ['wsgi.url_scheme'] = scheme
return self.app(environ, start_response)

1 change: 0 additions & 1 deletion glider_dac/static/css/bootstrap-sortable.css
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,3 @@ table.sortable thead th:hover:not([data-defaultsort=disabled]) {
table.sortable thead th div.mozilla {
position: relative;
}

2 changes: 1 addition & 1 deletion glider_dac/static/css/bootstrap-theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -381,4 +381,4 @@
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe8e8e8', endColorstr='#fff5f5f5', GradientType=0);
-webkit-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 0 rgba(255, 255, 255, 0.1);
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 0 rgba(255, 255, 255, 0.1);
}
}
Loading

0 comments on commit 942dcfc

Please sign in to comment.