Skip to content

Commit

Permalink
Merge pull request #14 from OpenLXP/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
KarenAJ authored Oct 23, 2024
2 parents d78a8b8 + 1d18f6f commit bcf90dc
Show file tree
Hide file tree
Showing 11 changed files with 75 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cd-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
docker network create openlxp
echo "Docker network successfully created"
echo "Running coverage unit test"
docker-compose --env-file ./.env run app_xia_coursera sh -c "python manage.py waitdb && coverage run manage.py test --tag=unit && flake8 && coverage report && coverage report --fail-under=80"
docker compose --env-file ./.env run app_xia_coursera sh -c "python manage.py waitdb && coverage run manage.py test --tag=unit && flake8 && coverage report && coverage report --fail-under=80"
# sonarcloud:
# name: SonarCloud
Expand Down
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
FROM python:3.9-buster

# install nginx
RUN apt-get update && apt-get install nginx vim libxml2-dev libxmlsec1-dev clamav-daemon clamav-freshclam clamav-unofficial-sigs -y --no-install-recommends && \
apt-get clean
RUN apt-get update && apt-get install nginx vim libxml2-dev libxmlsec1-dev clamav-daemon clamav-freshclam clamav-unofficial-sigs -y --no-install-recommends
COPY nginx.default /etc/nginx/sites-available/default
RUN ln -sf /dev/stdout /var/log/nginx/access.log \
&& ln -sf /dev/stderr /var/log/nginx/error.log
Expand Down
12 changes: 12 additions & 0 deletions app/core/fixtures/openlxp_notification_email.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[
{
"model": "openlxp_notifications.email",
"pk": 1,
"fields": {
"sender": "[email protected]",
"reference": "Status_update",
"subject": 1,
"template_type": 1
}
}
]
9 changes: 9 additions & 0 deletions app/core/fixtures/openlxp_notification_subject.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[
{
"model": "openlxp_notifications.subject",
"pk": 1,
"fields": {
"subject": "OpenLXP Conformance Alerts"
}
}
]
11 changes: 11 additions & 0 deletions app/core/fixtures/openlxp_notification_template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[
{
"model": "openlxp_notifications.template",
"pk": 1,
"fields": {
"template_type": "edlm-status-update",
"message": "Hi {name:} !!<br></br><br></br>\r\n \r\nWe wanted to let you know there’s a status update in the Enterprise Course Catalog (ECC) as of {datetime:} in the component you manage. Since you’re a Point of Contact for ECC, we’re keeping you in the loop.<br></br><br></br>\r\n \r\nPlease check the EDLM ECC logs for details 📋.<br></br><br></br>\r\n \r\nThanks for your support!<br></br>\r\n \r\nThe EDLM Team",
"template_inputs": null
}
}
]
2 changes: 1 addition & 1 deletion app/core/tasks.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import logging

from celery import shared_task
from openlxp_P1_notification.management.commands.trigger_status_update import \
from openlxp_notifications.management.commands.trigger_status_update import \
Command as conformance_alerts_Command
from openlxp_xia.management.commands.load_supplemental_metadata import \
Command as load_supplemental_Command
Expand Down
8 changes: 6 additions & 2 deletions app/openlxp_xia_coursera_project/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,26 @@
'core',
'openlxp_xia',
'openlxp_notifications',
'openlxp_P1_notification',
# 'openlxp_P1_notification',
'django_celery_beat',
'django_celery_results',
'health_check',
]

MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'openlxp_P1_notification.middleware.TemplateMiddleware',
# 'openlxp_P1_notification.middleware.TemplateMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

SECURE_SSL_REDIRECT = True
SECURE_REDIRECT_EXEMPT = ['health/', 'api/health/']

ROOT_URLCONF = 'openlxp_xia_coursera_project.urls'

