Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d01358a
commit 5ea228a
Showing
13 changed files
with
172 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,13 @@ | ||
richie: | ||
{% if RICHIE_FACTORY_REPOSITORY %} | ||
command: ./manage.py runserver 0.0.0.0:8003 | ||
{% else %} | ||
command: ./sandbox/manage.py runserver 0.0.0.0:8003 | ||
{% endif %} | ||
env_file: | ||
- ../plugins/richie/apps/env.d/development | ||
ports: | ||
- "8003:8003" | ||
- "8003:8003" | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,7 @@ | ||
# Richie settings (common) | ||
FEATURES["ENABLE_MKTG_SITE"] = True | ||
|
||
FEATURES["ENABLE_CROSS_DOMAIN_CSRF_COOKIE"] = True | ||
CROSS_DOMAIN_CSRF_COOKIE_DOMAIN = ".{{ LMS_HOST }}" | ||
CROSS_DOMAIN_CSRF_COOKIE_NAME = "edx_csrf_token" | ||
SESSION_COOKIE_NAME = "edx_session" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
91 changes: 91 additions & 0 deletions
91
tutorrichie/templates/richie/build/richie-factory/Dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
ARG SITE={{ RICHIE_FACTORY_SITE }} | ||
|
||
#--------- Base image with cloned repo | ||
FROM python:3.7-bullseye as base | ||
|
||
RUN apt update \ | ||
&& apt install -y git \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Clone repo | ||
ARG RICHIE_FACTORY_REPOSITORY={{ RICHIE_FACTORY_REPOSITORY }} | ||
ARG RICHIE_FACTORY_VERSION={{ RICHIE_FACTORY_VERSION }} | ||
ARG SITE | ||
RUN git clone $RICHIE_FACTORY_REPOSITORY --branch $RICHIE_FACTORY_VERSION --depth 1 /richie | ||
|
||
#--------- Front-end builder image | ||
FROM node:16 as frontend-builder | ||
|
||
ARG SITE | ||
|
||
COPY --from=base /richie/sites/${SITE}/src/frontend /app/richie/sites/${SITE}/src/frontend | ||
WORKDIR /app/richie/sites/${SITE}/src/frontend | ||
# --frozen-lockfile | ||
RUN yarn install && \ | ||
yarn compile-translations && \ | ||
yarn build-ts-production && \ | ||
yarn build-sass-production | ||
|
||
#--------- Production image | ||
FROM python:3.7-bullseye as production | ||
|
||
ARG SITE | ||
|
||
RUN apt update \ | ||
&& apt install -y gettext git default-mysql-client \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# User creation | ||
RUN useradd --home-dir /app --create-home --uid=1000 openedx | ||
RUN mkdir -p /data/media /data/static && chown -R openedx:openedx /data | ||
USER openedx | ||
|
||
COPY --from=base --chown=openedx:openedx /richie /app/richie | ||
WORKDIR /app/richie/sites/${SITE} | ||
|
||
# Install project (with requirements) | ||
RUN python -m venv /app/venv | ||
ENV PATH /app/venv/bin:${PATH} | ||
RUN pip install pip==22.0.4 setuptools==62.1.0 wheel==0.37.1 | ||
RUN pip install -r requirements/base.txt | ||
RUN pip install uwsgi==2.0.20 | ||
RUN pip install mysqlclient==2.1.0 | ||
# The django-cms fork includes drillable search feature, | ||
# it should be removed when this feature will be officially released | ||
# See upstream Dockerfile https://github.com/openfun/fun-richie-site-factory/blob/main/Dockerfile | ||
RUN pip install git+https://github.com/jbpenrath/django-cms@fun-3.11.0#egg=django-cms | ||
# Install requirements for storing media assets on S3/MinIO | ||
RUN pip install django-storages==1.12.3 boto3==1.20.25 | ||
|
||
WORKDIR /app/richie/sites/${SITE}/src/backend | ||
|
||
ENV PYTHONPATH "${PYTHONPATH}:/app/richie/sites/${SITE}/src/backend" | ||
ENV DJANGO_SETTINGS_MODULE ${SITE}.settings | ||
ENV DJANGO_CONFIGURATION Production | ||
ENV DJANGO_SECRET_KEY setme | ||
ENV DJANGO_AWS_ACCESS_KEY_ID setme | ||
ENV DJANGO_AWS_SECRET_ACCESS_KEY setme | ||
|
||
ENV SITE=${SITE} | ||
|
||
# Collect static assets | ||
COPY --from=frontend-builder --chown=openedx:openedx \ | ||
/app/richie/sites/${SITE}/src/backend/base/static/richie \ | ||
/app/richie/sites/${SITE}/src/backend/base/static/richie | ||
RUN ./manage.py collectstatic | ||
|
||
# Compile translations | ||
RUN mkdir -p locale && ./manage.py compilemessages | ||
|
||
# Run server | ||
EXPOSE 8000 | ||
CMD uwsgi \ | ||
--static-map /static=/data/static/ \ | ||
--static-map /media=/data/media/ \ | ||
--http 0.0.0.0:8000 \ | ||
--thunder-lock \ | ||
--single-interpreter \ | ||
--enable-threads \ | ||
--processes=${UWSGI_WORKERS:-2} \ | ||
--buffer-size=8192 \ | ||
--wsgi-file ${SITE}/wsgi.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
# TODO Update for richie-factory | ||
# Fix media permissions | ||
chown -R openedx:openedx /data/media | ||
|
||
# Create tables | ||
./sandbox/manage.py migrate | ||
./manage.py migrate | ||
|
||
# Create ES indices | ||
./sandbox/manage.py bootstrap_elasticsearch | ||
./manage.py bootstrap_elasticsearch | ||
|
||
# Create required pages | ||
./sandbox/manage.py richie_init | ||
./manage.py richie_init |