Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/development' into development
Browse files Browse the repository at this point in the history
  • Loading branch information
servilla committed Sep 5, 2024
2 parents 4355aca + 702cdf4 commit 44ae98d
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 53 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/gatekeeper-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.11
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: '3.11'
python-version: '3.12'
- name: Add conda to system path
run: |
# $CONDA is an environment variable pointing to the root of the miniconda directory
echo $CONDA/bin >> $GITHUB_PATH
- name: Install dependencies
run: |
conda install -y python=3.11
conda install -y python=3.12
conda env update --file environment-min.yml --name base
- name: Lint with flake8
run: |
Expand Down
16 changes: 2 additions & 14 deletions deployment/gatekeeper.logrotate
Original file line number Diff line number Diff line change
@@ -1,19 +1,7 @@
/home/pasta/Gatekeeper/*.log {
monthly
missingok
rotate 6
compress
delaycompress
notifempty
sharedscripts
postrotate
systemctl reload gatekeeper.service
endscript
}
/home/pasta/Gatekeeper/webapp/gatekeeper.log {
/var/log/pasta/*.log {
daily
missingok
rotate 24
rotate 28
compress
delaycompress
notifempty
Expand Down
11 changes: 8 additions & 3 deletions deployment/gatekeeper.service
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ Description=gunicorn uvicorn service for PASTA Gatekeeper
After=syslog.target

[Service]
User=pasta
Group=www-data
WorkingDirectory=/home/pasta/Gatekeeper/webapp
Environment="PATH=/home/pasta/miniconda3/envs/gatekeeper/bin"

ExecStart=/home/pasta/miniconda3/envs/gatekeeper/bin/gunicorn \
-b <HOST_IP:PORT> \
-w 8 \
Expand All @@ -13,8 +18,8 @@ ExecStart=/home/pasta/miniconda3/envs/gatekeeper/bin/gunicorn \
--max-requests 100 \
--max-requests-jitter 10 \
--log-level info \
--access-logfile /home/pasta/Gatekeeper/gunicorn.log \
--error-logfile /home/pasta/Gatekeeper/gunicorn-error.log \
--access-logfile /var/log/pasta/gunicorn.log \
--error-logfile /var/log/gunicorn-error.log \
--user pasta

ExecReload=/bin/kill -s HUP $MAINPID
Expand All @@ -23,7 +28,7 @@ TimeoutStopSec=5
PrivateTmp=true

# Requires systemd version 211 or newer
RuntimeDirectory=/home/pasta/Gatekeeper/webapp
RuntimeDirectory=gatekeeper
Restart=always
Type=notify
NotifyAccess=all
Expand Down
2 changes: 1 addition & 1 deletion environment-min.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ channels:
dependencies:
- daiquiri
- uvicorn
- python=3.11
- python=3.12
- pytest
- httpx
- black
Expand Down
30 changes: 15 additions & 15 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: gatekeeper
name: gatekeeper-dev
channels:
- conda-forge
- defaults
Expand All @@ -7,7 +7,7 @@ dependencies:
- _openmp_mutex=4.5
- annotated-types=0.7.0
- anyio=4.4.0
- black=24.4.2
- black=24.8.0
- bzip2=1.0.8
- ca-certificates=2024.7.4
- certifi=2024.7.4
Expand All @@ -18,10 +18,10 @@ dependencies:
- email-validator=2.2.0
- email_validator=2.2.0
- exceptiongroup=1.2.2
- fastapi=0.112.0
- fastapi=0.112.1
- fastapi-cli=0.0.5
- gmp=6.3.0
- gunicorn=22.0.0
- gunicorn=23.0.0
- h11=0.14.0
- h2=4.1.0
- hpack=4.0.0
Expand Down Expand Up @@ -59,28 +59,28 @@ dependencies:
- pydantic-core=2.20.1
- pygments=2.18.0
- pytest=8.3.2
- python=3.11.9
- python=3.12.5
- python-dateutil=2.9.0
- python-json-logger=2.0.7
- python-multipart=0.0.9
- python_abi=3.11
- python_abi=3.12
- readline=8.2
- rich=13.7.1
- setuptools=72.1.0
- setuptools=72.2.0
- shellingham=1.5.4
- six=1.16.0
- sniffio=1.3.1
- starlette=0.37.2
- time-machine=2.14.2
- starlette=0.38.2
- time-machine=2.15.0
- tk=8.6.13
- tomli=2.0.1
- typer=0.12.3
- typer-slim=0.12.3
- typer-slim-standard=0.12.3
- typer=0.12.4
- typer-slim=0.12.4
- typer-slim-standard=0.12.4
- typing-extensions=4.12.2
- typing_extensions=4.12.2
- tzdata=2024a
- uvicorn=0.30.4
- wheel=0.43.0
- uvicorn=0.30.6
- wheel=0.44.0
- xz=5.2.6
prefix: /home/pasta/miniconda3/envs/gatekeeper
prefix: /home/servilla/miniconda3/envs/gatekeeper-dev
20 changes: 10 additions & 10 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
annotated-types==0.7.0
anyio==4.4.0
black==24.4.2
black==24.8.0
certifi==2024.7.4
click==8.1.7
colorama==0.4.6
daiquiri==3.0.0
dnspython==2.6.1
email_validator==2.2.0
exceptiongroup==1.2.2
fastapi==0.112.0
fastapi==0.112.1
fastapi-cli==0.0.5
gunicorn==22.0.0
gunicorn==23.0.0
h11==0.14.0
h2==4.1.0
hpack==4.0.0
Expand Down Expand Up @@ -39,15 +39,15 @@ python-dateutil==2.9.0
python-json-logger==2.0.7
python-multipart==0.0.9
rich==13.7.1
setuptools==72.1.0
setuptools==72.2.0
shellingham==1.5.4
six==1.16.0
sniffio==1.3.1
starlette==0.37.2
time-machine==2.14.2
starlette==0.38.2
time-machine==2.15.0
tomli==2.0.1
typer==0.12.3
typer-slim==0.12.3
typer==0.12.4
typer-slim==0.12.4
typing_extensions==4.12.2
uvicorn==0.30.4
wheel==0.43.0
uvicorn==0.30.6
wheel==0.44.0
8 changes: 5 additions & 3 deletions webapp/config.py.template
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,15 @@
3/28/23
"""
import logging
import pathlib


class Config:

# Logging
LOG_PATH = pathlib.Path("<PATH TO PROJECT ROOT>")
LOG_LEVEL = logging.WARN

# PASTA+ authentication token attributes
PUBLIC = "public"
SYSTEM = "https://pasta.edirepository.org/authentication"
Expand All @@ -41,8 +46,5 @@ class Config:
# Static directory path
STATIC = "<PATH TO PROJECT ROOT>/static"

# Logging level
LEVEL = logging.INFO

# Proxy timeout (seconds)
TIMEOUT = 120.0
13 changes: 9 additions & 4 deletions webapp/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,15 @@
from filter import audit
from views import index

cwd = os.path.dirname(os.path.realpath(__file__))
logfile = cwd + "/gatekeeper.log"
daiquiri.setup(level=Config.LEVEL,
outputs=(daiquiri.output.File(logfile), "stdout",))

daiquiri.setup(
level=Config.LOG_LEVEL,
outputs=(
daiquiri.output.File(Config.LOG_PATH / "gatekeeper.log"),
'stdout',
),
)

logger = daiquiri.getLogger(__name__)


Expand Down

0 comments on commit 44ae98d

Please sign in to comment.