Compare commits

...

20 Commits

Author SHA1 Message Date
Florian du Garage Num
d9867471a4 remove hard-coded uid 1000
Some checks failed
Sync with private repo / sync (push) Has been cancelled
Run tests / tests (3.12) (push) Has been cancelled
Run tests / tests (3.9) (push) Has been cancelled
2025-09-30 21:42:59 +02:00
Muhammad Labeeb
95fe3e3cc3
feat: migrate from pylint/black to ruff (#57)
* feat: migrate from pylint/black to ruff

* test: verify python package distribution build when running make test
2025-08-28 19:00:22 +05:00
MuPp3t33r
bc96768c69
fix: Update sync_users (#58)
* fix: Update sync_users

fix issue during "sync credentials.core_user to openedx.auth_user"
ERROR 1292 (22007) at line 1: Truncated incorrect DOUBLE value: 'FirstName'

MySQL does not use + to concatenate strings, so it was treated as a math equation instead.
2025-08-22 10:50:28 +05:00
Ahmed Khalid
66f81d0848
Merge pull request #56 from overhangio/teak 2025-06-27 18:24:20 +05:00
Muhammad Labeeb
802657547d v20.0.0 2025-06-05 18:11:57 +05:00
Syed Muhammad Dawoud Sheraz Ali
ad272f0cea
build: Add hatch_build in sdist to fix installation issues (#55) 2025-03-12 16:11:33 +05:00
Muhammad Labeeb
a5fea82a79
feat: migrate to pyproject.toml and hatch (#54)
* feat: migrate to pyproject.toml and hatch

* fix license and author

* update maintainer
2025-03-02 14:12:25 +05:00
Syed Muhammad Dawoud Sheraz Ali
ae6d24afff
build: re-add auto-add for PRs with a different target (#53) 2025-01-17 11:29:36 +05:00
Régis Behmo
e9ca793dfe
feat: Upgrade to Sumac 2024-12-16 21:10:53 +01:00
Syed Muhammad Dawoud Sheraz Ali
7fa4801fc8 chore: update changelog 2024-12-09 18:58:40 +05:00
Muhammad Faraz Maqsood
ab37979349 v19.0.0
upgrade to sumac
2024-11-29 22:29:41 +05:00
Régis Behmo
38ffb8ce63 Merge branch 'release' 2024-11-27 18:35:01 +01:00
Syed Muhammad Dawoud Sheraz Ali
065299db5a feat!: Rename branches master->release, nightly->main 2024-11-27 22:33:57 +05:00
Overhang.IO
c0c917b03f Merge remote-tracking branch 'origin/master' into nightly 2024-11-14 16:22:52 +00:00
Muhammad Faraz Maqsood
7e868688d7
chore: remove Python 3.8 references (#51)
- drop support for python 3.8 and set Python 3.9 as the minimum supported python version.

Co-authored-by: Muhammad Faraz  Maqsood <faraz.maqsood@192.168.10.36>
2024-11-14 21:10:13 +05:00
Overhang.IO
9181942eaf Merge remote-tracking branch 'origin/master' into nightly 2024-10-24 13:34:47 +00:00
Muhammad Faraz Maqsood
4c559d5382 fix: uwsgi workers not starting properly 2024-10-22 19:54:10 +05:00
Muhammad Faraz Maqsood
c72ffd819a feat: ubuntu upgrade to 24.04
- Update Credentials Image to use Ubuntu `24.04` as base OS.
- Change `APP_USER_ID` to 1001 as UID 1000 is now shipped by default.
- Add `mime-support` alternatives that are `media-types mailcap`.
- Update `python-openssl` to `python3-openssl`.
- add changelog entry.
2024-10-22 16:50:40 +05:00
Muhammad Faraz Maqsood
19140cc7d7 chore: revert change that skip arm64 image build
- As didkit issue is resolved in latest version which is being used in
upstream credential repo. So, reverting this change.
for context, see this comment: https://github.com/overhangio/tutor-credentials/issues/34#issuecomment-2291001545
2024-10-21 12:29:30 +05:00
Régis Behmo
0f039a2afc docs: *.local.edly.io -> *.local.openedx.io
The default URL to run a local platform switched from local.edly.io to
local.openedx.io. This changes makes it clearer for everyone that Tutor
is to run Open edX.

See: https://github.com/overhangio/tutor/issues/1120
2024-10-17 08:36:40 +02:00
18 changed files with 200 additions and 111 deletions

View File

@ -1,9 +1,12 @@
name: Auto Add Issues to Project
name: Auto Add Issues and Pull Requests to Project
on:
issues:
types:
- opened
pull_request_target:
types:
- opened
jobs:
# https://github.com/actions/add-to-project

View File

@ -2,7 +2,7 @@ name: Sync with private repo
on:
push:
branches: [ master, main, nightly ]
branches: [ release, main ]
jobs:
sync:

View File

@ -2,22 +2,22 @@ name: Run tests
on:
pull_request:
branches: [master]
branches: [ release, main ]
push:
branches: [ release, main ]
jobs:
tests:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.12']
python-version: ['3.9', '3.12']
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade pip
run: python -m pip install --upgrade pip setuptools
- name: Install dependencies
run: |
pip install .[dev]

22
.hatch_build.py Normal file
View File

@ -0,0 +1,22 @@
# https://hatch.pypa.io/latest/how-to/config/dynamic-metadata/
import os
import typing as t
from hatchling.metadata.plugin.interface import MetadataHookInterface
HERE = os.path.dirname(__file__)
class MetaDataHook(MetadataHookInterface):
def update(self, metadata: dict[str, t.Any]) -> None:
about = load_about()
metadata["version"] = about["__version__"]
def load_about() -> dict[str, str]:
about: dict[str, str] = {}
with open(
os.path.join(HERE, "tutorcredentials", "__about__.py"), "rt", encoding="utf-8"
) as f:
exec(f.read(), about)
return about

View File

@ -19,6 +19,31 @@ instructions, because git commits are used to generate release notes:
<!-- scriv-insert-here -->
<a id='changelog-20.0.0'></a>
## v20.0.0 (2025-06-05)
- [Improvement] Migrate packaging from setup.py/setuptools to pyproject.toml/hatch. (by @mlabeeb03)
- For more details view tutor core PR: https://github.com/overhangio/tutor/pull/1163
- [Improvement] Add hatch_build.py in sdist target to fix the installation issues (by @dawoudsheraz)
- 💥[Feature] Upgrade to Teak. (by @mlabeeb03)
<a id='changelog-19.0.0'></a>
## v19.0.0 (2024-10-23)
- 💥 [Deprecation] Drop support for python 3.8 and set Python 3.9 as the minimum supported python version. (by @Faraz32123)
- 💥[Improvement] Rename Tutor's two branches (by @DawoudSheraz):
* Rename **master** to **release**, as this branch runs the latest official Open edX release tag.
* Rename **nightly** to **main**, as this branch runs the Open edX master branches, which are the basis for the next Open edX release.
- 💥[Feature] Upgrade to Sumac. (by @Faraz32123)
- [BugFix] Uwsgi workers wasn't starting properly using `UWSGI_WORKERS` flag, passing the value directly fixes the issue. (by @Faraz32123)
- 💥[Feature] Update Credentials Image to use Ubuntu `24.04` as base OS. (by @Faraz32123)
- Add `mime-support` alternatives that are `media-types mailcap`.
- Update `python-openssl` to `python3-openssl`.
- [Bugfix] Fix legacy warnings during Docker build. (by @regisb)
<a id='changelog-18.0.0'></a>
## v18.0.0 (2024-06-07)

View File

@ -1,2 +0,0 @@
recursive-include tutorcredentials/patches *
recursive-include tutorcredentials/templates *

View File

@ -1,25 +1,30 @@
.DEFAULT_GOAL := help
.PHONY: docs
SRC_DIRS = ./tutorcredentials
BLACK_OPTS = --exclude templates ${SRC_DIRS}
# Warning: These checks are run on every PR.
test: test-lint test-types test-format # Run some static checks.
test: test-lint test-types test-format test-pythonpackage # Run some static checks.
test-format: ## Run code formatting tests.
black --check --diff $(BLACK_OPTS)
ruff format --check --diff ${SRC_DIRS}
test-lint: ## Run code linting tests
pylint --errors-only --enable=unused-import,unused-argument --ignore=templates --ignore=docs/_ext ${SRC_DIRS}
ruff check ${SRC_DIRS}
test-types: ## Run type checks.
mypy --exclude=templates --ignore-missing-imports --implicit-reexport --strict ${SRC_DIRS}
format: ## Format code automatically.
black $(BLACK_OPTS)
build-pythonpackage: ## Build the "tutor-credentials" python package for upload to pypi
python -m build --sdist
isort: ## Sort imports. This target is not mandatory because the output may be incompatible with black formatting. Provided for convenience purposes.
isort --skip=templates ${SRC_DIRS}
test-pythonpackage: build-pythonpackage ## Test that package can be uploaded to pypi
twine check dist/tutor_credentials-$(shell make version).tar.gz
format: ## Format code automatically.
ruff format ${SRC_DIRS}
fix-lint: ## Fix lint errors automatically
ruff check --fix ${SRC_DIRS}
changelog-entry: ## Create a new changelog entry.
scriv create
@ -27,6 +32,9 @@ changelog-entry: ## Create a new changelog entry.
changelog: ## Collect changelog entries in the CHANGELOG.md file.
scriv collect
version: ## Print the current tutor-credentials version
@python -c 'import io, os; about = {}; exec(io.open(os.path.join("tutorcredentials", "__about__.py"), "rt", encoding="utf-8").read(), about); print(about["__version__"])'
ESCAPE = 
help: ## Print this help.
@grep -E '^([a-zA-Z_-]+:.*?## .*|######* .+)$$' Makefile \

View File

@ -6,7 +6,7 @@ Credentials application supports course and program certificates. This plugin of
Note that user will have to create the course/program using `Discovery plugin <https://github.com/overhangio/tutor-discovery>`__. Then Credentials plugin will be used for certificates configurations.
.. image:: https://github.com/overhangio/tutor-credentials/blob/master/doc/django-admin-screen-shot.png
.. image:: https://github.com/overhangio/tutor-credentials/blob/release/doc/django-admin-screen-shot.png
:alt: Django Admin
Installation
@ -38,7 +38,7 @@ For Copying programs that user make in `Discovery plugin <https://github.com/ove
Using Django Admin
~~~~~~~~~~~~~~~~~~
The credentials user interface will be available at http://credentials.local.edly.io for a local instance, and at ``CREDENTIALS_HOST`` (by default: ``http(s)://credentials.<your lms host>``) in production. In order to run commands from the UI login with an admin user at: http://credentials.local.edly.io/admin/. User should be able to authenticate with the same username and password that he used for his lms.
The credentials user interface will be available at http://credentials.local.openedx.io for a local instance, and at ``CREDENTIALS_HOST`` (by default: ``http(s)://credentials.<your lms host>``) in production. In order to run commands from the UI login with an admin user at: http://credentials.local.openedx.io/admin/. User should be able to authenticate with the same username and password that he used for his lms.
User can also create superuser for credentials using the below command
::
@ -47,7 +47,7 @@ User can also create superuser for credentials using the below command
Learner Record UI
-----------------
.. image:: https://github.com/overhangio/tutor-credentials/blob/master/doc/learner-record.png
.. image:: https://github.com/overhangio/tutor-credentials/blob/release/doc/learner-record.png
:alt: Learner Record MFE screenshot
This plugin installs and enables the `Learner Record MFE <https://github.com/openedx/frontend-app-learner-record>`__ by default. It contains views for a learners current status in a program, their current grade, and the ability to share any earned credentials either publically or with institutions.
@ -91,7 +91,7 @@ Application Third party authentication
Learner Record UI configuration
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The Learner Record is configurable dynamically via runtime configuration. To change any of the variables below, go to your LMS's Django admin Site Configuration page (for instance, http://local.edly.io/admin/site_configuration/siteconfiguration/) and add or modify corresponding JSON dict entries in the appropriate site:
The Learner Record is configurable dynamically via runtime configuration. To change any of the variables below, go to your LMS's Django admin Site Configuration page (for instance, http://local.openedx.io/admin/site_configuration/siteconfiguration/) and add or modify corresponding JSON dict entries in the appropriate site:
- ``SUPPORT_URL_LEARNER_RECORDS`` (default: ``""``): the URL the learner is taken to when clicking the "read more in our records help area" link.
@ -107,9 +107,9 @@ This plugin was initially developed and open sourced to the community thanks to
Troubleshooting
---------------
This Tutor plugin is maintained by Muhammad Faraz Maqsood from `Edly <https://edly.io/>`__. Community support is available from the official `Open edX forum <https://discuss.openedx.org>`__. Do you need help with this plugin? See the `troubleshooting <https://docs.tutor.edly.io/troubleshooting.html>`__ section from the Tutor documentation.
This Tutor plugin is maintained by Muhammad Labeeb from `Edly <https://edly.io/>`__. Community support is available from the official `Open edX forum <https://discuss.openedx.org>`__. Do you need help with this plugin? See the `troubleshooting <https://docs.tutor.edly.io/troubleshooting.html>`__ section from the Tutor documentation.
License
-------
This software is licensed under the terms of the `GNU Affero General Public License (AGPL) <https://github.com/overhangio/tutor-credentials/blob/master/LICENSE.txt>`_.
This software is licensed under the terms of the `GNU Affero General Public License (AGPL) <https://github.com/overhangio/tutor-credentials/blob/release/LICENSE.txt>`_.

View File

@ -1 +0,0 @@
- [Bugfix] Fix legacy warnings during Docker build. (by @regisb)

View File

@ -0,0 +1,2 @@
- [Improvement] Migrate from pylint and black to ruff. (by @mlabeeb03)
- [Improvement] Test python package distribution build when running make test. (by @mlabeeb03)

View File

@ -0,0 +1,2 @@
- [Bugfix] Fixed an issue when syncing `credentials.core_user` to `openedx.auth_user` where the `full_name` field population failed with `ERROR 1292 (22007): Truncated incorrect DOUBLE value: 'FirstName'`.
MySQL does not support string concatenation with `+`, so it was incorrectly treated as a numeric operation. Updated to use `CONCAT()` for proper string concatenation.

View File

@ -1,2 +1,86 @@
# https://packaging.python.org/en/latest/tutorials/packaging-projects/
# https://hatch.pypa.io/latest/config/build/
[project]
name = "tutor-credentials"
license = { text = "AGPL-3.0-only" }
authors = [
{name = "Lawrence McDaniel"},
{email = "lpm0073@gmail.com"},
]
maintainers = [
{name = "Muhammad Labeeb"},
{email = "muhammad.labeeb@arbisoft.com"},
]
description = "A Tutor plugin for Open edX Credentials service"
readme = {file = "README.rst", content-type = "text/x-rst"}
requires-python = ">= 3.9"
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU Affero General Public License v3",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
dependencies = [
"tutor>=20.0.0,<21.0.0",
"tutor-discovery>=20.0.0,<21.0.0",
"tutor-mfe>=20.0.0,<21.0.0"
]
# these fields will be set by hatch_build.py
dynamic = ["version"]
[project.optional-dependencies]
dev = [
"tutor[dev]>=20.0.0,<21.0.0",
"ruff",
]
[project.entry-points."tutor.plugin.v1"]
credentials = "tutorcredentials.plugin"
# https://packaging.python.org/en/latest/specifications/well-known-project-urls/#well-known-labels
[project.urls]
Homepage = "https://docs.tutor.edly.io/"
Documentation = "https://docs.tutor.edly.io/"
Code = "https://github.com/overhangio/tutor-credentials"
Issues = "https://github.com/overhangio/tutor-credentials.git/issues"
Changelog = "https://github.com/overhangio/tutor-credentials/blob/release/CHANGELOG.md"
Community = "https://discuss.openedx.org/tag/tutor"
# hatch-specific configuration
[tool.hatch.metadata.hooks.custom]
path = ".hatch_build.py"
[build-system]
requires = ["setuptools", "wheel"]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.hatch.build.targets.sdist]
# Disable strict naming, otherwise twine is not able to detect name/version
strict-naming = false
include = [ "/tutorcredentials", '.hatch_build.py']
exclude = ["tests*"]
[tool.hatch.build.targets.wheel]
packages = ["tutorcredentials"]
[tool.ruff]
exclude = ["templates", "docs/_ext"]
[tool.ruff.lint]
# E: pycodestyle errors
# I: isort
# N: pep8-naming
select = ["E", "I", "N"]
# F401: unused-import
# F841: unused-variable
# W292: missing-newline-at-end-of-file
extend-select = ["F401", "F841", "W292"]
[tool.ruff.format]

View File

@ -1,62 +0,0 @@
import io
import os
from setuptools import setup, find_packages
HERE = os.path.abspath(os.path.dirname(__file__))
def load_readme():
with io.open(os.path.join(HERE, "README.rst"), "rt", encoding="utf8") as f:
return f.read()
def load_about():
about = {}
with io.open(
os.path.join(HERE, "tutorcredentials", "__about__.py"),
"rt",
encoding="utf-8",
) as f:
exec(f.read(), about) # pylint: disable=exec-used
return about
ABOUT = load_about()
setup(
name="tutor-credentials",
version=ABOUT["__version__"],
url="https://github.com/overhangio/tutor-credentials.git",
project_urls={
"Code": "https://github.com/overhangio/tutor-credentials.git",
"Issue tracker": "https://github.com/overhangio/tutor-credentials.git/issues",
"Community": "https://discuss.overhang.io",
},
license="AGPLv3",
author="Lawrence McDaniel",
author_email="lpm0073@gmail.com",
maintainer="Edly",
maintainer_email="faraz.maqsood@arbisoft.com",
description="A Tutor plugin for Open edX Credentials service",
long_description=load_readme(),
long_description_content_type="text/x-rst",
packages=find_packages(exclude=["tests*"]),
include_package_data=True,
python_requires=">=3.8",
install_requires=["tutor>=18.0.0,<19.0.0", "tutor-discovery>=18.0.0,<19.0.0", "tutor-mfe>=18.0.0,<19.0.0"],
extras_require={"dev": ["tutor[dev]>=18.0.0,<19.0.0"]},
entry_points={"tutor.plugin.v1": ["credentials = tutorcredentials.plugin"]},
classifiers=[
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU Affero General Public License v3",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
],
)

View File

@ -1 +1 @@
__version__ = "18.0.0"
__version__ = "20.0.0"

View File

@ -15,8 +15,8 @@ spec:
app.kubernetes.io/name: credentials
spec:
securityContext:
runAsUser: 1000
runAsGroup: 1000
runAsUser: {{ APP_USER_ID }}
runAsGroup: {{ APP_USER_ID }}
containers:
- name: credentials
image: {{ CREDENTIALS_DOCKER_IMAGE }}

View File

@ -11,7 +11,7 @@ from tutormfe.hooks import MFE_APPS, MFE_ATTRS_TYPE
from .__about__ import __version__
# Handle version suffix in nightly mode, just like tutor core
# Handle version suffix in main mode, just like tutor core
if __version_suffix__:
__version__ += "-" + __version_suffix__
@ -24,7 +24,7 @@ config: t.Dict[str, t.Dict[str, t.Any]] = {
"defaults": {
"VERSION": __version__,
"BACKEND_SERVICE_EDX_OAUTH2_KEY": "{{ CREDENTIALS_OAUTH2_KEY }}",
"DOCKER_IMAGE": "{{ DOCKER_REGISTRY }}overhangio/openedx-credentials:{{ CREDENTIALS_VERSION }}",
"DOCKER_IMAGE": "{{ DOCKER_REGISTRY }}overhangio/openedx-credentials:{{ CREDENTIALS_VERSION }}", # noqa: E501
"EXTRA_PIP_REQUIREMENTS": [],
"HOST": "credentials.{{ LMS_HOST }}",
"MYSQL_DATABASE": "credentials",
@ -68,7 +68,7 @@ tutor_hooks.Filters.CONFIG_OVERRIDES.add_items(
@MFE_APPS.add() # type: ignore
def _add_learner_record_mfe(
apps: dict[str, MFE_ATTRS_TYPE]
apps: dict[str, MFE_ATTRS_TYPE],
) -> dict[str, MFE_ATTRS_TYPE]:
apps.update(
{

View File

@ -1,8 +1,12 @@
# syntax=docker/dockerfile:1
###### Minimal image with base system requirements for most stages
FROM docker.io/ubuntu:20.04 AS minimal
FROM docker.io/ubuntu:24.04 AS minimal
ENV DEBIAN_FRONTEND=noninteractive
# Delete default UID=1000 `ubuntu` user to ensure we can use id 1000 for app user
RUN userdel -r ubuntu
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
apt update && \
@ -11,7 +15,6 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
ENV LC_ALL=en_US.UTF-8
{{ patch("credentials-dockerfile-minimal") }}
###### Install python with pyenv in /opt/pyenv and create virtualenv in /openedx/venv
FROM minimal AS python
# https://github.com/pyenv/pyenv/wiki/Common-build-problems#prerequisites
@ -19,7 +22,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked apt update && \
apt install -y libssl-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \
xz-utils tk-dev libffi-dev liblzma-dev python-openssl git
xz-utils tk-dev libffi-dev liblzma-dev python3-openssl git
# Install pyenv
# https://www.python.org/downloads/
@ -36,6 +39,9 @@ RUN $PYENV_ROOT/versions/$PYTHON_VERSION/bin/python -m venv /openedx/venv
###### Checkout credentials
FROM minimal AS code
# Below warnings will occurr due to the variable name(have word "credentials" in it).
# - SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data (ARG "CREDENTIALS_REPOSITORY") (line 41)
# - SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data (ARG "CREDENTIALS_VERSION") (line 42)
ARG CREDENTIALS_REPOSITORY="{{ CREDENTIALS_REPOSITORY }}"
ARG CREDENTIALS_VERSION="{{ CREDENTIALS_REPOSITORY_VERSION }}"
RUN mkdir -p /openedx/credentials && \
@ -64,7 +70,7 @@ RUN --mount=type=cache,target=/openedx/.cache/pip,sharing=shared pip install \
# https://pypi.org/project/setuptools/
# https://pypi.org/project/pip/
# https://pypi.org/project/wheel/
setuptools==69.1.1 pip==24.0 wheel==0.43.0
setuptools==77.0.3 pip==25.0.1 wheel==0.45.1
# Install base requirements
RUN --mount=type=cache,target=/openedx/.cache/pip,sharing=shared pip install -r requirements/production.txt
@ -74,7 +80,7 @@ RUN --mount=type=cache,target=/openedx/.cache/pip,sharing=shared pip install \
# Use redis as a django cache https://pypi.org/project/django-redis/
django-redis==5.4.0 \
# uwsgi server https://pypi.org/project/uWSGI/
uwsgi==2.0.24
uwsgi==2.0.28
{{ patch("credentials-dockerfile-post-python-requirements") }}
@ -102,15 +108,15 @@ FROM minimal AS production
# Install system requirements
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked apt update \
&& apt install -y libxml2 libmysqlclient-dev mime-support
&& apt install -y libxml2 libmysqlclient-dev media-types mailcap
# From then on, run as unprivileged "app" user
ARG APP_USER_ID=1000
ARG APP_USER_ID={{ HOST_USER_ID }}
RUN if [ "$APP_USER_ID" = 0 ]; then echo "app user may not be root" && false; fi
RUN useradd --home-dir /openedx --create-home --shell /bin/bash --uid ${APP_USER_ID} app
USER ${APP_USER_ID}
# change file ownership to the new app user
# Change file ownership to the new app user
COPY --chown=app:app --from=code /openedx/credentials /openedx/credentials
COPY --chown=app:app --from=python /opt/pyenv /opt/pyenv
COPY --chown=app:app --from=python-requirements /openedx/venv /openedx/venv
@ -129,6 +135,8 @@ RUN python manage.py compilemessages
# Setup minimal yml config file, which is required by production settings
RUN echo "{}" > /openedx/config.yml
# Below warning will occurr due to the variable name(have word "credentials" in it).
# - SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data (ENV "CREDENTIALS_CFG") (line 136)
ENV CREDENTIALS_CFG=/openedx/config.yml
{{ patch("credentials-dockerfile-pre-assets") }}
@ -152,13 +160,13 @@ EXPOSE 8000
###### Final image with production cmd
FROM production AS final
CMD uwsgi \
--static-map /static=/openedx/credentials/credentials/assets \
--static-map /media=/openedx/credentials/credentials/media \
--http 0.0.0.0:8000 \
--thunder-lock \
--single-interpreter \
--enable-threads \
--processes=${UWSGI_WORKERS:-2} \
--buffer-size=8192 \
--wsgi-file credentials/wsgi.py
CMD ["uwsgi", \
"--static-map", "/static=/openedx/credentials/credentials/assets", \
"--static-map", "/media=/openedx/credentials/credentials/media", \
"--http", "0.0.0.0:8000", \
"--thunder-lock", \
"--single-interpreter", \
"--enable-threads", \
"--processes=2", \
"--buffer-size=8192", \
"--wsgi-file", "credentials/wsgi.py"]

View File

@ -11,7 +11,7 @@ INSERT {{ CREDENTIALS_MYSQL_DATABASE }}.core_user (password, last_login, is_supe
lms_user.is_staff, \
lms_user.is_active, \
lms_user.date_joined, \
CASE WHEN NOT ISNULL(lms_profile.name) THEN lms_profile.name ELSE lms_user.first_name + ' ' + lms_user.last_name END as full_name, \
CASE WHEN NOT ISNULL(lms_profile.name) THEN lms_profile.name ELSE CONCAT(lms_user.first_name, ' ', lms_user.last_name) END as full_name, \
lms_user.id as lms_user_id \
FROM {{ OPENEDX_MYSQL_DATABASE }}.auth_user lms_user \
LEFT JOIN {{ OPENEDX_MYSQL_DATABASE }}.auth_userprofile as lms_profile ON (lms_user.id = lms_profile.user_id) \