Skip to content

Commit

Permalink
feat: add templates with tutor14 support (eduNEXT#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
mariajgrimaldi authored Oct 18, 2022
1 parent 0382752 commit cc392bb
Show file tree
Hide file tree
Showing 39 changed files with 2,261 additions and 0 deletions.
62 changes: 62 additions & 0 deletions drydock/templates/kustomized/tutor14/base/apps/caddy/Caddyfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Global configuration
{
{{ patch("caddyfile-global")|indent(4) }}
}

# proxy directive snippet (with logging) to be used as follows:
#
# import proxy "containername:port"
(proxy) {
log {
output stdout
format filter {
wrap json
fields {
common_log delete
request>headers delete
resp_headers delete
tls delete
}
}
}

reverse_proxy {args.0} {
header_up X-Forwarded-Port {{ 443 if ENABLE_HTTPS else 80 }}
}
}

{{ LMS_HOST }}{$default_site_port}, {{ PREVIEW_LMS_HOST }}{$default_site_port} {
@favicon_matcher {
path_regexp ^/favicon.ico$
}
rewrite @favicon_matcher /theming/asset/images/favicon.ico

# Limit profile image upload size
request_body /api/profile_images/*/*/upload {
max_size 1MB
}
request_body {
max_size 4MB
}

import proxy "lms:8000"

{{ patch("caddyfile-lms")|indent(4) }}
}

{{ CMS_HOST }}{$default_site_port} {
@favicon_matcher {
path_regexp ^/favicon.ico$
}
rewrite @favicon_matcher /theming/asset/images/favicon.ico

request_body {
max_size 250MB
}

import proxy "cms:8000"

{{ patch("caddyfile-cms")|indent(4) }}
}

{{ patch("caddyfile") }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
SITE_NAME: "{{ CMS_HOST }}"
BOOK_URL: ""
LOG_DIR: "/openedx/data/logs"
LOGGING_ENV: "sandbox"
OAUTH_OIDC_ISSUER: "{{ JWT_COMMON_ISSUER }}"
PLATFORM_NAME: "{{ PLATFORM_NAME }}"
FEATURES:
{{ patch("common-env-features")|indent(2) }}
{{ patch("cms-env-features")|indent(2) }}
CERTIFICATES_HTML_VIEW: true
PREVIEW_LMS_BASE: "{{ PREVIEW_LMS_HOST }}"
ENABLE_COURSEWARE_INDEX: true
ENABLE_CSMH_EXTENDED: false
ENABLE_LEARNER_RECORDS: false
ENABLE_LIBRARY_INDEX: true
MILESTONES_APP: true
ENABLE_PREREQUISITE_COURSES: true
LMS_ROOT_URL: "{{ "https" if ENABLE_HTTPS else "http" }}://{{ LMS_HOST }}"
CMS_ROOT_URL: "{{ "https" if ENABLE_HTTPS else "http" }}://{{ CMS_HOST }}"
CMS_BASE: "{{ CMS_HOST }}"
LMS_BASE: "{{ LMS_HOST }}"
CONTACT_EMAIL: "{{ CONTACT_EMAIL }}"
CELERY_BROKER_TRANSPORT: "redis"
CELERY_BROKER_HOSTNAME: "{{ REDIS_HOST }}:{{ REDIS_PORT }}"
CELERY_BROKER_VHOST: "{{ OPENEDX_CELERY_REDIS_DB }}"
CELERY_BROKER_USER: "{{ REDIS_USERNAME }}"
CELERY_BROKER_PASSWORD: "{{ REDIS_PASSWORD }}"
ALTERNATE_WORKER_QUEUES: "lms"
ENABLE_COMPREHENSIVE_THEMING: true
COMPREHENSIVE_THEME_DIRS: ["/openedx/themes"]
STATIC_ROOT_BASE: "/openedx/staticfiles"
EMAIL_BACKEND: "django.core.mail.backends.smtp.EmailBackend"
EMAIL_HOST: "{{ SMTP_HOST }}"
EMAIL_PORT: {{ SMTP_PORT }}
EMAIL_USE_TLS: {{ "true" if SMTP_USE_TLS else "false" }}
HTTPS: "{{ "on" if ENABLE_HTTPS else "off" }}"
LANGUAGE_CODE: "{{ LANGUAGE_CODE }}"
SESSION_COOKIE_DOMAIN: "{{ CMS_HOST }}"
{{ patch("cms-env") }}
CACHES:
default:
KEY_PREFIX: "default"
VERSION: "1"
BACKEND: "django_redis.cache.RedisCache"
LOCATION: "redis://{% if REDIS_USERNAME and REDIS_PASSWORD %}{{ REDIS_USERNAME }}:{{ REDIS_PASSWORD }}{% endif %}@{{ REDIS_HOST }}:{{ REDIS_PORT }}/{{ OPENEDX_CACHE_REDIS_DB }}"
general:
KEY_PREFIX: "general"
BACKEND: "django_redis.cache.RedisCache"
LOCATION: "redis://{% if REDIS_USERNAME and REDIS_PASSWORD %}{{ REDIS_USERNAME }}:{{ REDIS_PASSWORD }}{% endif %}@{{ REDIS_HOST }}:{{ REDIS_PORT }}/{{ OPENEDX_CACHE_REDIS_DB }}"
mongo_metadata_inheritance:
KEY_PREFIX: "mongo_metadata_inheritance"
TIMEOUT: 300
BACKEND: "django_redis.cache.RedisCache"
LOCATION: "redis://{% if REDIS_USERNAME and REDIS_PASSWORD %}{{ REDIS_USERNAME }}:{{ REDIS_PASSWORD }}{% endif %}@{{ REDIS_HOST }}:{{ REDIS_PORT }}/{{ OPENEDX_CACHE_REDIS_DB }}"
staticfiles:
KEY_PREFIX: "staticfiles_cms"
BACKEND: "django.core.cache.backends.locmem.LocMemCache"
LOCATION: "staticfiles_cms"
configuration:
KEY_PREFIX: "configuration"
BACKEND: "django_redis.cache.RedisCache"
LOCATION: "redis://{% if REDIS_USERNAME and REDIS_PASSWORD %}{{ REDIS_USERNAME }}:{{ REDIS_PASSWORD }}{% endif %}@{{ REDIS_HOST }}:{{ REDIS_PORT }}/{{ OPENEDX_CACHE_REDIS_DB }}"
celery:
KEY_PREFIX: "celery"
TIMEOUT: "7200"
BACKEND: "django_redis.cache.RedisCache"
LOCATION: "redis://{% if REDIS_USERNAME and REDIS_PASSWORD %}{{ REDIS_USERNAME }}:{{ REDIS_PASSWORD }}{% endif %}@{{ REDIS_HOST }}:{{ REDIS_PORT }}/{{ OPENEDX_CACHE_REDIS_DB }}"
course_structure_cache:
KEY_PREFIX: "course_structure"
TIMEOUT: "7200"
BACKEND: "django_redis.cache.RedisCache"
LOCATION: "redis://{% if REDIS_USERNAME and REDIS_PASSWORD %}{{ REDIS_USERNAME }}:{{ REDIS_PASSWORD }}{% endif %}@{{ REDIS_HOST }}:{{ REDIS_PORT }}/{{ OPENEDX_CACHE_REDIS_DB }}"
{% include "apps/openedx/config/partials/auth.yml" %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
SITE_NAME: "{{ LMS_HOST }}"
BOOK_URL: ""
LOG_DIR: "/openedx/data/logs"
LOGGING_ENV: "sandbox"
OAUTH_OIDC_ISSUER: "{{ JWT_COMMON_ISSUER }}"
PLATFORM_NAME: "{{ PLATFORM_NAME }}"
FEATURES:
{{ patch("common-env-features")|indent(2) }}
{{ patch("lms-env-features")|indent(2) }}
CERTIFICATES_HTML_VIEW: true
PREVIEW_LMS_BASE: "{{ PREVIEW_LMS_HOST }}"
ENABLE_CORS_HEADERS: true
ENABLE_COURSE_DISCOVERY: true
ENABLE_COURSEWARE_SEARCH: true
ENABLE_CSMH_EXTENDED: false
ENABLE_DASHBOARD_SEARCH: true
ENABLE_COMBINED_LOGIN_REGISTRATION: true
ENABLE_GRADE_DOWNLOADS: true
ENABLE_LEARNER_RECORDS: false
ENABLE_MOBILE_REST_API: true
ENABLE_OAUTH2_PROVIDER: true
ENABLE_PREREQUISITE_COURSES: true
ENABLE_THIRD_PARTY_AUTH: true
MILESTONES_APP: true
PERSISTENT_GRADES_ENABLED_FOR_ALL_TESTS: true
LMS_ROOT_URL: "{{ "https" if ENABLE_HTTPS else "http" }}://{{ LMS_HOST }}"
CMS_ROOT_URL: "{{ "https" if ENABLE_HTTPS else "http" }}://{{ CMS_HOST }}"
CMS_BASE: "{{ CMS_HOST }}"
LMS_BASE: "{{ LMS_HOST }}"
CONTACT_EMAIL: "{{ CONTACT_EMAIL }}"
CELERY_BROKER_TRANSPORT: "redis"
CELERY_BROKER_HOSTNAME: "{{ REDIS_HOST }}:{{ REDIS_PORT }}"
CELERY_BROKER_VHOST: "{{ OPENEDX_CELERY_REDIS_DB }}"
CELERY_BROKER_USER: "{{ REDIS_USERNAME }}"
CELERY_BROKER_PASSWORD: "{{ REDIS_PASSWORD }}"
ALTERNATE_WORKER_QUEUES: "cms"
ENABLE_COMPREHENSIVE_THEMING: true
COMPREHENSIVE_THEME_DIRS: ["/openedx/themes"]
STATIC_ROOT_BASE: "/openedx/staticfiles"
EMAIL_BACKEND: "django.core.mail.backends.smtp.EmailBackend"
EMAIL_HOST: "{{ SMTP_HOST }}"
EMAIL_PORT: {{ SMTP_PORT }}
EMAIL_USE_TLS: {{ "true" if SMTP_USE_TLS else "false" }}
ACE_ROUTING_KEY: "edx.lms.core.default"
HTTPS: "{{ "on" if ENABLE_HTTPS else "off" }}"
LANGUAGE_CODE: "{{ LANGUAGE_CODE }}"
SESSION_COOKIE_DOMAIN: "{{ LMS_HOST }}"
{{ patch("lms-env") }}
CACHES:
default:
KEY_PREFIX: "default"
VERSION: "1"
BACKEND: "django_redis.cache.RedisCache"
LOCATION: "redis://{% if REDIS_USERNAME and REDIS_PASSWORD %}{{ REDIS_USERNAME }}:{{ REDIS_PASSWORD }}{% endif %}@{{ REDIS_HOST }}:{{ REDIS_PORT }}/{{ OPENEDX_CACHE_REDIS_DB }}"
general:
KEY_PREFIX: "general"
BACKEND: "django_redis.cache.RedisCache"
LOCATION: "redis://{% if REDIS_USERNAME and REDIS_PASSWORD %}{{ REDIS_USERNAME }}:{{ REDIS_PASSWORD }}{% endif %}@{{ REDIS_HOST }}:{{ REDIS_PORT }}/{{ OPENEDX_CACHE_REDIS_DB }}"
mongo_metadata_inheritance:
KEY_PREFIX: "mongo_metadata_inheritance"
TIMEOUT: 300
BACKEND: "django_redis.cache.RedisCache"
LOCATION: "redis://{% if REDIS_USERNAME and REDIS_PASSWORD %}{{ REDIS_USERNAME }}:{{ REDIS_PASSWORD }}{% endif %}@{{ REDIS_HOST }}:{{ REDIS_PORT }}/{{ OPENEDX_CACHE_REDIS_DB }}"
staticfiles:
KEY_PREFIX: "staticfiles_lms"
BACKEND: "django.core.cache.backends.locmem.LocMemCache"
LOCATION: "staticfiles_lms"
configuration:
KEY_PREFIX: "configuration"
BACKEND: "django_redis.cache.RedisCache"
LOCATION: "redis://{% if REDIS_USERNAME and REDIS_PASSWORD %}{{ REDIS_USERNAME }}:{{ REDIS_PASSWORD }}{% endif %}@{{ REDIS_HOST }}:{{ REDIS_PORT }}/{{ OPENEDX_CACHE_REDIS_DB }}"
celery:
KEY_PREFIX: "celery"
TIMEOUT: "7200"
BACKEND: "django_redis.cache.RedisCache"
LOCATION: "redis://{% if REDIS_USERNAME and REDIS_PASSWORD %}{{ REDIS_USERNAME }}:{{ REDIS_PASSWORD }}{% endif %}@{{ REDIS_HOST }}:{{ REDIS_PORT }}/{{ OPENEDX_CACHE_REDIS_DB }}"
course_structure_cache:
KEY_PREFIX: "course_structure"
TIMEOUT: "7200"
BACKEND: "django_redis.cache.RedisCache"
LOCATION: "redis://{% if REDIS_USERNAME and REDIS_PASSWORD %}{{ REDIS_USERNAME }}:{{ REDIS_PASSWORD }}{% endif %}@{{ REDIS_HOST }}:{{ REDIS_PORT }}/{{ OPENEDX_CACHE_REDIS_DB }}"
ora2-storage:
KEY_PREFIX: "ora2-storage"
BACKEND: "django_redis.cache.RedisCache"
LOCATION: "redis://{% if REDIS_USERNAME and REDIS_PASSWORD %}{{ REDIS_USERNAME }}:{{ REDIS_PASSWORD }}{% endif %}@{{ REDIS_HOST }}:{{ REDIS_PORT }}/{{ OPENEDX_CACHE_REDIS_DB }}"
{% include "apps/openedx/config/partials/auth.yml" %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
SECRET_KEY: "{{ OPENEDX_SECRET_KEY }}"
AWS_ACCESS_KEY_ID: "{{ OPENEDX_AWS_ACCESS_KEY }}"
AWS_SECRET_ACCESS_KEY: "{{ OPENEDX_AWS_SECRET_ACCESS_KEY }}"
DOC_STORE_CONFIG: null
{{ patch("openedx-auth") }}
XQUEUE_INTERFACE:
django_auth: null
url: null
DATABASES:
default:
ENGINE: "django.db.backends.mysql"
HOST: "{{ MYSQL_HOST }}"
PORT: {{ MYSQL_PORT }}
NAME: "{{ OPENEDX_MYSQL_DATABASE }}"
USER: "{{ OPENEDX_MYSQL_USERNAME }}"
PASSWORD: "{{ OPENEDX_MYSQL_PASSWORD }}"
ATOMIC_REQUESTS: true
OPTIONS:
init_command: "SET sql_mode='STRICT_TRANS_TABLES'"
EMAIL_HOST_USER: "{{ SMTP_USERNAME }}"
EMAIL_HOST_PASSWORD: "{{ SMTP_PASSWORD }}"
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
import os
from cms.envs.devstack import *

LMS_BASE = "{{ LMS_HOST }}:8000"
LMS_ROOT_URL = "http://" + LMS_BASE

# Authentication
SOCIAL_AUTH_EDX_OAUTH2_KEY = "{{ CMS_OAUTH2_KEY_SSO_DEV }}"
SOCIAL_AUTH_EDX_OAUTH2_PUBLIC_URL_ROOT = LMS_ROOT_URL

FEATURES["PREVIEW_LMS_BASE"] = "{{ PREVIEW_LMS_HOST }}:8000"

{% include "apps/openedx/settings/partials/common_cms.py" %}

# Setup correct webpack configuration file for development
WEBPACK_CONFIG_PATH = "webpack.dev.config.js"

{{ patch("openedx-development-settings") }}
{{ patch("openedx-cms-development-settings") }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
import os
from cms.envs.production import *

{% include "apps/openedx/settings/partials/common_cms.py" %}

ALLOWED_HOSTS = [
ENV_TOKENS.get("CMS_BASE"),
"cms",
]

# Authentication
SOCIAL_AUTH_EDX_OAUTH2_KEY = "{{ CMS_OAUTH2_KEY_SSO }}"
SOCIAL_AUTH_EDX_OAUTH2_PUBLIC_URL_ROOT = "{% if ENABLE_HTTPS %}https{% else %}http{% endif %}://{{ LMS_HOST }}"

{{ patch("openedx-cms-production-settings") }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from cms.envs.test import *

{% include "apps/openedx/settings/partials/common_test.py" %}
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# -*- coding: utf-8 -*-
import os
from lms.envs.devstack import *

{% include "apps/openedx/settings/partials/common_lms.py" %}

# Setup correct webpack configuration file for development
WEBPACK_CONFIG_PATH = "webpack.dev.config.js"

LMS_BASE = "{{ LMS_HOST}}:8000"
LMS_ROOT_URL = "http://{}".format(LMS_BASE)
LMS_INTERNAL_ROOT_URL = LMS_ROOT_URL
SITE_NAME = LMS_BASE
CMS_BASE = "{{ CMS_HOST}}:8001"
CMS_ROOT_URL = "http://{}".format(CMS_BASE)
LOGIN_REDIRECT_WHITELIST.append(CMS_BASE)

# Session cookie
SESSION_COOKIE_DOMAIN = "{{ LMS_HOST }}"
SESSION_COOKIE_SECURE = False
CSRF_COOKIE_SECURE = False
SESSION_COOKIE_SAMESITE = "Lax"

# CMS authentication
IDA_LOGOUT_URI_LIST.append("http://{{ CMS_HOST }}:8001/logout/")

FEATURES['ENABLE_COURSEWARE_MICROFRONTEND'] = False

LOGGING["loggers"]["oauth2_provider"] = {
"handlers": ["console"],
"level": "DEBUG"
}

{{ patch("openedx-development-settings") }}
{{ patch("openedx-lms-development-settings") }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# -*- coding: utf-8 -*-
import os
from lms.envs.production import *

{% include "apps/openedx/settings/partials/common_lms.py" %}

ALLOWED_HOSTS = [
ENV_TOKENS.get("LMS_BASE"),
FEATURES["PREVIEW_LMS_BASE"],
"lms",
]

{% if ENABLE_HTTPS %}
# Properly set the "secure" attribute on session/csrf cookies. This is required in
# Chrome to support samesite=none cookies.
SESSION_COOKIE_SECURE = True
CSRF_COOKIE_SECURE = True
SESSION_COOKIE_SAMESITE = "None"
{% else %}
# When we cannot provide secure session/csrf cookies, we must disable samesite=none
SESSION_COOKIE_SECURE = False
CSRF_COOKIE_SECURE = False
SESSION_COOKIE_SAMESITE = "Lax"
{% endif %}

# CMS authentication
IDA_LOGOUT_URI_LIST.append("{% if ENABLE_HTTPS %}https{% else %}http{% endif %}://{{ CMS_HOST }}/logout/")

# Required to display all courses on start page
SEARCH_SKIP_ENROLLMENT_START_DATE_FILTERING = True

{{ patch("openedx-lms-production-settings") }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from lms.envs.test import *

{% include "apps/openedx/settings/partials/common_test.py" %}
Loading

0 comments on commit cc392bb

Please sign in to comment.