mirror of
https://github.com/ChristianLight/tutor.git
synced 2025-01-27 23:08: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:
parent
475df37729
commit
993694909a
@ -4,6 +4,7 @@ Note: Breaking changes between versions are indicated by "💥".
|
|||||||
|
|
||||||
## Unreleased
|
## 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)
|
- [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] 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
|
- [Improvement] `images` commands now accept multiple `image` arguments
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from tutor import utils
|
from tutor import utils
|
||||||
from tutor import serialize
|
|
||||||
|
|
||||||
|
|
||||||
class UtilsTests(unittest.TestCase):
|
class UtilsTests(unittest.TestCase):
|
||||||
@ -20,3 +19,6 @@ class UtilsTests(unittest.TestCase):
|
|||||||
|
|
||||||
def test_reverse_host(self):
|
def test_reverse_host(self):
|
||||||
self.assertEqual("com.google.www", utils.reverse_host("www.google.com"))
|
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)]))
|
||||||
|
@ -33,6 +33,7 @@ class Renderer:
|
|||||||
)
|
)
|
||||||
environment.filters["random_string"] = utils.random_string
|
environment.filters["random_string"] = utils.random_string
|
||||||
environment.filters["common_domain"] = utils.common_domain
|
environment.filters["common_domain"] = utils.common_domain
|
||||||
|
environment.filters["list_if"] = utils.list_if
|
||||||
environment.filters["reverse_host"] = utils.reverse_host
|
environment.filters["reverse_host"] = utils.reverse_host
|
||||||
environment.filters["walk_templates"] = walk_templates
|
environment.filters["walk_templates"] = walk_templates
|
||||||
environment.globals["TUTOR_VERSION"] = __version__
|
environment.globals["TUTOR_VERSION"] = __version__
|
||||||
|
@ -69,9 +69,7 @@ services:
|
|||||||
- ../../data/openedx-media:/var/www/openedx-media:ro
|
- ../../data/openedx-media:/var/www/openedx-media:ro
|
||||||
{% if ACTIVATE_HTTPS %}- ../../data/letsencrypt:/etc/letsencrypt/:ro{% endif %}
|
{% if ACTIVATE_HTTPS %}- ../../data/letsencrypt:/etc/letsencrypt/:ro{% endif %}
|
||||||
{{ patch("local-docker-compose-nginx-volumes")|indent(6) }}
|
{{ patch("local-docker-compose-nginx-volumes")|indent(6) }}
|
||||||
depends_on:
|
depends_on: {{ [("lms", ACTIVATE_LMS), ("cms", ACTIVATE_CMS)]|list_if }}
|
||||||
{% if ACTIVATE_LMS %}- lms{% endif %}
|
|
||||||
{% if ACTIVATE_CMS %}- cms {% endif %}
|
|
||||||
|
|
||||||
{% if ACTIVATE_RABBITMQ %}
|
{% if ACTIVATE_RABBITMQ %}
|
||||||
rabbitmq:
|
rabbitmq:
|
||||||
@ -98,9 +96,7 @@ services:
|
|||||||
MONGODB_HOST: "{{ MONGODB_HOST }}"
|
MONGODB_HOST: "{{ MONGODB_HOST }}"
|
||||||
MONGODB_PORT: "{{ MONGODB_PORT }}"
|
MONGODB_PORT: "{{ MONGODB_PORT }}"
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
depends_on:
|
depends_on: {{ [("elasticsearch", ACTIVATE_ELASTICSEARCH), ("mongodb", ACTIVATE_MONGODB)]|list_if }}
|
||||||
{% if ACTIVATE_ELASTICSEARCH %}- elasticsearch{% endif %}
|
|
||||||
{% if ACTIVATE_MONGODB %}- mongodb{% endif %}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
############# LMS and CMS
|
############# LMS and CMS
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import json
|
||||||
import os
|
import os
|
||||||
import random
|
import random
|
||||||
import shutil
|
import shutil
|
||||||
@ -24,6 +25,8 @@ def random_string(length):
|
|||||||
[random.choice(string.ascii_letters + string.digits) for _ in range(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):
|
def common_domain(d1, d2):
|
||||||
"""
|
"""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user