From 970dafe87be7c4d31ffa2a371ccb0f22f2b4d8f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Behmo?= Date: Mon, 7 Dec 2020 09:30:50 +0100 Subject: [PATCH] Upgrade to Koa --- .gitlab-ci.yml | 2 +- setup.py | 2 +- tutorxqueue/__about__.py | 2 +- tutorxqueue/patches/caddyfile | 4 ++++ tutorxqueue/patches/https-create | 1 - tutorxqueue/patches/k8s-ingress-rules | 6 ----- tutorxqueue/patches/k8s-ingress-tls-hosts | 1 - tutorxqueue/patches/nginx-extra | 23 ++----------------- tutorxqueue/plugin.py | 2 +- .../templates/xqueue/apps/settings/tutor.py | 1 - 10 files changed, 10 insertions(+), 34 deletions(-) create mode 100644 tutorxqueue/patches/caddyfile delete mode 100644 tutorxqueue/patches/https-create delete mode 100644 tutorxqueue/patches/k8s-ingress-rules delete mode 100644 tutorxqueue/patches/k8s-ingress-tls-hosts diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a756645..e316bfe 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,7 +3,7 @@ variables: TUTOR_IMAGES: xqueue TUTOR_PYPI_PACKAGE: tutor-xqueue TUTOR_PYPI_PRIVATE_PACKAGE: tutor-xqueue - OPENEDX_RELEASE: juniper + OPENEDX_RELEASE: koa include: - project: 'community/tutor-ci' diff --git a/setup.py b/setup.py index 2406487..5248d72 100644 --- a/setup.py +++ b/setup.py @@ -32,7 +32,7 @@ setup( packages=find_packages(exclude=["tests*"]), include_package_data=True, python_requires=">=3.5", - install_requires=["tutor-openedx>=10.0.0,<11.0.0", "requests"], + install_requires=["tutor-openedx>=11.0.0,<12.0.0", "requests"], entry_points={"tutor.plugin.v0": ["xqueue = tutorxqueue.plugin"]}, classifiers=[ "Development Status :: 3 - Alpha", diff --git a/tutorxqueue/__about__.py b/tutorxqueue/__about__.py index fe0b842..5b46116 100644 --- a/tutorxqueue/__about__.py +++ b/tutorxqueue/__about__.py @@ -1 +1 @@ -__version__ = "10.1.2" +__version__ = "11.0.0" diff --git a/tutorxqueue/patches/caddyfile b/tutorxqueue/patches/caddyfile new file mode 100644 index 0000000..eb9ef4e --- /dev/null +++ b/tutorxqueue/patches/caddyfile @@ -0,0 +1,4 @@ +# Xqueue +{{ XQUEUE_HOST }}{% if not ENABLE_HTTPS %}:80{% endif %} { + reverse_proxy nginx:80 +} \ No newline at end of file diff --git a/tutorxqueue/patches/https-create b/tutorxqueue/patches/https-create deleted file mode 100644 index 9d5d58d..0000000 --- a/tutorxqueue/patches/https-create +++ /dev/null @@ -1 +0,0 @@ -certbot certonly --standalone -n --agree-tos -m admin@{{ LMS_HOST }} -d {{ XQUEUE_HOST }} \ No newline at end of file diff --git a/tutorxqueue/patches/k8s-ingress-rules b/tutorxqueue/patches/k8s-ingress-rules deleted file mode 100644 index 1c5b7c3..0000000 --- a/tutorxqueue/patches/k8s-ingress-rules +++ /dev/null @@ -1,6 +0,0 @@ -- host: {{ XQUEUE_HOST }} - http: - paths: - - backend: - serviceName: nginx - servicePort: {% if ACTIVATE_HTTPS %}443{% else %}80{% endif %} \ No newline at end of file diff --git a/tutorxqueue/patches/k8s-ingress-tls-hosts b/tutorxqueue/patches/k8s-ingress-tls-hosts deleted file mode 100644 index 50e7b1a..0000000 --- a/tutorxqueue/patches/k8s-ingress-tls-hosts +++ /dev/null @@ -1 +0,0 @@ -- {{ XQUEUE_HOST }} \ No newline at end of file diff --git a/tutorxqueue/patches/nginx-extra b/tutorxqueue/patches/nginx-extra index 56d9317..b1aa651 100644 --- a/tutorxqueue/patches/nginx-extra +++ b/tutorxqueue/patches/nginx-extra @@ -3,35 +3,16 @@ upstream xqueue-backend { server xqueue:8000 fail_timeout=0; } -{% if ACTIVATE_HTTPS %} server { - server_name {{ XQUEUE_HOST }}; - listen 80; - return 301 https://$server_name$request_uri; -} -{% endif %} - -server { - {% if ACTIVATE_HTTPS %}listen 443 {{ "" if WEB_PROXY else "ssl" }};{% else %}listen 80;{% endif %} - server_name xqueue.localhost {{ XQUEUE_HOST }}; - - {% if ACTIVATE_HTTPS and not WEB_PROXY %} - ssl_certificate /etc/letsencrypt/live/{{ XQUEUE_HOST }}/fullchain.pem; - ssl_certificate_key /etc/letsencrypt/live/{{ XQUEUE_HOST }}/privkey.pem; - {% endif %} + listen 80; + server_name {{ XQUEUE_HOST }}; # Disables server version feedback on pages and in headers server_tokens off; location / { - {% if not WEB_PROXY %} - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header X-Forwarded-Port $server_port; - proxy_set_header X-Forwarded-For $remote_addr; - {% endif %} proxy_set_header Host $http_host; proxy_redirect off; - proxy_pass http://xqueue-backend; } } \ No newline at end of file diff --git a/tutorxqueue/plugin.py b/tutorxqueue/plugin.py index 1476ddc..f8270ea 100644 --- a/tutorxqueue/plugin.py +++ b/tutorxqueue/plugin.py @@ -114,7 +114,7 @@ class Client: self.base_url = url if not self.base_url: - scheme = "https" if user_config["ACTIVATE_HTTPS"] else "http" + scheme = "https" if user_config["ENABLE_HTTPS"] else "http" host = user_config["XQUEUE_HOST"] self.base_url = "{}://{}".format(scheme, host) self.login() diff --git a/tutorxqueue/templates/xqueue/apps/settings/tutor.py b/tutorxqueue/templates/xqueue/apps/settings/tutor.py index 8131748..103c7bd 100644 --- a/tutorxqueue/templates/xqueue/apps/settings/tutor.py +++ b/tutorxqueue/templates/xqueue/apps/settings/tutor.py @@ -3,7 +3,6 @@ from .settings import * ALLOWED_HOSTS = [ "{{ XQUEUE_HOST }}", "xqueue", - "xqueue.localhost", ] DATABASES = {