Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

feat: Pull edxapp translations via Atlas #7128

Merged
merged 2 commits into from
Mar 1, 2024
Merged

feat: Pull edxapp translations via Atlas #7128

merged 2 commits into from
Mar 1, 2024

Conversation

timmc-edx
Copy link
Contributor

@timmc-edx timmc-edx commented Feb 29, 2024

This is to support OEP-58:
https://docs.openedx.org/projects/openedx-proposals/en/latest/architectural-decisions/oep-0058-arch-translations-management.html

Changes since the #7119 attempt:

  • Move to just after main requirements are installed (just for faster feedback during testing, really)
  • Use already-installed openedx-atlas
  • Use variant-agnostic EDX_PLATFORM_SETTINGS rather than DJANGO_SETTINGS_MODULE
  • Use Ansible environment field for env vars
  • Drop set -eu -o pipefail since the script is now simple

Most importantly, openedx/edx-platform#34306 has since merged, so we don't have to worry about the NPM conflicts we were getting previously.

Configuration Pull Request

Make sure that the following steps are done before merging:

  • Have a Site Reliability Engineer review the PR if you don't own all of the services impacted.
  • If you are adding any new default values that need to be overridden when this change goes live, update internal repos and add an entry to the top of the CHANGELOG.
  • Performed the appropriate testing.
  • Think about how this change will affect Open edX operators and update the wiki page for the next Open edX release if needed

Copy link
Contributor

@OmarIthawi OmarIthawi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@timmc-edx Thanks for creating this I'm happy to see the work getting used :)

It seems to be aligned with how altas is supposed to work in a production environment.

I have two notes which might break future uses:

I don't think this should be merged as-is.

Comment on lines 220 to 227
shell: |
set -eu -o pipefail
source {{ edxapp_venv_dir }}/bin/activate
# Use production Django settings because otherwise debug_toolbar will be referenced and cause
# an error (we don't have developer Python deps installed.) Use minimal configs because the
# real configs aren't installed until later in the playbook.
DJANGO_SETTINGS_MODULE=lms.envs.production LMS_CFG=lms/envs/minimal.yml STUDIO_CFG=lms/envs/minimal.yml \
OPENEDX_ATLAS_PULL=true make pull_translations
Copy link
Contributor

@OmarIthawi OmarIthawi Mar 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've made some cosmetic suggestions here, but please do not accept it as-is. My Ansible skills are pretty rusty at the moment.

Suggested change
shell: |
set -eu -o pipefail
source {{ edxapp_venv_dir }}/bin/activate
# Use production Django settings because otherwise debug_toolbar will be referenced and cause
# an error (we don't have developer Python deps installed.) Use minimal configs because the
# real configs aren't installed until later in the playbook.
DJANGO_SETTINGS_MODULE=lms.envs.production LMS_CFG=lms/envs/minimal.yml STUDIO_CFG=lms/envs/minimal.yml \
OPENEDX_ATLAS_PULL=true make pull_translations
shell: |
set -eu -o pipefail
source {{ edxapp_venv_dir }}/bin/activate
make pull_translations
environment:
# Use production Django settings because otherwise debug_toolbar will be referenced and cause
# an error (we don't have developer Python deps installed.) Use minimal configs because the
# real configs aren't installed until later in the playbook.
EDX_PLATFORM_SETTINGS: "production"
LMS_CFG: "lms/envs/minimal.yml"
STUDIO_CFG: "lms/envs/minimal.yml"
OPENEDX_ATLAS_PULL: "true"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh nice, I didn't know Ansible had environment as a field on tasks in general! Also, I can get rid of the set -eu -o pipefail since I no longer have a complicated shell script; the relevant command is the last one.

I'll give EDX_PLATFORM_SETTINGS a shot as well.

@OmarIthawi OmarIthawi self-requested a review March 1, 2024 09:59
@timmc-edx
Copy link
Contributor Author

It doesn't appear that edxapp uses the git_clone role, at least not directly. (It does use edx-themes, which uses git_clone, but for a different repo.)

This is definitely something to watch out for in other repos, but I don't think it would be relevant for 2U, at least -- we provision brand new hosts and cut AMIs, and then deploy those AMIs. The Ansible scripts only get run once.

- Use `EDX_PLATFORM_SETTINGS` rather than DSM to be variant-agnostic
- Use environment field to clean things up
- Drop shell settings that aren't needed for a simple script
- Clean up task comments and name
Copy link
Contributor

@OmarIthawi OmarIthawi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@timmc-edx Thanks for the context about AMI builds at 2U. It's certainly clearner this way.

It's been a couple of years since I tinkered with Ansible, but this looks good to me.

I'm excited to see atlas in action!

@timmc-edx timmc-edx merged commit 3ce4019 into master Mar 1, 2024
4 checks passed
@timmc-edx timmc-edx deleted the timmc/atlas branch March 1, 2024 21:04
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants