From d6af5ef55baa7519a248b003121d20e26e6e8901 Mon Sep 17 00:00:00 2001 From: ChrisChV Date: Tue, 15 Jun 2021 20:15:03 -0500 Subject: [PATCH] feat: FORUM_MONGODB_DATABASE config val added to fix the hardcoded forum database name In config.yml the new value FORUM_MONGO_DB_DATABASE was added with `cs_comments_service` as default value. In docker-entrypoint.sh of forum I changed the hardcoded `cs_commecnts_service` with the new config value. Multiple .yml files changed to handle the new config value. --- CHANGELOG.md | 2 ++ tutor/templates/build/forum/Dockerfile | 1 + tutor/templates/build/forum/bin/docker-entrypoint.sh | 2 +- tutor/templates/config.yml | 1 + tutor/templates/k8s/deployments.yml | 2 ++ tutor/templates/k8s/jobs.yml | 2 ++ tutor/templates/local/docker-compose.jobs.yml | 1 + tutor/templates/local/docker-compose.yml | 1 + 8 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e1f8aa4..6bffb85 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ Note: Breaking changes between versions are indicated by "💥". - [Bugfix] Fix "upstream sent too big header" error during login of existing users after a Koa to Lilac upgrade. - [Feature] Added the ability to skip `config.yml` file modification while running `tutor config save` command with `-e` or `--env-only` flag. +- [Feature] Add new config value `FORUM_MONGODB_DATABASE` to set the forum database name + ## v12.0.0 (2021-06-09) - 💥[Improvement] Upgrade all services to open-release/lilac.master. diff --git a/tutor/templates/build/forum/Dockerfile b/tutor/templates/build/forum/Dockerfile index 33ac5e7..0bbbbd2 100644 --- a/tutor/templates/build/forum/Dockerfile +++ b/tutor/templates/build/forum/Dockerfile @@ -48,5 +48,6 @@ ENV MONGODB_AUTH "" ENV MONGOID_AUTH_MECH "" ENV MONGODB_HOST "mongodb" ENV MONGODB_PORT "27017" +ENV MONGODB_DATABASE "cs_comments_service" EXPOSE 4567 CMD ./bin/unicorn -c config/unicorn_tcp.rb -I '.' diff --git a/tutor/templates/build/forum/bin/docker-entrypoint.sh b/tutor/templates/build/forum/bin/docker-entrypoint.sh index eec93e3..77cd2b0 100755 --- a/tutor/templates/build/forum/bin/docker-entrypoint.sh +++ b/tutor/templates/build/forum/bin/docker-entrypoint.sh @@ -1,6 +1,6 @@ #!/bin/sh -e -export MONGOHQ_URL="mongodb://$MONGODB_AUTH$MONGODB_HOST:$MONGODB_PORT/cs_comments_service" +export MONGOHQ_URL="mongodb://$MONGODB_AUTH$MONGODB_HOST:$MONGODB_PORT/$MONGODB_DATABASE" # the search server variable was renamed after the upgrade to elasticsearch 7 export SEARCH_SERVER_ES7="$SEARCH_SERVER" diff --git a/tutor/templates/config.yml b/tutor/templates/config.yml index ec4ebda..a7495f9 100644 --- a/tutor/templates/config.yml +++ b/tutor/templates/config.yml @@ -41,6 +41,7 @@ ELASTICSEARCH_PORT: 9200 ELASTICSEARCH_SCHEME: "http" ELASTICSEARCH_HEAP_SIZE: 1g FORUM_HOST: "forum" +FORUM_MONGODB_DATABASE: "cs_comments_service" JWT_COMMON_AUDIENCE: "openedx" JWT_COMMON_ISSUER: "{% if ENABLE_HTTPS %}https{% else %}http{% endif %}://{{ LMS_HOST }}/oauth2" JWT_COMMON_SECRET_KEY: "{{ OPENEDX_SECRET_KEY }}" diff --git a/tutor/templates/k8s/deployments.yml b/tutor/templates/k8s/deployments.yml index 8631e32..738ca15 100644 --- a/tutor/templates/k8s/deployments.yml +++ b/tutor/templates/k8s/deployments.yml @@ -153,6 +153,8 @@ spec: value: "{{ MONGODB_HOST }}" - name: MONGODB_PORT value: "{{ MONGODB_PORT }}" + - name: MONGODB_DATABASE + value: "{{ FORUM_MONGODB_DATABASE }}" {% endif %} {% if RUN_LMS %} --- diff --git a/tutor/templates/k8s/jobs.yml b/tutor/templates/k8s/jobs.yml index 810b811..aa2bb70 100644 --- a/tutor/templates/k8s/jobs.yml +++ b/tutor/templates/k8s/jobs.yml @@ -101,6 +101,8 @@ spec: value: "{{ MONGODB_HOST }}" - name: MONGODB_PORT value: "{{ MONGODB_PORT }}" + - name: MONGODB_DATABASE + value: "{{ FORUM_MONGODB_DATABASE }}" {{ patch("k8s-jobs") }} diff --git a/tutor/templates/local/docker-compose.jobs.yml b/tutor/templates/local/docker-compose.jobs.yml index c57bc6c..c5885ac 100644 --- a/tutor/templates/local/docker-compose.jobs.yml +++ b/tutor/templates/local/docker-compose.jobs.yml @@ -36,6 +36,7 @@ services: MONGODB_AUTH: "{% if MONGODB_USERNAME and MONGODB_PASSWORD %}{{ MONGODB_USERNAME}}:{{ MONGODB_PASSWORD }}@{% endif %}" MONGODB_HOST: "{{ MONGODB_HOST }}" MONGODB_PORT: "{{ MONGODB_PORT }}" + MONGODB_DATABASE: "{{ FORUM_MONGODB_DATABASE }}" depends_on: {{ [("elasticsearch", RUN_ELASTICSEARCH), ("mongodb", RUN_MONGODB)]|list_if }} {{ patch("local-docker-compose-jobs-services")|indent(4) }} diff --git a/tutor/templates/local/docker-compose.yml b/tutor/templates/local/docker-compose.yml index 6d9ca61..bab2413 100644 --- a/tutor/templates/local/docker-compose.yml +++ b/tutor/templates/local/docker-compose.yml @@ -69,6 +69,7 @@ services: MONGODB_AUTH: "{% if MONGODB_USERNAME and MONGODB_PASSWORD %}{{ MONGODB_USERNAME}}:{{ MONGODB_PASSWORD }}@{% endif %}" MONGODB_HOST: "{{ MONGODB_HOST }}" MONGODB_PORT: "{{ MONGODB_PORT }}" + MONGODB_DATABASE: "{{ FORUM_MONGODB_DATABASE }}" restart: unless-stopped depends_on: {{ [("elasticsearch", RUN_ELASTICSEARCH), ("mongodb", RUN_MONGODB)]|list_if }} {% endif %}