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

Commit

Permalink
Merge pull request #81 from overhangio/redwood
Browse files Browse the repository at this point in the history
Upgrade to Redwood
  • Loading branch information
regisb authored Jun 20, 2024
2 parents f145bab + 5359f21 commit de58c6d
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 18 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ instructions, because git commits are used to generate release notes:

<!-- scriv-insert-here -->

<a id='changelog-18.0.0'></a>
## v18.0.0 (2024-05-15)

- 💥[Feature] Upgrade to Redwood. (by @Faraz32123)
- [Feature] Add support to `atlas pull` - FC-0012 project, OEP-58. (by @shadinaif)
- [Improvement] Change ecommerce and ecommerce-worker remotes from `edx` to `openedx`. (by @christopappas)
- 💥[Feature] Upgrade Python version to 3.12.2. (by @Faraz32123)
- [BugFix] Fix wrong mime type by adding mime-support dependency. (by @Faraz32123)

<a id='changelog-17.0.2'></a>
## v17.0.2 (2024-04-09)

Expand Down
1 change: 0 additions & 1 deletion changelog.d/20230

This file was deleted.

This file was deleted.

8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@
include_package_data=True,
python_requires=">=3.8",
install_requires=[
"tutor>=17.0.0,<18.0.0",
"tutor-discovery>=17.0.0,<18.0.0",
"tutor-mfe>=17.0.0,<18.0.0",
"tutor>=18.0.0,<19.0.0",
"tutor-discovery>=18.0.0,<19.0.0",
"tutor-mfe>=18.0.0,<19.0.0",
],
extras_require={"dev": ["tutor[dev]>=17.0.0,<18.0.0"]},
extras_require={"dev": ["tutor[dev]>=18.0.0,<19.0.0"]},
entry_points={"tutor.plugin.v1": ["ecommerce = tutorecommerce.plugin"]},
classifiers=[
"Development Status :: 5 - Production/Stable",
Expand Down
2 changes: 1 addition & 1 deletion tutorecommerce/__about__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "17.0.2"
__version__ = "18.0.0"
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ FROM docker.io/ubuntu:20.04 as minimal
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
apt update && \
apt install -y git-core language-pack-en python3 python3-pip python3-venv
apt install -y curl git-core language-pack-en libmysqlclient-dev \
libssl-dev libffi-dev build-essential

ARG APP_USER_ID=1000
RUN useradd --home-dir /openedx --create-home --shell /bin/bash --uid ${APP_USER_ID} app
Expand All @@ -15,15 +16,27 @@ RUN mkdir /openedx/ecommerce_worker && \
git clone https://github.com/openedx/ecommerce-worker.git --branch {{ OPENEDX_COMMON_VERSION }} --depth 1 /openedx/ecommerce_worker
WORKDIR /openedx/ecommerce_worker

# Install python venv
RUN python3 -m venv ../venv/
# Install pyenv
# https://www.python.org/downloads/
# https://github.com/pyenv/pyenv/releases
ARG PYTHON_VERSION=3.12.2
ENV PYENV_ROOT /opt/pyenv
# root user is required for below 2 steps, as app user gets permission denied.
USER root
RUN git clone https://github.com/pyenv/pyenv $PYENV_ROOT --branch v2.3.36 --depth 1
# Install Python
RUN $PYENV_ROOT/bin/pyenv install $PYTHON_VERSION
USER app

# Create virtualenv
RUN $PYENV_ROOT/versions/$PYTHON_VERSION/bin/python -m venv ../venv/
ENV PATH "/openedx/venv/bin:$PATH"
RUN --mount=type=cache,target=/openedx/.cache/pip,sharing=shared pip install \
# https://pypi.org/project/setuptools/
# https://pypi.org/project/pip/
# https://pypi.org/project/wheel/
setuptools==67.7.2 pip==23.1.2. wheel==0.40.0
setuptools==69.1.1 pip==24.0 wheel==0.43.0
RUN --mount=type=cache,target=/openedx/.cache/pip,sharing=shared pip install -r requirements/production.txt

ENV WORKER_CONFIGURATION_MODULE ecommerce_worker.settings.production
CMD celery worker --app=ecommerce_worker.celery_app:app --loglevel=info --maxtasksperchild 100 --queue=fulfillment,email_marketing
CMD celery --app=ecommerce_worker.celery_app:app worker --loglevel=info --max-tasks-per-child=100 --queues=fulfillment,email_marketing
29 changes: 23 additions & 6 deletions tutorecommerce/templates/ecommerce/build/ecommerce/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
###### Minimal image with base system requirements for most stages
FROM docker.io/ubuntu:20.04 as minimal

ENV DEBIAN_FRONTEND=noninteractive
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
apt update && \
apt install -y curl git-core language-pack-en
apt install -y curl gettext git-core language-pack-en

###### Checkout code
FROM minimal as checkout
Expand All @@ -31,7 +32,8 @@ FROM minimal as python
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
apt update && \
apt install -y libmysqlclient-dev libssl-dev python3 python3-pip python3-venv
apt install -y libmysqlclient-dev libssl-dev build-essential \
libsqlite3-dev libffi-dev mime-support

ARG APP_USER_ID=1000
RUN if [ "$APP_USER_ID" = 0 ]; then echo "app user may not be root" && false; fi
Expand All @@ -41,14 +43,26 @@ USER ${APP_USER_ID}
# Create cache dir. Otherwise, for some reason, it becomes owned by root.
RUN mkdir /openedx/.cache

# Create python venv
RUN python3 -m venv /openedx/venv/
# Install pyenv
# https://www.python.org/downloads/
# https://github.com/pyenv/pyenv/releases
ARG PYTHON_VERSION=3.12.2
ENV PYENV_ROOT /opt/pyenv
# root user is required for below 2 steps, as app user gets permission denied.
USER root
RUN git clone https://github.com/pyenv/pyenv $PYENV_ROOT --branch v2.3.36 --depth 1
# Install Python
RUN $PYENV_ROOT/bin/pyenv install $PYTHON_VERSION
USER app

# Create virtualenv
RUN $PYENV_ROOT/versions/$PYTHON_VERSION/bin/python -m venv /openedx/venv
ENV PATH "/openedx/venv/bin:$PATH"
RUN --mount=type=cache,target=/openedx/.cache/pip,sharing=shared,uid=${APP_USER_ID} pip install \
# https://pypi.org/project/setuptools/
# https://pypi.org/project/pip/
# https://pypi.org/project/wheel/
setuptools==68.2.2 pip==23.2.1 wheel==0.41.2
setuptools==69.1.1 pip==24.0 wheel==0.43.0

# Install a recent version of nodejs
# https://pypi.org/project/nodeenv
Expand All @@ -68,7 +82,7 @@ RUN --mount=type=cache,target=/openedx/.cache/bower,sharing=shared,uid=${APP_USE
# python requirements
RUN --mount=type=cache,target=/openedx/.cache/pip,sharing=shared,uid=${APP_USER_ID} pip install -r requirements.txt
# https://pypi.org/project/uWSGI/
RUN --mount=type=cache,target=/openedx/.cache/pip,sharing=shared,uid=${APP_USER_ID} pip install uwsgi==2.0.21
RUN --mount=type=cache,target=/openedx/.cache/pip,sharing=shared,uid=${APP_USER_ID} pip install uwsgi==2.0.24

# Install private requirements: this is useful for installing custom payment processors.
COPY --chown=app:app ./requirements/ /openedx/requirements
Expand All @@ -79,6 +93,9 @@ RUN cd /openedx/requirements/ \
{% for extra_requirement in ECOMMERCE_EXTRA_PIP_REQUIREMENTS %}RUN --mount=type=cache,target=/openedx/.cache/pip,sharing=shared,uid=${APP_USER_ID} pip install '{{ extra_requirement }}'
{% endfor %}

RUN atlas pull --repository="{{ ATLAS_REPOSITORY }}" --revision="{{ ATLAS_REVISION }}" {{ ATLAS_OPTIONS }} translations/ecommerce/ecommerce/conf/locale:ecommerce/conf/locale
RUN python manage.py compilemessages

{{ patch("ecommerce-dockerfile-pre-assets") }}

# Collect static assets (aka: "make static")
Expand Down

0 comments on commit de58c6d

Please sign in to comment.