Skip to content

Commit

Permalink
feat: add atlas pull support - FC-0012
Browse files Browse the repository at this point in the history
Add atlas pull behind a feature flag until it's fully implemented

Refs: FC-0012 OEP-58
  • Loading branch information
shadinaif committed Nov 26, 2023
1 parent 913a1ad commit 8bb6a47
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 5 deletions.
1 change: 1 addition & 0 deletions changelog.d/20231126_120405_shadinaif_atlas_pull.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- [Feature] Pull translations via `atlas` during Docker build. (by @shadinaif)
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@
EMAIL_FILE_PATH = "/tmp/openedx/emails"

# Language/locales
LOCALE_PATHS.append("/openedx/locale/contrib/locale")
{% if not OPENEDX_ATLAS_PULL %}LOCALE_PATHS.append("/openedx/locale/contrib/locale"){% endif %}
LOCALE_PATHS.append("/openedx/locale/user/locale")
LANGUAGE_COOKIE_NAME = "openedx-language-preference"

Expand Down
9 changes: 8 additions & 1 deletion tutor/templates/build/openedx/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ USER ${APP_USER_ID}
# https://hub.docker.com/r/powerman/dockerize/tags
COPY --link --from=docker.io/powerman/dockerize:0.19.0 /usr/local/bin/dockerize /usr/local/bin/dockerize
COPY --chown=app:app --from=edx-platform / /openedx/edx-platform
COPY --chown=app:app --from=locales /openedx/locale /openedx/locale
{% if not OPENEDX_ATLAS_PULL %}COPY --chown=app:app --from=locales /openedx/locale /openedx/locale{% endif %}
COPY --chown=app:app --from=python /opt/pyenv /opt/pyenv
COPY --chown=app:app --from=python-requirements /openedx/venv /openedx/venv
COPY --chown=app:app --from=python-requirements /openedx/requirements /openedx/requirements
Expand Down Expand Up @@ -187,6 +187,13 @@ ENV REVISION_CFG /openedx/config/revisions.yml
COPY --chown=app:app settings/lms/*.py ./lms/envs/tutor/
COPY --chown=app:app settings/cms/*.py ./cms/envs/tutor/

{% if OPENEDX_ATLAS_PULL %}
# Support the OEP-58 proposal behind a feature flag until it's fully implemented
RUN pip install openedx-atlas
RUN find conf/locale -mindepth 1 -maxdepth 1 -type d -exec rm -r {} \;
RUN atlas pull {{ patch("atlas-extra-args") }} translations/edx-platform/conf/locale:edx-platform/conf/locale
{% endif %}

# Copy user-specific locales to /openedx/locale/user/locale and compile them
RUN mkdir /openedx/locale/user
COPY --chown=app:app ./locale/ /openedx/locale/user/locale/
Expand Down
2 changes: 1 addition & 1 deletion tutor/templates/build/openedx/settings/cms/assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@

derive_settings(__name__)

LOCALE_PATHS.append("/openedx/locale/contrib/locale")
{% if not OPENEDX_ATLAS_PULL %}LOCALE_PATHS.append("/openedx/locale/contrib/locale"){% endif %}
LOCALE_PATHS.append("/openedx/locale/user/locale")
2 changes: 1 addition & 1 deletion tutor/templates/build/openedx/settings/lms/assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@

derive_settings(__name__)

LOCALE_PATHS.append("/openedx/locale/contrib/locale")
{% if not OPENEDX_ATLAS_PULL %}LOCALE_PATHS.append("/openedx/locale/contrib/locale"){% endif %}
LOCALE_PATHS.append("/openedx/locale/user/locale")
2 changes: 1 addition & 1 deletion tutor/templates/build/openedx/settings/partials/i18n.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

derive_settings(__name__)

LOCALE_PATHS.append("/openedx/locale/contrib/locale")
{% if not OPENEDX_ATLAS_PULL %}LOCALE_PATHS.append("/openedx/locale/contrib/locale"){% endif %}
LOCALE_PATHS.append("/openedx/locale/user/locale")

{{ patch("openedx-common-i18n-settings") }}
1 change: 1 addition & 0 deletions tutor/templates/config/defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ MONGODB_PASSWORD: ""
MONGODB_REPLICA_SET: ""
MONGODB_USE_SSL: false
MOUNTS: []
OPENEDX_ATLAS_PULL: false
OPENEDX_AWS_ACCESS_KEY: ""
OPENEDX_AWS_SECRET_ACCESS_KEY: ""
OPENEDX_CACHE_REDIS_DB: 1
Expand Down

0 comments on commit 8bb6a47

Please sign in to comment.