diff --git a/CHANGELOG.md b/CHANGELOG.md index 995a835..1b0f801 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## Latest + +- [Improvement] Make it possible to configure the notes service hostname + ## 3.3.10 (2019-05-15) - [Bugfix] Fix boolean configuration choices diff --git a/docs/configuration.rst b/docs/configuration.rst index eb1ce0d..65e48a5 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -168,6 +168,7 @@ Student notes ************* - ``ACTIVATE_NOTES`` (default: ``false``) +- ``NOTES_HOST`` (default: ``notes.{{ LMS_HOST }}``) With `notes `_, students can annotate portions of the courseware. @@ -176,6 +177,8 @@ With `notes `` domain name should be activated and point to your server. For instance, if your LMS is hosted at http://myopenedx.com, the notes service should be found at http://notes.myopenedx.com. +If you would like to host the notes service at a different domain name, you can set the ``NOTES_HOST`` configuration variable. In particular, in development you should set this configuration variable to ``notes.localhost`` in order to be able to access the notes service from the LMS. Otherwise you will get a "Sorry, we could not search the store for annotations" error. + Xqueue ****** diff --git a/tutor/templates/apps/nginx/extra.conf b/tutor/templates/apps/nginx/extra.conf index 9e8c955..5a91c65 100644 --- a/tutor/templates/apps/nginx/extra.conf +++ b/tutor/templates/apps/nginx/extra.conf @@ -5,7 +5,7 @@ upstream notes-backend { {% if ACTIVATE_HTTPS %} server { - server_name notes.{{ LMS_HOST }}; + server_name {{ NOTES_HOST }}; listen 80; return 301 https://$server_name$request_uri; } @@ -13,11 +13,11 @@ server { server { {% if ACTIVATE_HTTPS %}listen 443 {{ "" if WEB_PROXY else "ssl" }};{% else %}listen 80;{% endif %} - server_name notes.localhost notes.{{ LMS_HOST }}; + server_name notes.localhost {{ NOTES_HOST }}; {% if ACTIVATE_HTTPS and not WEB_PROXY %} - ssl_certificate /etc/letsencrypt/live/notes.{{ LMS_HOST }}/fullchain.pem; - ssl_certificate_key /etc/letsencrypt/live/notes.{{ LMS_HOST }}/privkey.pem; + ssl_certificate /etc/letsencrypt/live/{{ NOTES_HOST }}/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/{{ NOTES_HOST }}/privkey.pem; {% endif %} # Disables server version feedback on pages and in headers diff --git a/tutor/templates/apps/notes/settings/tutor.py b/tutor/templates/apps/notes/settings/tutor.py index cbf21e1..63ee1de 100644 --- a/tutor/templates/apps/notes/settings/tutor.py +++ b/tutor/templates/apps/notes/settings/tutor.py @@ -6,7 +6,7 @@ ALLOWED_HOSTS = [ "notes", "notes.openedx", "notes.localhost", - "notes.{{ LMS_HOST }}", + "{{ NOTES_HOST }}", ] DATABASES = { diff --git a/tutor/templates/apps/openedx/config/lms.env.json b/tutor/templates/apps/openedx/config/lms.env.json index 490d303..544c573 100644 --- a/tutor/templates/apps/openedx/config/lms.env.json +++ b/tutor/templates/apps/openedx/config/lms.env.json @@ -39,7 +39,7 @@ "EMAIL_PORT": {{ SMTP_PORT }}, "HTTPS": "{{ "on" if ACTIVATE_HTTPS else "off" }}", {% if ACTIVATE_NOTES %} - "EDXNOTES_PUBLIC_API": "{{ "https" if ACTIVATE_HTTPS else "http" }}://notes.{{ LMS_HOST }}/api/v1", + "EDXNOTES_PUBLIC_API": "{{ "https" if ACTIVATE_HTTPS else "http" }}://{{ NOTES_HOST }}/api/v1", "EDXNOTES_INTERNAL_API": "http://notes.openedx:8000/api/v1", {% endif %} "LANGUAGE_CODE": "{{ LANGUAGE_CODE }}", diff --git a/tutor/templates/config-defaults.yml b/tutor/templates/config-defaults.yml index de59a35..e1cd393 100644 --- a/tutor/templates/config-defaults.yml +++ b/tutor/templates/config-defaults.yml @@ -41,6 +41,7 @@ MYSQL_HOST: "mysql" MYSQL_PORT: 3306 NGINX_HTTP_PORT: 80 NGINX_HTTPS_PORT: 443 +NOTES_HOST: "notes.{{ LMS_HOST }}" NOTES_MYSQL_DATABASE: "notes" NOTES_MYSQL_USERNAME: "notes" RABBITMQ_HOST: "rabbitmq" diff --git a/tutor/templates/k8s/ingress.yml b/tutor/templates/k8s/ingress.yml index 04d5358..09dc736 100644 --- a/tutor/templates/k8s/ingress.yml +++ b/tutor/templates/k8s/ingress.yml @@ -6,7 +6,7 @@ metadata: spec: rules: {% set hosts = [LMS_HOST, "preview." + LMS_HOST, CMS_HOST] %} - {% if ACTIVATE_NOTES %}{% set hosts = hosts + ["notes." + LMS_HOST] %}{% endif %} + {% if ACTIVATE_NOTES %}{% set hosts = hosts + [NOTES_HOST] %}{% endif %} {% for host in hosts %} - host: {{ host }} http: diff --git a/tutor/templates/local/proxy/apache2/openedx.conf b/tutor/templates/local/proxy/apache2/openedx.conf index b6e60ab..fb81d11 100644 --- a/tutor/templates/local/proxy/apache2/openedx.conf +++ b/tutor/templates/local/proxy/apache2/openedx.conf @@ -27,14 +27,14 @@ {% if ACTIVATE_NOTES %} - ServerName notes.{{ LMS_HOST }} + ServerName {{ NOTES_HOST }} Redirect / https://notes.{{ CMS_HOST }}/ - ServerName notes.{{ LMS_HOST }} + ServerName {{ NOTES_HOST }} SSLEngine on - SSLCertificateFile /etc/letsencrypt/live/notes.{{ LMS_HOST }}/fullchain.pem - SSLCertificateKeyFile /etc/letsencrypt/live/notes.{{ LMS_HOST }}/privkey.pem + SSLCertificateFile /etc/letsencrypt/live/{{ NOTES_HOST }}/fullchain.pem + SSLCertificateKeyFile /etc/letsencrypt/live/{{ NOTES_HOST }}/privkey.pem ProxyPreserveHost On ProxyRequests On @@ -45,7 +45,7 @@ {% else %} ServerName {{ LMS_HOST }} - ServerAlias preview.{{ LMS_HOST }} {{ CMS_HOST }} {% if ACTIVATE_NOTES %}notes.{{ LMS_HOST }}{% endif %} + ServerAlias preview.{{ LMS_HOST }} {{ CMS_HOST }} {% if ACTIVATE_NOTES %}{{ NOTES_HOST }}{% endif %} ProxyPreserveHost On ProxyRequests On diff --git a/tutor/templates/local/proxy/nginx/openedx.conf b/tutor/templates/local/proxy/nginx/openedx.conf index d9f2949..478f410 100644 --- a/tutor/templates/local/proxy/nginx/openedx.conf +++ b/tutor/templates/local/proxy/nginx/openedx.conf @@ -36,7 +36,7 @@ server { {% if ACTIVATE_NOTES %} server { listen 80; - server_name notes.{{ LMS_HOST }}; + server_name {{ NOTES_HOST }}; server_tokens off; location / { @@ -51,10 +51,10 @@ server { {% if ACTIVATE_HTTPS %} server { listen 443 ssl; - server_name notes.{{ LMS_HOST }}; + server_name {{ NOTES_HOST }}; - ssl_certificate /etc/letsencrypt/live/notes.{{ LMS_HOST }}/fullchain.pem; - ssl_certificate_key /etc/letsencrypt/live/notes.{{ LMS_HOST }}/privkey.pem; + ssl_certificate /etc/letsencrypt/live/{{ NOTES_HOST }}/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/{{ NOTES_HOST }}/privkey.pem; server_tokens off; location / { diff --git a/tutor/templates/scripts/https_create.sh b/tutor/templates/scripts/https_create.sh index 0a674e8..233e9a9 100644 --- a/tutor/templates/scripts/https_create.sh +++ b/tutor/templates/scripts/https_create.sh @@ -1,2 +1,2 @@ certbot certonly --standalone -n --agree-tos -m admin@{{ LMS_HOST }} -d {{ LMS_HOST }} -d {{ CMS_HOST }} -d preview.{{ LMS_HOST }} -{% if ACTIVATE_NOTES %}certbot certonly --standalone -n --agree-tos -m admin@{{ LMS_HOST }} -d notes.{{ LMS_HOST }}{% endif %} +{% if ACTIVATE_NOTES %}certbot certonly --standalone -n --agree-tos -m admin@{{ LMS_HOST }} -d {{ NOTES_HOST }}{% endif %}