-
Notifications
You must be signed in to change notification settings - Fork 171
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: remove supervisor and misc cleanup
- Loading branch information
Showing
8 changed files
with
14 additions
and
184 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,8 +4,6 @@ FROM ubuntu:focal as app | |
RUN apt update && \ | ||
apt-get install -qy \ | ||
curl \ | ||
vim \ | ||
git-core \ | ||
language-pack-en \ | ||
build-essential \ | ||
python3.8-dev \ | ||
|
@@ -23,97 +21,43 @@ ENV LANGUAGE en_US:en | |
ENV LC_ALL en_US.UTF-8 | ||
|
||
ARG COMMON_APP_DIR="/edx/app" | ||
ARG COMMON_CFG_DIR "/edx/etc" | ||
ARG DISCOVERY_SERVICE_NAME="discovery" | ||
ENV DISCOVERY_HOME "${COMMON_APP_DIR}/${DISCOVERY_SERVICE_NAME}" | ||
ARG DISCOVERY_HOME "${COMMON_APP_DIR}/${DISCOVERY_SERVICE_NAME}" | ||
ARG DISCOVERY_APP_DIR="${COMMON_APP_DIR}/${DISCOVERY_SERVICE_NAME}" | ||
ARG SUPERVISOR_APP_DIR="${COMMON_APP_DIR}/supervisor" | ||
ARG DISCOVERY_VENV_DIR="${COMMON_APP_DIR}/${DISCOVERY_SERVICE_NAME}/venvs/${DISCOVERY_SERVICE_NAME}" | ||
ARG SUPERVISOR_VENVS_DIR="${SUPERVISOR_APP_DIR}/venvs" | ||
ARG SUPERVISOR_VENV_DIR="${SUPERVISOR_VENVS_DIR}/supervisor" | ||
ARG DISCOVERY_CODE_DIR="${DISCOVERY_APP_DIR}/${DISCOVERY_SERVICE_NAME}" | ||
ARG DISCOVERY_NODEENV_DIR="${COMMON_APP_DIR}/${DISCOVERY_SERVICE_NAME}/nodeenvs/${DISCOVERY_SERVICE_NAME}" | ||
ARG SUPERVISOR_AVAILABLE_DIR="${COMMON_APP_DIR}/supervisor/conf.available.d" | ||
ARG SUPERVISOR_VENV_BIN="${SUPERVISOR_VENV_DIR}/bin" | ||
ARG SUPEVISOR_CTL="${SUPERVISOR_VENV_BIN}/supervisorctl" | ||
ARG SUPERVISOR_VERSION="4.2.1" | ||
ARG SUPERVISOR_CFG_DIR="${SUPERVISOR_APP_DIR}/conf.d" | ||
ARG DISCOVERY_NODE_VERSION="16.14.0" | ||
ARG DISCOVERY_NPM_VERSION="8.5.x" | ||
|
||
# These variables were defined in Ansible configuration but I couldn't find them being used anywhere. | ||
# I have commented these out for now but I would like to take opinion from someone having more knowledge about them | ||
# and whether it is safe to comment them out. I did basic smoke testing and everything seems to be working fine. | ||
|
||
# ENV DISCOVERY_ECOMMERCE_API_URL 'https://localhost:8002/api/v2/' | ||
# ENV DISCOVERY_COURSES_API_URL '${DISCOVERY_LMS_ROOT_URL}/api/courses/v1/' | ||
# ENV DISCOVERY_ORGANIZATIONS_API_URL '${DISCOVERY_LMS_ROOT_URL}/api/organizations/v0/' | ||
# ENV DISCOVERY_MARKETING_API_URL 'https://example.org/api/catalog/v2/' | ||
# ENV DISCOVERY_MARKETING_URL_ROOT 'https://example.org/' | ||
|
||
|
||
ENV HOME /root | ||
ENV PATH "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin" | ||
ENV PATH "${DISCOVERY_VENV_DIR}/bin:${DISCOVERY_NODEENV_DIR}/bin:$PATH" | ||
ENV COMMON_CFG_DIR "/edx/etc" | ||
ENV DISCOVERY_CFG_DIR "${COMMON_CFG_DIR}/discovery" | ||
ENV DISCOVERY_CFG "/edx/etc/discovery.yml" | ||
|
||
ENV DISCOVERY_NODEENV_DIR "${DISCOVERY_HOME}/nodeenvs/${DISCOVERY_SERVICE_NAME}" | ||
ENV DISCOVERY_NODEENV_BIN "${DISCOVERY_NODEENV_DIR}/bin" | ||
ENV DISCOVERY_NODE_MODULES_DIR "${DISCOVERY_CODE_DIR}}/node_modules" | ||
ENV DISCOVERY_NODE_BIN "${DISCOVERY_NODE_MODULES_DIR}/.bin" | ||
ARG DISCOVERY_NODEENV_DIR="${DISCOVERY_HOME}/nodeenvs/${DISCOVERY_SERVICE_NAME}" | ||
|
||
RUN addgroup discovery | ||
RUN adduser --disabled-login --disabled-password discovery --ingroup discovery | ||
|
||
# Make necessary directories and environment variables. | ||
RUN mkdir -p /edx/var/discovery/staticfiles | ||
RUN mkdir -p /edx/var/discovery/media | ||
# Log dir | ||
RUN mkdir /edx/var/log/ | ||
ENV PATH "${DISCOVERY_VENV_DIR}/bin:${DISCOVERY_NODEENV_DIR}/bin:$PATH" | ||
ENV DISCOVERY_CFG "/edx/etc/discovery.yml" | ||
ENV DISCOVERY_CODE_DIR "${DISCOVERY_CODE_DIR}" | ||
ENV DISCOVERY_HOME "${DISCOVERY_HOME}" | ||
|
||
RUN virtualenv -p python3.8 --always-copy ${DISCOVERY_VENV_DIR} | ||
RUN virtualenv -p python3.8 --always-copy ${SUPERVISOR_VENV_DIR} | ||
|
||
# No need to activate discovery venv as it is already in path | ||
RUN pip install nodeenv | ||
|
||
#install supervisor and deps in its virtualenv | ||
RUN . ${SUPERVISOR_VENV_BIN}/activate && \ | ||
pip install supervisor==${SUPERVISOR_VERSION} backoff==1.4.3 boto==2.48.0 && \ | ||
deactivate | ||
RUN nodeenv ${DISCOVERY_NODEENV_DIR} --node=16.14.0 --prebuilt | ||
RUN npm install -g [email protected] | ||
|
||
RUN nodeenv ${DISCOVERY_NODEENV_DIR} --node=${DISCOVERY_NODE_VERSION} --prebuilt | ||
RUN npm install -g npm@${DISCOVERY_NPM_VERSION} | ||
|
||
COPY requirements/production.txt ${DISCOVERY_CODE_DIR}/requirements/production.txt | ||
|
||
RUN pip install -r ${DISCOVERY_CODE_DIR}/requirements/production.txt | ||
|
||
# Working directory will be root of repo. | ||
WORKDIR ${DISCOVERY_CODE_DIR} | ||
|
||
# Copy just JS requirements and install them. | ||
COPY package.json package.json | ||
COPY package-lock.json package-lock.json | ||
RUN npm install --production | ||
COPY bower.json bower.json | ||
RUN npm install --production | ||
RUN ./node_modules/.bin/bower install --allow-root --production | ||
|
||
# Copy over rest of code. | ||
# We do this AFTER requirements so that the requirements cache isn't busted | ||
# every time any bit of code is changed. | ||
COPY . . | ||
COPY /configuration_files/discovery_gunicorn.py ${DISCOVERY_HOME}/discovery_gunicorn.py | ||
COPY /configuration_files/discovery-workers.sh ${DISCOVERY_HOME}/discovery-workers.sh | ||
COPY /configuration_files/discovery.yml ${DISCOVERY_CFG} | ||
COPY /scripts/discovery.sh ${DISCOVERY_HOME}/discovery.sh | ||
# create supervisor job | ||
COPY /configuration_files/supervisor.service /etc/systemd/system/supervisor.service | ||
COPY /configuration_files/supervisor.conf ${SUPERVISOR_CFG_DIR}/supervisor.conf | ||
COPY /configuration_files/supervisorctl ${SUPERVISOR_VENV_BIN}/supervisorctl | ||
# Manage.py symlink | ||
COPY /manage.py /edx/bin/manage.discovery | ||
|
||
# Expose canonical Discovery port | ||
EXPOSE 18381 | ||
|
@@ -122,7 +66,9 @@ FROM app as prod | |
|
||
ENV DJANGO_SETTINGS_MODULE "course_discovery.settings.production" | ||
|
||
RUN make static | ||
COPY requirements/production.txt ${DISCOVERY_CODE_DIR}/requirements/production.txt | ||
|
||
RUN pip install -r ${DISCOVERY_CODE_DIR}/requirements/production.txt | ||
|
||
ENTRYPOINT ["/edx/app/discovery/discovery.sh"] | ||
|
||
|
@@ -132,12 +78,5 @@ ENV DJANGO_SETTINGS_MODULE "course_discovery.settings.devstack" | |
|
||
RUN pip install -r ${DISCOVERY_CODE_DIR}/requirements/local.txt | ||
|
||
COPY /scripts/devstack.sh ${DISCOVERY_HOME}/devstack.sh | ||
|
||
RUN chown discovery:discovery /edx/app/discovery/devstack.sh && chmod a+x /edx/app/discovery/devstack.sh | ||
|
||
# Devstack related step for backwards compatibility | ||
RUN touch /edx/app/${DISCOVERY_SERVICE_NAME}/${DISCOVERY_SERVICE_NAME}_env | ||
|
||
ENTRYPOINT ["/edx/app/discovery/devstack.sh"] | ||
CMD ["start"] | ||
RUN touch ${DISCOVERY_HOME}/${DISCOVERY_SERVICE_NAME}_env |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.