6
0
mirror of https://github.com/ChristianLight/tutor.git synced 2025-01-26 06:28:24 +00:00

Fix forum depends_on when data services are disabled

When both mongodb and elasticsearch were not activated, there was a
syntax error in the local docker-compose.yml file.

Close #266
This commit is contained in:
Régis Behmo 2019-11-22 09:20:17 +01:00
parent 475df37729
commit 993694909a
5 changed files with 10 additions and 7 deletions

View File

@ -4,6 +4,7 @@ Note: Breaking changes between versions are indicated by "💥".
## Unreleased
- [Bugfix] Fix running forum locally when both elasticsearch and mongodb are not activated (#266)
- [Bugfix] Fix MongoDb url in forum when running separate service (#267)
- 💥[Improvement] Better `dev` commands, with dedicated development docker image. One of the consequences is that the `dev watchthemes` command is replaced by `dev run lms watchthemes`.
- [Improvement] `images` commands now accept multiple `image` arguments

View File

@ -1,7 +1,6 @@
import unittest
from tutor import utils
from tutor import serialize
class UtilsTests(unittest.TestCase):
@ -20,3 +19,6 @@ class UtilsTests(unittest.TestCase):
def test_reverse_host(self):
self.assertEqual("com.google.www", utils.reverse_host("www.google.com"))
def test_list_if(self):
self.assertEqual('["cms"]', utils.list_if([("lms", False), ("cms", True)]))

View File

@ -33,6 +33,7 @@ class Renderer:
)
environment.filters["random_string"] = utils.random_string
environment.filters["common_domain"] = utils.common_domain
environment.filters["list_if"] = utils.list_if
environment.filters["reverse_host"] = utils.reverse_host
environment.filters["walk_templates"] = walk_templates
environment.globals["TUTOR_VERSION"] = __version__

View File

@ -69,9 +69,7 @@ services:
- ../../data/openedx-media:/var/www/openedx-media:ro
{% if ACTIVATE_HTTPS %}- ../../data/letsencrypt:/etc/letsencrypt/:ro{% endif %}
{{ patch("local-docker-compose-nginx-volumes")|indent(6) }}
depends_on:
{% if ACTIVATE_LMS %}- lms{% endif %}
{% if ACTIVATE_CMS %}- cms {% endif %}
depends_on: {{ [("lms", ACTIVATE_LMS), ("cms", ACTIVATE_CMS)]|list_if }}
{% if ACTIVATE_RABBITMQ %}
rabbitmq:
@ -98,9 +96,7 @@ services:
MONGODB_HOST: "{{ MONGODB_HOST }}"
MONGODB_PORT: "{{ MONGODB_PORT }}"
restart: unless-stopped
depends_on:
{% if ACTIVATE_ELASTICSEARCH %}- elasticsearch{% endif %}
{% if ACTIVATE_MONGODB %}- mongodb{% endif %}
depends_on: {{ [("elasticsearch", ACTIVATE_ELASTICSEARCH), ("mongodb", ACTIVATE_MONGODB)]|list_if }}
{% endif %}
############# LMS and CMS

View File

@ -1,3 +1,4 @@
import json
import os
import random
import shutil
@ -24,6 +25,8 @@ def random_string(length):
[random.choice(string.ascii_letters + string.digits) for _ in range(length)]
)
def list_if(services):
return json.dumps([service[0] for service in services if service[1]])
def common_domain(d1, d2):
"""