Skip to content

Commit

Permalink
🚚(project) add eucalyptus/3/bare release
Browse files Browse the repository at this point in the history
Our white brands are still running OpenEdx eucalyptus release, thus we
needed to build this rather old release at least for development
purpose.

Configurations have been derived from our dogwood/3/bare settings
according to this diff [1] with the focus on lms/envs/aws.py [2] and
cms/envs/aws.py [3].

[1] edx/edx-platform@named-release/dogwood.3...open-release/eucalyptus.3
[2] edx/edx-platform@named-release/dogwood.3...open-release/eucalyptus.3#diff-8a23909bc8d201fba8525b1dd6396247
[3] edx/edx-platform@named-release/dogwood.3...open-release/eucalyptus.3#diff-cbc3788a38ba3e6fde20918d40c23be9

gitlint-ignore: B1
  • Loading branch information
jmaupetit committed Nov 6, 2019
1 parent 4134f04 commit 6d337b7
Show file tree
Hide file tree
Showing 24 changed files with 2,401 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ jobs:
dogwood/3/bare:
<<: [*defaults, *build_steps]

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

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

Expand Down Expand Up @@ -217,6 +220,10 @@ workflows:
filters:
tags:
only: /.*/
- eucalyptus/3/bare:
filters:
tags:
only: /.*/
- hawthorn/1/oee:
filters:
tags:
Expand All @@ -241,6 +248,7 @@ workflows:
requires:
- master/bare
- dogwood/3/bare
- eucalyptus/3/bare
- hawthorn/1/bare
- hawthorn/1/oee
filters:
Expand Down
19 changes: 19 additions & 0 deletions releases/eucalyptus/3/bare/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# 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] - 2019-11-06

### Added

- First experimental release of OpenEdx `eucalyptus.3` (bare flavor).

[unreleased]: https://github.com/openfun/openedx-docker/compare/eucalyptus.3-1.0.0...HEAD
[eucalyptus.3-1.0.0]: https://github.com/openfun/openedx-docker/releases/tag/eucalyptus.3-1.0.0
233 changes: 233 additions & 0 deletions releases/eucalyptus/3/bare/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,233 @@
# 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=open-release/eucalyptus.3

# === 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
RUN curl -sLo edxapp.tgz https://github.com/edx/edx-platform/archive/$EDX_RELEASE_REF.tar.gz && \
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-* .

# 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

# 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

# Fix pypi.org TLS handshake errors. Installed pinned release is not compatible
# with the cryptography module.
RUN pip uninstall -y pyOpenSSL

# 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
4 changes: 4 additions & 0 deletions releases/eucalyptus/3/bare/activate
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export EDX_RELEASE="eucalyptus.3"
export FLAVOR="bare"
export EDX_RELEASE_REF="open-release/eucalyptus.3"
export EDX_DEMO_RELEASE_REF="open-release/eucalyptus.3"
Empty file.
8 changes: 8 additions & 0 deletions releases/eucalyptus/3/bare/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/bare/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/bare/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/bare/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 6d337b7

Please sign in to comment.