diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index 15bdb478..00000000 --- a/.dockerignore +++ /dev/null @@ -1,52 +0,0 @@ -lms_mongo_dump/ - -### Python artifacts -**/*.pyc - -### artifacts -**/*.bak - -### Logging artifacts -**/log/ -**/logs -**/*.log - -### Installation artifacts -**/*.egg-info -**/.prereqs_cache -**/node_modules -**/bin/ - -**/dist/ -**/build -**/eggs -**/parts -**/bin -**/var -**/sdist -**/develop-eggs -**/.installed.cfg -**/lib -**/lib64 -**/__pycache__ - - -### Internationalization artifacts -**/*.mo -**/*.po -**/*.prob -**/*.dup -!**/django.po -!**/django.mo -!**/djangojs.po -!**/djangojs.mo -conf/locale/en/LC_MESSAGES/*.mo -conf/locale/fake*/LC_MESSAGES/*.po -conf/locale/fake*/LC_MESSAGES/*.mo - -# Unit test / coverage reports -**/.coverage -**/htmlcov -**/.tox -**/nosetests.xml -**/unittests.xml diff --git a/.github/docker-compose-github.yml b/.github/docker-compose-github.yml index 1844f359..aac0bde2 100644 --- a/.github/docker-compose-github.yml +++ b/.github/docker-compose-github.yml @@ -10,10 +10,7 @@ services: - enterprise_catalog_mysql8:/var/lib/mysql app: - image: openedx/enterprise-catalog - build: - context: .. - dockerfile: Dockerfile + image: edxops/enterprise-catalog-dev container_name: enterprise.catalog.app volumes: - ..:/edx/app/enterprise_catalog/enterprise_catalog diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml deleted file mode 100644 index 4bd23149..00000000 --- a/.github/workflows/docker-publish.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Push Docker Images - -on: - push: - branches: - - master - -jobs: - # Push image to GitHub Packages. - # See also https://docs.docker.com/docker-hub/builds/ - push: - runs-on: ubuntu-latest - if: github.event_name == 'push' - - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Build and Push docker image - env: - DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }} - DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} - run : make docker_push diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index e2c0e831..00000000 --- a/Dockerfile +++ /dev/null @@ -1,106 +0,0 @@ -FROM ubuntu:focal as app -MAINTAINER sre@edx.org - -# Packages installed: -# git -# Used to pull in particular requirements from github rather than pypi, -# and to check the sha of the code checkout. -# language-pack-en locales -# ubuntu locale support so that system utilities have a consistent -# language and time zone. -# python3-pip -# install pip to install application requirements.txt files -# pkg-config -# mysqlclient>=2.2.0 requires this (https://github.com/PyMySQL/mysqlclient/issues/620) -# libssl-dev -# mysqlclient wont install without this. -# libmysqlclient-dev -# to install header files needed to use native C implementation for -# MySQL-python for performance gains. - -ARG PYTHON_VERSION=3.12 -ENV TZ=UTC -ENV TERM=xterm-256color -ENV DEBIAN_FRONTEND=noninteractive - -# If you add a package here please include a comment above describing what it is used for -RUN apt-get update && \ - apt-get install -y software-properties-common && \ - apt-add-repository -y ppa:deadsnakes/ppa - -RUN apt-get update && apt-get -qy install --no-install-recommends \ - build-essential \ - language-pack-en \ - locales \ - pkg-config \ - libmysqlclient-dev \ - libssl-dev \ - libffi-dev \ - libsqlite3-dev \ - git \ - wget \ - python3.12 \ - python3.12-dev \ - python3.12-distutils \ - python3-pip - -RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone - -RUN curl -sS https://bootstrap.pypa.io/get-pip.py | python${PYTHON_VERSION} -RUN pip install virtualenv - -ENV VIRTUAL_ENV=/venv -RUN virtualenv -p python$PYTHON_VERSION $VIRTUAL_ENV -ENV PATH="$VIRTUAL_ENV/bin:$PATH" - -RUN pip install pip==24.0 setuptools==69.5.1 - -RUN locale-gen en_US.UTF-8 -ENV LANG en_US.UTF-8 -ENV LANGUAGE en_US:en -ENV LC_ALL en_US.UTF-8 -ENV DJANGO_SETTINGS_MODULE enterprise_catalog.settings.production - -# Prod ports -EXPOSE 8160 -EXPOSE 8161 - -RUN useradd -m --shell /bin/false app - -WORKDIR /edx/app/enterprise_catalog/enterprise_catalog - -COPY requirements/ /edx/app/enterprise_catalog/enterprise_catalog/requirements/ -RUN pip install -r /edx/app/enterprise_catalog/enterprise_catalog/requirements/production.txt - -# Code is owned by root so it cannot be modified by the application user. -# So we copy it before changing users. -USER app - -# Gunicorn 19 does not log to stdout or stderr by default. Once we are past gunicorn 19, the logging to STDOUT need not be specified. -CMD ["gunicorn", "--workers=2", "--name", "enterprise_catalog", "-c", "/edx/app/enterprise_catalog/enterprise_catalog/enterprise_catalog/docker_gunicorn_configuration.py", "--log-file", "-", "--max-requests=1000", "enterprise_catalog.wsgi:application"] - -# This line is after the requirements so that changes to the code will not -# bust the image cache -COPY . /edx/app/enterprise_catalog/enterprise_catalog - -############################################################### -# Create newrelic image used by the experimental docker shim. # -############################################################### -# TODO: remove this after we migrate to k8s since it will serve no more purpose. -FROM app as newrelic -RUN pip install newrelic -CMD ["newrelic-admin", "run-program", "gunicorn", "--workers=2", "--name", "enterprise_catalog", "-c", "/edx/app/enterprise_catalog/enterprise_catalog/enterprise_catalog/docker_gunicorn_configuration.py", "--log-file", "-", "--max-requests=1000", "enterprise_catalog.wsgi:application"] - -################################# -# Create image used by devstack # -################################# -# TODO: remove this after we migrate to k8s. It already isn't used today, but just defer changes until absolutely -# necessary for safety. -FROM app as legacy_devapp -# Dev ports -EXPOSE 18160 -EXPOSE 18161 -USER root -RUN pip install -r /edx/app/enterprise_catalog/enterprise_catalog/requirements/dev.txt -USER app -CMD ["gunicorn", "--reload", "--workers=2", "--name", "enterprise_catalog", "-b", ":18160", "-c", "/edx/app/enterprise_catalog/enterprise_catalog/enterprise_catalog/docker_gunicorn_configuration.py", "--log-file", "-", "--max-requests=1000", "enterprise_catalog.wsgi:application"] diff --git a/Makefile b/Makefile index 20e04564..0f0e50e7 100644 --- a/Makefile +++ b/Makefile @@ -141,9 +141,6 @@ start-devstack: ## run a local development copy of the server open-devstack: ## open a shell on the server started by start-devstack docker exec -it enterprise_catalog /edx/app/catalog/devstack.sh open -pkg-devstack: ## build the catalog image from the latest configuration and code - docker build -t enterprise_catalog:latest -f docker/build/enterprise_catalog/Dockerfile git://github.com/openedx/configuration - detect_changed_source_translations: ## check if translation files are up-to-date cd enterprise_catalog && i18n_tool changed @@ -164,15 +161,6 @@ dev.migrate: # Migrates databases. Application and DB server must be up for this dev.up: dev.up.redis # Starts all containers docker-compose up -d -dev.up.build: dev.up.redis # Runs docker-compose -up -d --build - docker-compose up -d --build - -dev.up.build-no-cache: dev.up.redis - docker-compose build --no-cache - docker-compose up -d - docker exec -u 0 -it enterprise.catalog.app pip install -r requirements/pip-tools.txt - docker exec -u 0 -it enterprise.catalog.app pip-sync -q requirements/dev.txt requirements/private.* requirements/test.txt - dev.up.redis: docker-compose -f $(DEVSTACK_WORKSPACE)/devstack/docker-compose.yml up -d redis @@ -215,23 +203,9 @@ mysql-client: # Opens mysql client in the mysql container shell dev.static: docker-compose exec -u 0 app python3 manage.py collectstatic --noinput -docker_build: ## Builds with the latest enterprise catalog - docker build . --target app -t openedx/enterprise-catalog:latest - docker build . --target newrelic -t openedx/enterprise-catalog:latest-newrelic - -docker_tag: docker_build - docker tag openedx/enterprise-catalog openedx/enterprise-catalog:$$GITHUB_SHA - docker tag openedx/enterprise-catalog:latest-newrelic openedx/enterprise-catalog:$$GITHUB_SHA-newrelic - docker_auth: echo "$$DOCKERHUB_PASSWORD" | docker login -u "$$DOCKERHUB_USERNAME" --password-stdin -docker_push: docker_tag docker_auth ## push to docker hub - docker push 'openedx/enterprise-catalog:latest' - docker push "openedx/enterprise-catalog:$$GITHUB_SHA" - docker push 'openedx/enterprise-catalog:latest-newrelic' - docker push "openedx/enterprise-catalog:$$GITHUB_SHA-newrelic" - check_keywords: ## Scan the Django models in all installed apps in this project for restricted field names python manage.py check_reserved_keywords --override_file db_keyword_overrides.yml diff --git a/docker-compose.yml b/docker-compose.yml index dcb323cc..7983a97a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -22,11 +22,7 @@ services: command: memcached -vv app: - # Uncomment this line to use the official catalog base image - # image: edxops/enterprise_catalog:devstack - build: - context: . - dockerfile: Dockerfile + image: edxops/enterprise-catalog-dev container_name: enterprise.catalog.app hostname: app.catalog.enterprise volumes: @@ -56,9 +52,7 @@ services: ENABLE_DJANGO_TOOLBAR: 1 worker: - build: - context: . - dockerfile: Dockerfile + image: edxops/enterprise-catalog-dev command: bash -c 'cd /edx/app/enterprise_catalog/enterprise_catalog && celery -A enterprise_catalog worker -Q enterprise_catalog.default -l DEBUG' container_name: enterprise.catalog.worker depends_on: @@ -84,9 +78,7 @@ services: - .:/edx/app/enterprise_catalog/enterprise_catalog curations_worker: - build: - context: . - dockerfile: Dockerfile + image: edxops/enterprise-catalog-dev command: bash -c 'cd /edx/app/enterprise_catalog/enterprise_catalog && celery -A enterprise_catalog worker -Q enterprise_catalog.curations -l DEBUG' container_name: enterprise.catalog.curations depends_on: diff --git a/provision-catalog.sh b/provision-catalog.sh index 908867f6..820609d0 100755 --- a/provision-catalog.sh +++ b/provision-catalog.sh @@ -1,10 +1,7 @@ name="enterprise_catalog" port="18160" -docker-compose up -d --build - -# Install requirements -# Can be skipped right now because we're using the --build flag on docker-compose. This will need to be changed once we move to devstack. +docker-compose up -d # Wait for MySQL echo "Waiting for MySQL"