...
Update edx/configuration (sample PR, typo in variable name fixed here)
In the edx continuous integration playbook , add a new instance of the
mfe
role pointing tomymfe
, gated on aMYMFE_MFE_ENABLED
flag. This ensuresmymfe
will be installed (but not necessarily deployed) when doing afull_installation_from_scratch
, which is the default ami type for sandboxes (NOTE: If your mfe has hyphens in it’s name, such asora-grading
, for this configuration, use the hyphenated name)Code Block - role: mfe MFE_NAME: mymfe when: MYMFE_MFE_ENABLED
Create a deploy playbook for the app. Basic MFE playbook with splunk and newrelic capability, at
playbooks/mymfe.yml
:Code Block - name: Deploy my MFE Frontend hosts: all become: True gather_facts: True vars: ENABLE_NEWRELIC: False CLUSTER_NAME: 'mymfe' MYMFE_ENABLED: True MYMFE_SANDBOX_BUILD: False roles: - role: mfe MFE_NAME: mymfe - role: splunkforwarder when: COMMON_ENABLE_SPLUNKFORWARDER - role: newrelic_infrastructure when: COMMON_ENABLE_NEWRELIC_INFRASTRUCTURE
Set up the flag in the jenkins ansible_provision script to enable the MFE and determine which branch to build. Generally, if no branch (version) is specified, we want to build master.
Code Block if [[ -z $mymfe ]]; then mymfe="false" fi if [[ -z $mymfe_version ]]; then MYMFE_MFE_VERSION="master" fi
Add the new playbook to the edx_ansible role template. This is what makes sure the playbook will get called again if you run the ansible update script on your sandbox.
Note: it is unclear if this is actually necessary for MFEsCode Block repos_to_cmd["mymfe"]="$edx_ansible_cmd mymfe.yml -e 'MYMFE_MFE_VERSION=$2'"
Add
“mymfe”
to the list of service DNS names in the launch_ec2 role’s“DNS names for services”
task. This will CNAMEmymfe-<sandboxname>.edx.org
to the ec2 instance running the sandboxAdd nginx and version configurations to the jenkins ansible_provision script . This will allow the sandbox to use nginx to serve the mfe when it is enabled. Note these nginx configurations may live somewhere else eventually, but as of this is where they go.
Code Block MYMFE_NGINX_PORT: 80 MYMFE_SSL_NGINX_PORT: 443 MYMFE_MFE_VERSION: $mymfe_version MYMFE_MFE_ENABLED: $mymfe MYMFE_SANDBOX_BUILD: True
Update the parameters block in CreateSandbox.groovy in edx/jenkins-job-dsl. This will make the option to toggle your MFE on a sandbox appear in the CreateSandbox job configuration UI. Sample PR here
Code Block booleanParam("mymfe",false,"Enable Logistration MFE") stringParam("mymfe_version","master","The branch of the frontend-app-mymfe repository")
Update sandbox-internal. Sample PRs for lms here, ecommerce here, and learning MFE here. This is where you will update/add any variables needed by backend services to allow them to communicate with your MFE.
In the examples above, the ecommerce service needed to add the payment MFE to it’s CORS whitelist, allow CORS to use credentials, and get the MFE url (always
https://mymfe-deploy_host
).
...