Skip to content

Commit

Permalink
✨(project) add eucalyptus/3/wb release
Browse files Browse the repository at this point in the history
Install and configure fun-apps in the edx-platform eucalyptus.3 release.
  • Loading branch information
jmaupetit committed Dec 1, 2019
1 parent b78bd52 commit 19f48b9
Show file tree
Hide file tree
Showing 27 changed files with 2,562 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ jobs:
eucalyptus/3/bare:
<<: [*defaults, *build_steps]

eucalyptus/3/wb:
<<: [*defaults, *build_steps]

hawthorn/1/bare:
<<: [*defaults, *build_steps]

Expand Down Expand Up @@ -231,6 +234,10 @@ workflows:
filters:
tags:
ignore: /.*/
- eucalyptus/3/wb:
filters:
tags:
ignore: /.*/
- hawthorn/1/oee:
filters:
tags:
Expand Down
20 changes: 20 additions & 0 deletions releases/eucalyptus/3/wb/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic
Versioning](https://semver.org/spec/v2.0.0.html) for each flavored OpenEdx
release.

## [Unreleased]

## [eucalyptus.3-1.0.0-wb] - 2019-11-14

### Added

- First experimental release of OpenEdx `eucalyptus.3` (wb flavor).
- Set replicaSet and read_preference in mongodb connection

[unreleased]: https://github.com/openfun/openedx-docker/compare/eucalyptus.3-1.0.0-wb...HEAD
[eucalyptus.3-1.0.0-wb]: https://github.com/openfun/openedx-docker/releases/tag/eucalyptus.3-1.0.0-wb
237 changes: 237 additions & 0 deletions releases/eucalyptus/3/wb/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,237 @@
# EDX-PLATFORM multi-stage docker build

# Change release to build, by providing the EDX_RELEASE_REF build argument to
# your build command:
#
# $ docker build \
# --build-arg EDX_RELEASE_REF="open-release/eucalyptus.3" \
# -t edxapp:eucalyptus.3 \
# .
ARG DOCKER_UID=1000
ARG DOCKER_GID=1000
ARG EDX_RELEASE_REF=fun/whitebrand
ARG EDX_ARCHIVE_URL=https://github.com/openfun/edx-platform/archive/fun/whitebrand.tar.gz

# === BASE ===
FROM ubuntu:16.04 as base

# Configure locales & timezone
RUN apt-get update && \
apt-get install -y \
gettext \
locales \
tzdata && \
rm -rf /var/lib/apt/lists/*
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
locale-gen
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8


# === DOWNLOAD ===
FROM base as downloads

WORKDIR /downloads

# Install curl
RUN apt-get update && \
apt-get install -y curl

# Download pip installer
RUN curl -sLo get-pip.py https://bootstrap.pypa.io/get-pip.py

# Download edxapp release
# Get default EDX_RELEASE_REF value (defined on top)
ARG EDX_RELEASE_REF
ARG EDX_ARCHIVE_URL
RUN curl -sLo edxapp.tgz $EDX_ARCHIVE_URL && \
tar xzf edxapp.tgz


# === EDXAPP ===
FROM base as edxapp

# Install base system dependencies
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y python && \
rm -rf /var/lib/apt/lists/*

WORKDIR /edx/app/edxapp/edx-platform

# Get default EDX_RELEASE_REF value (defined on top)
ARG EDX_RELEASE_REF
COPY --from=downloads /downloads/edx-platform-* .

COPY ./requirements.txt /edx/app/edxapp/edx-platform/requirements/edx/fun.txt

# We copy default configuration files to "/config" and we point to them via
# symlinks. That allows to easily override default configurations by mounting a
# docker volume.
COPY ./config /config
RUN ln -sf /config/lms /edx/app/edxapp/edx-platform/lms/envs/fun && \
ln -sf /config/cms /edx/app/edxapp/edx-platform/cms/envs/fun

# Add node_modules/.bin to the PATH so that paver-related commands can execute
# node scripts
ENV PATH="/edx/app/edxapp/edx-platform/node_modules/.bin:${PATH}"

# === BUILDER ===
FROM edxapp as builder

WORKDIR /builder

# Install builder system dependencies
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y \
build-essential \
gettext \
git \
graphviz-dev \
libgeos-dev \
libjpeg8-dev \
libmysqlclient-dev \
libpng12-dev \
libxml2-dev \
libxmlsec1-dev \
nodejs \
nodejs-legacy \
npm \
python-dev && \
rm -rf /var/lib/apt/lists/*

# Install the latest pip release
COPY --from=downloads /downloads/get-pip.py ./get-pip.py
RUN python get-pip.py

WORKDIR /edx/app/edxapp/edx-platform

# Install python dependencies
#
# Note that we force some pinned release installations before installing github
# dependencies to prevent secondary dependencies installation to fail while
# trying to install a python 2.7 incompatible release
RUN pip install -r requirements/edx/pre.txt
RUN pip install \
astroid==1.6.0 \
django==1.8.15 \
pip==9.0.3
RUN pip install --src /usr/local/src -r requirements/edx/github.txt
RUN pip install -r requirements/edx/base.txt
RUN pip install -r requirements/edx/paver.txt
RUN pip install -r requirements/edx/post.txt
RUN pip install -r requirements/edx/local.txt
# Redis is an extra requirement of Celery, we need to install it explicitly so
# that celery workers are effective
RUN pip install redis==3.3.7
# Installing FUN requirements needs a recent pip release (we are using
# setup.cfg declarative packages)
RUN pip install -r requirements/edx/fun.txt

# Install Javascript requirements
RUN npm install

# Force the reinstallation of edx-ui-toolkit's dependencies inside its
# node_modules because someone is poking files from there when updating assets.
RUN cd node_modules/edx-ui-toolkit && \
npm install

# Update assets skipping collectstatic (it should be done during deployment)
RUN NO_PREREQ_INSTALL=1 \
paver update_assets --settings=fun.docker_build_production --skip-collect


# === DEVELOPMENT ===
FROM builder as development

ARG DOCKER_UID
ARG DOCKER_GID
ARG EDX_RELEASE_REF

# Install system dependencies
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y \
libsqlite3-dev \
mongodb && \
rm -rf /var/lib/apt/lists/*

RUN groupadd --gid ${DOCKER_GID} edx || \
echo "Group with ID ${DOCKER_GID} already exists." && \
useradd \
--create-home \
--home-dir /home/edx \
--uid ${DOCKER_UID} \
--gid ${DOCKER_GID} \
edx

# To prevent permission issues related to the non-priviledged user running in
# development, we will install development dependencies in a python virtual
# environment belonging to that user
RUN pip install virtualenv

# Create the virtualenv directory where we will install python development
# dependencies
RUN mkdir -p /edx/app/edxapp/venv && \
chown -R ${DOCKER_UID}:${DOCKER_GID} /edx/app/edxapp/venv

# Change edxapp directory owner to allow the development image docker user to
# perform installations from edxapp sources (yeah, I know...)
RUN chown -R ${DOCKER_UID}:${DOCKER_GID} /edx/app/edxapp

# Copy the entrypoint that will activate the virtualenv
COPY ./entrypoint.sh /usr/local/bin/entrypoint.sh

# Switch to an un-privileged user matching the host user to prevent permission
# issues with volumes (host folders)
USER ${DOCKER_UID}:${DOCKER_GID}

# Create the virtualenv with a non-priviledged user
RUN virtualenv -p python2.7 --system-site-packages /edx/app/edxapp/venv

# Install development dependencies in a virtualenv
RUN bash -c "source /edx/app/edxapp/venv/bin/activate && \
pip install --no-cache-dir -r requirements/edx/local.txt && \
pip install --no-cache-dir -r requirements/edx/development.txt"

ENTRYPOINT [ "/usr/local/bin/entrypoint.sh" ]


# === PRODUCTION ===
FROM edxapp as production

# Install runner system dependencies
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y \
libgeos-dev \
libjpeg8 \
libmysqlclient20 \
libpng12-0 \
libxml2 \
libxmlsec1-dev \
lynx \
nodejs \
nodejs-legacy \
tzdata && \
rm -rf /var/lib/apt/lists/*

# Copy installed dependencies
COPY --from=builder /usr/local /usr/local

# Copy modified sources (sic!)
COPY --from=builder /edx/app/edxapp/edx-platform /edx/app/edxapp/edx-platform

# Now that dependencies are installed and configuration has been set, the above
# statements will run with a un-privileged user.
USER 10000

# To start the CMS, inject the SERVICE_VARIANT=cms environment variable
# (defaults to "lms")
ENV SERVICE_VARIANT=lms

# Use Gunicorn in production as web server
CMD DJANGO_SETTINGS_MODULE=${SERVICE_VARIANT}.envs.fun.docker_run \
gunicorn --name=${SERVICE_VARIANT} --bind=0.0.0.0:8000 --max-requests=1000 ${SERVICE_VARIANT}.wsgi:application
5 changes: 5 additions & 0 deletions releases/eucalyptus/3/wb/activate
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export EDX_RELEASE="eucalyptus.3"
export FLAVOR="wb"
export EDX_RELEASE_REF="fun/whitebrand"
export EDX_ARCHIVE_URL="https://github.com/openfun/edx-platform/archive/${EDX_RELEASE_REF}.tar.gz"
export EDX_DEMO_RELEASE_REF="open-release/eucalyptus.3"
Empty file.
8 changes: 8 additions & 0 deletions releases/eucalyptus/3/wb/config/cms/docker_build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from ..common import *

# This is a minimal settings file allowing us to run "update_assets"
# in the Dockerfile

DATABASES = {"default": {}}

XQUEUE_INTERFACE = {"url": None, "django_auth": None}
3 changes: 3 additions & 0 deletions releases/eucalyptus/3/wb/config/cms/docker_run.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# This file is meant to import the environment related settings file

from docker_run_production import *
24 changes: 24 additions & 0 deletions releases/eucalyptus/3/wb/config/cms/docker_run_development.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# This file includes overrides to build the `development` environment for the CMS, starting from
# the settings of the `production` environment

from docker_run_production import *
from lms.envs.fun.utils import Configuration

# Load custom configuration parameters from yaml files
config = Configuration(os.path.dirname(__file__))

if "sentry" in LOGGING.get("handlers"):
LOGGING["handlers"]["sentry"]["environment"] = "development"

DEBUG = True
REQUIRE_DEBUG = True

EMAIL_BACKEND = config(
"EMAIL_BACKEND", default="django.core.mail.backends.console.EmailBackend"
)


PIPELINE_ENABLED = False
STATICFILES_STORAGE = "openedx.core.storage.DevelopmentStorage"

ALLOWED_HOSTS = ["*"]
14 changes: 14 additions & 0 deletions releases/eucalyptus/3/wb/config/cms/docker_run_preprod.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# This file includes overrides to build the `preprod` environment for the LMS
# starting from the settings of the `production` environment

from docker_run_production import *
from lms.envs.fun.utils import Configuration

# Load custom configuration parameters from yaml files
config = Configuration(os.path.dirname(__file__))

LOGGING["handlers"]["sentry"]["environment"] = "preprod"

EMAIL_BACKEND = config(
"EMAIL_BACKEND", default="django.core.mail.backends.console.EmailBackend"
)
Loading

0 comments on commit 19f48b9

Please sign in to comment.