TEMPLATES = [
Expand Down
7 changes: 4 additions & 3 deletions app/openlxp_xia_coursera_project/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@

admin.autodiscover_modules()
urlpatterns = [
path('admin/', admin.site.urls),
path('api/', include('api.urls')),

path('admin/', admin.site.urls),
path('api/', include('api.urls')),
path('health/', include('health_check.urls'),
name='health_check')
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
10 changes: 5 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ services:
build:
context: .
ports:
- "8000:8020"
- "8010:8020"
command: >
sh -c ". /opt/app/start-app.sh"
sh -c ". /tmp/app/start-app.sh"
environment:
DB_NAME: "${DB_NAME}"
DB_USER: "${DB_USER}"
Expand All @@ -43,7 +43,7 @@ services:
COOKIE_NAME: "${COOKIE_NAME}"
COOKIE_VALUE: "${COOKIE_VALUE}"
volumes:
- ./app:/opt/app/openlxp-xia-coursera
- ./app:/tmp/app/openlxp-xia-coursera
depends_on:
- db_xia_coursera
networks:
Expand All @@ -59,7 +59,7 @@ services:
context: .
command: celery -A openlxp_xia_coursera_project worker -l info --pool=solo
volumes:
- ./app:/opt/app/openlxp-xia-coursera
- ./app:/tmp/app/openlxp-xia-coursera
environment:
REQUESTS_CA_BUNDLE: '/etc/ssl/certs/ca-certificates.pem'
AWS_CA_BUNDLE: '/etc/ssl/certs/ca-certificates.pem'
Expand All @@ -78,7 +78,7 @@ services:
context: .
command: celery -A openlxp_xia_coursera_project beat --scheduler django_celery_beat.schedulers:DatabaseScheduler --loglevel=info --pidfile=/tmp/celerybeat.pid
volumes:
- ./app:/opt/app/openlxp-xia-coursera
- ./app:/tmp/app/openlxp-xia-coursera
environment:
REQUESTS_CA_BUNDLE: '/etc/ssl/certs/ca-certificates.pem'
AWS_CA_BUNDLE: '/etc/ssl/certs/ca-certificates.pem'
Expand Down
36 changes: 21 additions & 15 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
bleach==6.0.0

boto3~=1.20.24

botocore~=1.23.45
Expand All @@ -6,25 +8,31 @@ celery>=5.2.0, <5.2.3

clamd==1.0.2

confusable_homoglyphs==3.2.0

coverage>=5.5,<6.0

ddt~=1.4.2 , <1.5.0

Django>=3.2.3,<4.0.0
django-admin-interface>=0.28.3

django-celery-beat >=2.2.1, <2.3.0

django-celery-results >=2.2.0, <2.3.0

django-colorfield>=0.11.0

django-health-check>3.18.0, <3.19.0

django-model-utils>=4.1.1,<4.2.0

django-mysql>=4.4.0,<4.5.0

djangorestframework>=3.13.0,<3.13.1

django-ses>=2.2.0 , <2.3.1

isort>=5.11.0, <5.12.0
Django>=3.2.3,<4.0.0

djangorestframework>=3.13.0,<3.13.1

flake8>=3.9.0,<4.0.1

Expand All @@ -34,15 +42,17 @@ fsspec>=2022.1.0

gunicorn>=20.1.0,<20.2.0

isort>=5.11.0, <5.12.0

martor>=1.6.0,<1.6.10

mysql-connector-python >= 8.0.28, <=8.0.29

numpy>=1.21.1
numpy==1.26.4

openlxp-notification >=1.3.2, <1.3.3
openlxp-notification >=1.4.4, <1.5.0

openlxp-P1-notification ==0.0.3
# openlxp-P1-notification ==0.0.3

openlxp-xia >=1.4.11, <1.5.0

Expand All @@ -54,6 +64,8 @@ Pillow >=10.2.0

python-magic >=0.4.27, <0.5

python-slugify>=8.0.1

pytz >=2021.1, <2021.3

redis==4.1.2
Expand All @@ -62,12 +74,6 @@ redis==4.1.2

s3fs==0.4.2

xlrd >=2.0.1 , <2.1.0

django-admin-interface>=0.28.3

django-colorfield>=0.11.0

python-slugify>=8.0.1

text-unidecode>=1.3

xlrd >=2.0.1 , <2.1.0
5 changes: 4 additions & 1 deletion start-app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ python manage.py waitdb
python manage.py migrate
python manage.py createcachetable
python manage.py loaddata admin_theme_data.json
python manage.py loaddata openlxp_email.json
python manage.py loaddata openlxp_email.json
python manage.py loaddata openlxp_notification_template.json
python manage.py loaddata openlxp_notification_subject.json
python manage.py loaddata openlxp_notification_email.json
cd /tmp/app/
if [ -n "$TMP_SOURCE_DIR" ] ; then
(cd openlxp-xia-coursera; install -d -o www-data -p $TMP_SOURCE_DIR)
Expand Down

0 comments on commit bcf90dc

Please sign in to comment.