mirror of
https://github.com/ChristianLight/tutor.git
synced 2025-01-06 07:30:40 +00:00
Make feature flags interactive
Feature flags are now asked to the user interactively, as part of the configuration step. This makes defining feature flags much more simple.
This commit is contained in:
parent
96ab171f1c
commit
e60e0071c4
@ -1,5 +1,6 @@
|
||||
# Changelog
|
||||
|
||||
- 2018-09-30 [Improvement] Simplify boolean feature flags definition
|
||||
- 2018-09-29 [Improvement] Add logging commands
|
||||
- 2018-09-29 [Improvement] Add self-documented help with "make help"
|
||||
- 2018-09-29 [Feature] Add [Portainer](https://portainer.io) as an optional web UI to administer docker containers
|
||||
|
3
Makefile
3
Makefile
@ -64,8 +64,7 @@ stop: ## Stop all services
|
||||
|
||||
configure: build-configurator ## Configure the environment prior to running the platform
|
||||
docker run --rm -it --volume="$(PWD)/config:/openedx/config" \
|
||||
-e USERID=$(USERID) -e SILENT=$(SILENT) \
|
||||
-e SETTING_ACTIVATE_HTTPS=$(ACTIVATE_HTTPS) -e SETTING_ACTIVATE_NOTES=$(ACTIVATE_NOTES) -e SETTING_ACTIVATE_PORTAINER=$(ACTIVATE_PORTAINER) -e SETTING_ACTIVATE_XQUEUE=$(ACTIVATE_XQUEUE) \
|
||||
-e USERID=$(USERID) -e SILENT=$(SILENT) $(CONFIGURE_OPTS) \
|
||||
regis/openedx-configurator:hawthorn
|
||||
|
||||
post_configure: $(post_configure_targets)
|
||||
|
20
README.md
20
README.md
@ -25,13 +25,9 @@ This might seem too simple to be true, but there's no magic -- just good packagi
|
||||
|
||||
## Optional features
|
||||
|
||||
Some optional features may be activated by defining `ACTIVATE_*` environment variables on the host. These features change configuration files (during the `configure` step) as well as make targets. For instance, to add SSL/TLS certificates, run:
|
||||
Some optional features may be activated or deactivated during the interactive configuration step. These features change configuration files (during the `configure` step) as well as make targets.
|
||||
|
||||
ACTIVATE_HTTPS=1 make all
|
||||
|
||||
Technically, the `ACTIVATE_*` environment variables are only required during `make configure`. After that, they will be automatically loaded from `config/Makefile.env`.
|
||||
|
||||
### SSL/TLS certificates for HTTPS access (`ACTIVATE_HTTPS`)
|
||||
### SSL/TLS certificates for HTTPS access
|
||||
|
||||
By activating this feature, a free SSL/TLS certificate from the [Let's Encrypt](https://letsencrypt.org/) certificate authority will be created for your platform. With this feature, **your platform will no longer be accessible in HTTP**. Calls to http urls will be redirected to https url.
|
||||
|
||||
@ -51,7 +47,7 @@ To renew the certificate, run this command once per month:
|
||||
|
||||
make https-certificate-renew
|
||||
|
||||
### Student notes (`ACTIVATE_NOTES`)
|
||||
### Student notes
|
||||
|
||||
With [notes](https://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/en/open-release-hawthorn.master/exercises_tools/notes.html?highlight=notes), students can annotate portions of the courseware.
|
||||
|
||||
@ -59,13 +55,13 @@ With [notes](https://edx.readthedocs.io/projects/open-edx-building-and-running-a
|
||||
|
||||
You should beware that the `notes.<LMS_HOST>` domain name should be activated and point to your server. For instance, if your LMS is hosted at [myopenedx.com](), the notes service should be found at [notes.myopenedx.com](). Student browsers will access this domain name to fetch their notes.
|
||||
|
||||
### Xqueue (`ACTIVATE_XQUEUE`)
|
||||
### Xqueue
|
||||
|
||||
[Xqueue](https://github.com/edx/xqueue) is for grading problems with external services. If you don't know what it is, you probably don't need it.
|
||||
|
||||
Note: in previous releases of openedx-docker, xqueue was run for all platforms. It is now an optional feature.
|
||||
|
||||
### Docker container web UI with [Portainer](https://portainer.io/) (`ACTIVATE_PORTAINER`)
|
||||
### Docker container web UI with [Portainer](https://portainer.io/)
|
||||
|
||||
Portainer is a web UI for managing docker containers. It lets you view your entire Open edX platform at a glace. Try it! It's really cool.
|
||||
|
||||
@ -87,7 +83,11 @@ Building the Android app for an Open edX platform is currently labeled as a **be
|
||||
|
||||
### Stats
|
||||
|
||||
By default, the install script will collect some information about your install and send it to a private server. The only transmitted information are the LMS domain name and the ID of the install. If you do not wish to transmit these informations, set the environment variable `DISABLE_STATS=1`. But if you do that, please send me a message to tell me about your platform!
|
||||
By default, the install script will collect some information about your install and send it to a private server. The only transmitted information are the LMS domain name and the ID of the install. To disable stats collection, define the following environment variable:
|
||||
|
||||
export DISABLE_STATS=1
|
||||
|
||||
If you decide to disable stats, please send me a message to tell me about your platform!
|
||||
|
||||
## Requirements
|
||||
|
||||
|
@ -37,22 +37,19 @@ class Configurator:
|
||||
|
||||
def add(self, name, question="", default=""):
|
||||
default = self.get_default_value(name, default)
|
||||
message = question + " (default: \"{}\"): ".format(default) if question else None
|
||||
value = self.ask(message, default)
|
||||
value = self.ask(question, default)
|
||||
self.set(name, value)
|
||||
|
||||
return self
|
||||
|
||||
def add_bool(self, name, question="", default=False):
|
||||
self.add(name, question=question, default=default)
|
||||
value = self.get(name)
|
||||
if value in [1, '1']:
|
||||
return self.set(name, True)
|
||||
if value in [0, '0', '']:
|
||||
return self.set(name, False)
|
||||
if value in [True, False]:
|
||||
return self
|
||||
return self.set(name, bool(value))
|
||||
default = self.get_default_value(name, default)
|
||||
if default in [1, '1']:
|
||||
default = True
|
||||
if default in [0, '0', '']:
|
||||
default = False
|
||||
value = self.ask_bool(question, default)
|
||||
return self.set(name, value)
|
||||
|
||||
def get_default_value(self, name, default):
|
||||
setting_name = 'SETTING_' + name.upper()
|
||||
@ -66,9 +63,25 @@ class Configurator:
|
||||
|
||||
def ask(self, message, default):
|
||||
if self.__input and message:
|
||||
message += " (default: \"{}\"): ".format(default)
|
||||
return self.__input(message) or default
|
||||
return default
|
||||
|
||||
def ask_bool(self, message, default):
|
||||
if self.__input and message:
|
||||
message += " [Y/n] " if default else " [y/N] "
|
||||
while True:
|
||||
answer = self.__input(message)
|
||||
if answer is None or answer == '':
|
||||
return default
|
||||
if answer.lower() in ['y', 'yes']:
|
||||
return True
|
||||
if answer.lower() in ['n', 'no']:
|
||||
return False
|
||||
print("'{}' is an invalid answer".format(answer))
|
||||
return default
|
||||
|
||||
|
||||
def get(self, name):
|
||||
return self.__values.get(name)
|
||||
|
||||
@ -155,15 +168,13 @@ def interactive(args):
|
||||
).add(
|
||||
'XQUEUE_SECRET_KEY', "", random_string(24)
|
||||
).add_bool(
|
||||
'DISABLE_STATS', "", False
|
||||
'ACTIVATE_HTTPS', "Activate SSL/TLS certificates for HTTPS access? Important note: this will NOT work in a development environment.", False
|
||||
).add_bool(
|
||||
'ACTIVATE_NOTES', "", False
|
||||
'ACTIVATE_NOTES', "Activate Student Notes service (https://open.edx.org/features/student-notes)?", False
|
||||
).add_bool(
|
||||
'ACTIVATE_HTTPS', "", False
|
||||
'ACTIVATE_PORTAINER', "Activate Portainer, a convenient Docker dashboard with a web UI (https://portainer.io)?", False
|
||||
).add_bool(
|
||||
'ACTIVATE_PORTAINER', "", False
|
||||
).add_bool(
|
||||
'ACTIVATE_XQUEUE', "", False
|
||||
'ACTIVATE_XQUEUE', "Activate Xqueue for external grader services? (https://github.com/edx/xqueue)", False
|
||||
).add(
|
||||
'ID', "", random_string(8)
|
||||
)
|
||||
|
@ -1,4 +1,3 @@
|
||||
DISABLE_STATS ?= {{ 1 if DISABLE_STATS else 0 }}
|
||||
ACTIVATE_HTTPS ?= {{ 1 if ACTIVATE_HTTPS else 0 }}
|
||||
ACTIVATE_XQUEUE ?= {{ 1 if ACTIVATE_XQUEUE else 0 }}
|
||||
ACTIVATE_NOTES ?= {{ 1 if ACTIVATE_NOTES else 0 }}
|
||||
|
Loading…
Reference in New Issue
Block a user