diff --git a/docs/source/commands/configure_instance.rst b/docs/source/commands/configure_instance.rst index 407b35c137..4acc79cfac 100644 --- a/docs/source/commands/configure_instance.rst +++ b/docs/source/commands/configure_instance.rst @@ -1,12 +1,14 @@ ``configure_instance`` ====================== -Configures a fresh MITx Online instance. For more information, see :doc:`MITx Online Quick Start<../configuration/quickstart>`. +Configures a fresh MITx Online instance. For more information, see :doc:`MITx Online Quick Start<../configuration/quickstart>` and :doc:`Local Open edX Tutor and MITx Online Deployment<../configuration/tutor>`. + +For Tutor deployments, this will use ``local.overhang.io`` for URLs for the edX platform. If you're running a dev deployment, or are using Tutor Nightly, ``--tutor-dev`` will additionally add the proper ports (as Caddy is disabled in these cases). In either case, the two demo courses will still be created but only the Demonstration Course (``course-v1:edX+DemoX+Demo_Course``) will exist in edX, and then only if you import the demo course using the relevant Tutor command. Syntax ------ -``configure_instance [--dont-enroll|-D] [--dont-create-superuser|-S] [--edx-oauth-client ] [--edx-oauth-secret ] [--gateway ]`` +``configure_instance [--dont-enroll|-D] [--dont-create-superuser|-S] [--edx-oauth-client ] [--edx-oauth-secret ] [--gateway ] [--tutor|-T] [--tutor-dev]`` Options ------- @@ -15,5 +17,7 @@ Options * ``--dont-enroll|-D`` - Don't enroll the test learner account in any courses. (Defaults to enrolling the account in ``course-v1:edX+DemoX+Demo_Course``.) * ``--dont-create-superuser|-S`` - Don't create a superuser account. * ``--gateway `` - The Docker gateway IP. Required on Linux. See :doc:`Configure Open edX<../configuration/open_edx>` for more info. -* ``--edx-oauth-client `` - Use the specified client ID for the edX OAuth2 client. (Useful if you're redoing your MITx Online instance and you've already created the corresponding record in edX, since you're not allowed to edit it there.) -* ``--edx-oauth-secret `` - Use the specified client secret for the edX OAuth2 client. (Useful if you're redoing your MITx Online instance and you've already created the corresponding record in edX, since you're not allowed to edit it there.) \ No newline at end of file +* ``--edx-oauth-client `` - Use the specified client ID for the edX OAuth2 client. (Useful if you're redoing your MITx Online instance and you've already created the corresponding record in edX, since you're not allowed to edit it there.) +* ``--edx-oauth-secret `` - Use the specified client secret for the edX OAuth2 client. (Useful if you're redoing your MITx Online instance and you've already created the corresponding record in edX, since you're not allowed to edit it there.) +* ``--tutor|-T`` - Configure the instance for use with a Tutor edX deployment. +* ``--tutor-dev`` - Configure the instnace for use with Tutor dev or nightly. diff --git a/docs/source/configuration/tutor.rst b/docs/source/configuration/tutor.rst index 99984c7357..14483f31b3 100644 --- a/docs/source/configuration/tutor.rst +++ b/docs/source/configuration/tutor.rst @@ -6,7 +6,7 @@ These instructions describe setting up MITx Online and Tutor from scratch on Lin .. - These instructions may work for you if you need to do Open edX development too. However, these instructions *are not* geared towards that end. You may be able to replace calls to ``tutor local`` with calls to ``tutor dev``\ , but I had a number of problems with CORS headers when trying to log in. Your mileage may vary. + These instructions should work for a Tutor Dev or Tutor Nightly deployment as well. Specify ``--tutor-dev`` instead of ``--tutor`` when running ``configure_instance`` so the URLs have a port on them. At the end of this guide, you should have: @@ -132,10 +132,10 @@ These steps will also disable the AuthN SSO MFE, so from here on you'll get norm SKIP_EMAIL_VALIDATION: true to the ``FEATURES`` block (should be at the top). -#. Edit the ``env/apps/openedx/settings/lms/production.py`` settings file. +#. Edit the ``env/apps/openedx/settings/lms/production.py`` and/or ``env/apps/openedx/settings/lms/development.py`` settings file. (The former is used by a local instance, where the latter is used by both dev and nightly instances.) * Add to the end of the file: - + * ``THIRD_PARTY_AUTH_BACKENDS = ['social_auth_mitxpro.backends.MITxProOAuth2']`` * ``AUTHENTICATION_BACKENDS.append('social_auth_mitxpro.backends.MITxProOAuth2')`` * ``IDA_LOGOUT_URI_LIST.append('http://mitxonline.odl.local:8013/logout/')`` - there's an existing one of these around like 300 in production.py too. @@ -171,7 +171,7 @@ These steps will also disable the AuthN SSO MFE, so from here on you'll get norm * Enable sso id verification is checked. * Backend name: ``mitxpro-oauth2`` * Client ID and Client Secret: from record created by ``configure_instance`` when you set up MITx Online. - * Other settings: + * Other settings: { "AUTHORIZATION_URL": "\http://mitxonline.odl.local:8013/oauth2/authorize/", @@ -212,4 +212,8 @@ Other Notes **Trying to set configuration settings via ``tutor config`` will undo the specialty configuration above.** If you need to make changes to the configuration, either manually edit the ``env/apps/openedx/config/lms.env.yml`` file or the ``env/apps/openedx/settings/lms/production.py`` file and restart your Tutor instance. -**Make sure your service worker account is active.** It's an easy checkbox to miss. +**Make sure your service worker account is active.** It's an easy checkbox to miss. + +**Restarting** If you want to rebuild from scratch, make sure you ``docker image prune``. It's also recommended to remove the Tutor project root folder - ``tutor config printroot`` will tell you where that is. + +**Running Multiple Tutor Instances** If you want to run more than one Tutor instance, it's pretty important to specify the project root explicitly or you may end up with one instance trying to use config files from another and things getting confused from there. `See the Tutor documentation for this. `_ (A suggestion: configure aliases to the ``tutor`` command that run ``tutor --root=`` so you don't have to rely on environment variables, especially if you keep multiple terminal sessions going.) diff --git a/main/management/commands/configure_instance.py b/main/management/commands/configure_instance.py index fde3ef1a0b..d5b4dbc1a1 100644 --- a/main/management/commands/configure_instance.py +++ b/main/management/commands/configure_instance.py @@ -32,7 +32,7 @@ for test CyberSource transactions. If the --tutor/-T option is passed, the command will use the local.overhang.io -address for links to edX rather than edx.odl.local:18000. +address for links to edX rather than edx.odl.local:18000. This uses other management commands to complete these tasks. So, if you just want to run part of this, use one of these commands: @@ -117,11 +117,27 @@ def add_arguments(self, parser): dest="tutor", ) + parser.add_argument( + "--tutor-dev", + help="Configure for Tutor Dev/Nightly.", + action="store_true", + dest="tutordev", + ) + + def determine_edx_hostport(self, *args, **kwargs): + """Returns a tuple of the edX host and port depending on what the user's passed in""" + + if kwargs["tutor"]: + return ("local.overhang.io", "") + elif kwargs["tutordev"]: + return ("local.overhang.io", ":8000") + else: + return ("edx.odl.local:18000", ":18000") + def handle(self, *args, **kwargs): """Coordinates the other commands.""" - edx_host = "local.overhang.io" if kwargs["tutor"] else "edx.odl.local:18000" - edx_gateway_port = "" if kwargs["tutor"] else ":18000" + (edx_host, edx_gateway_port) = self.determine_edx_hostport(**kwargs) # Step -1: run createsuperuesr if kwargs["superuser"]: