Compare commits
1 Commits
release
...
feat/remov
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7f2b681cb5 |
5
.github/workflows/auto-add-to-project.yml
vendored
5
.github/workflows/auto-add-to-project.yml
vendored
@ -1,12 +1,9 @@
|
|||||||
name: Auto Add Issues and Pull Requests to Project
|
name: Auto Add Issues to Project
|
||||||
|
|
||||||
on:
|
on:
|
||||||
issues:
|
issues:
|
||||||
types:
|
types:
|
||||||
- opened
|
- opened
|
||||||
pull_request_target:
|
|
||||||
types:
|
|
||||||
- opened
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# https://github.com/actions/add-to-project
|
# https://github.com/actions/add-to-project
|
||||||
|
|||||||
2
.github/workflows/sync.yml
vendored
2
.github/workflows/sync.yml
vendored
@ -2,7 +2,7 @@ name: Sync with private repo
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ release, main ]
|
branches: [ master, main, nightly ]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
sync:
|
sync:
|
||||||
|
|||||||
6
.github/workflows/test.yml
vendored
6
.github/workflows/test.yml
vendored
@ -2,9 +2,7 @@ name: Run tests
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ release, main ]
|
branches: [master]
|
||||||
push:
|
|
||||||
branches: [ release, main ]
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
tests:
|
tests:
|
||||||
@ -18,6 +16,8 @@ jobs:
|
|||||||
uses: actions/setup-python@v5
|
uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: ${{ matrix.python-version }}
|
python-version: ${{ matrix.python-version }}
|
||||||
|
- name: Upgrade pip
|
||||||
|
run: python -m pip install --upgrade pip setuptools
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
pip install .[dev]
|
pip install .[dev]
|
||||||
|
|||||||
@ -1,22 +0,0 @@
|
|||||||
# 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
|
|
||||||
25
CHANGELOG.md
25
CHANGELOG.md
@ -19,31 +19,6 @@ instructions, because git commits are used to generate release notes:
|
|||||||
|
|
||||||
<!-- scriv-insert-here -->
|
<!-- 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>
|
<a id='changelog-18.0.0'></a>
|
||||||
## v18.0.0 (2024-06-07)
|
## v18.0.0 (2024-06-07)
|
||||||
|
|
||||||
|
|||||||
2
MANIFEST.in
Normal file
2
MANIFEST.in
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
recursive-include tutorcredentials/patches *
|
||||||
|
recursive-include tutorcredentials/templates *
|
||||||
22
Makefile
22
Makefile
@ -1,30 +1,25 @@
|
|||||||
.DEFAULT_GOAL := help
|
.DEFAULT_GOAL := help
|
||||||
.PHONY: docs
|
.PHONY: docs
|
||||||
SRC_DIRS = ./tutorcredentials
|
SRC_DIRS = ./tutorcredentials
|
||||||
|
BLACK_OPTS = --exclude templates ${SRC_DIRS}
|
||||||
|
|
||||||
# Warning: These checks are run on every PR.
|
# Warning: These checks are run on every PR.
|
||||||
test: test-lint test-types test-format test-pythonpackage # Run some static checks.
|
test: test-lint test-types test-format # Run some static checks.
|
||||||
|
|
||||||
test-format: ## Run code formatting tests.
|
test-format: ## Run code formatting tests.
|
||||||
ruff format --check --diff ${SRC_DIRS}
|
black --check --diff $(BLACK_OPTS)
|
||||||
|
|
||||||
test-lint: ## Run code linting tests
|
test-lint: ## Run code linting tests
|
||||||
ruff check ${SRC_DIRS}
|
pylint --errors-only --enable=unused-import,unused-argument --ignore=templates --ignore=docs/_ext ${SRC_DIRS}
|
||||||
|
|
||||||
test-types: ## Run type checks.
|
test-types: ## Run type checks.
|
||||||
mypy --exclude=templates --ignore-missing-imports --implicit-reexport --strict ${SRC_DIRS}
|
mypy --exclude=templates --ignore-missing-imports --implicit-reexport --strict ${SRC_DIRS}
|
||||||
|
|
||||||
build-pythonpackage: ## Build the "tutor-credentials" python package for upload to pypi
|
|
||||||
python -m build --sdist
|
|
||||||
|
|
||||||
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.
|
format: ## Format code automatically.
|
||||||
ruff format ${SRC_DIRS}
|
black $(BLACK_OPTS)
|
||||||
|
|
||||||
fix-lint: ## Fix lint errors automatically
|
isort: ## Sort imports. This target is not mandatory because the output may be incompatible with black formatting. Provided for convenience purposes.
|
||||||
ruff check --fix ${SRC_DIRS}
|
isort --skip=templates ${SRC_DIRS}
|
||||||
|
|
||||||
changelog-entry: ## Create a new changelog entry.
|
changelog-entry: ## Create a new changelog entry.
|
||||||
scriv create
|
scriv create
|
||||||
@ -32,9 +27,6 @@ changelog-entry: ## Create a new changelog entry.
|
|||||||
changelog: ## Collect changelog entries in the CHANGELOG.md file.
|
changelog: ## Collect changelog entries in the CHANGELOG.md file.
|
||||||
scriv collect
|
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 =
|
ESCAPE =
|
||||||
help: ## Print this help.
|
help: ## Print this help.
|
||||||
@grep -E '^([a-zA-Z_-]+:.*?## .*|######* .+)$$' Makefile \
|
@grep -E '^([a-zA-Z_-]+:.*?## .*|######* .+)$$' Makefile \
|
||||||
|
|||||||
12
README.rst
12
README.rst
@ -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.
|
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/release/doc/django-admin-screen-shot.png
|
.. image:: https://github.com/overhangio/tutor-credentials/blob/master/doc/django-admin-screen-shot.png
|
||||||
:alt: Django Admin
|
:alt: Django Admin
|
||||||
|
|
||||||
Installation
|
Installation
|
||||||
@ -38,7 +38,7 @@ For Copying programs that user make in `Discovery plugin <https://github.com/ove
|
|||||||
Using Django Admin
|
Using Django Admin
|
||||||
~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
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.
|
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.
|
||||||
User can also create superuser for credentials using the below command
|
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
|
Learner Record UI
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
.. image:: https://github.com/overhangio/tutor-credentials/blob/release/doc/learner-record.png
|
.. image:: https://github.com/overhangio/tutor-credentials/blob/master/doc/learner-record.png
|
||||||
:alt: Learner Record MFE screenshot
|
: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.
|
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
|
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.openedx.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.edly.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.
|
- ``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
|
Troubleshooting
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
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.
|
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.
|
||||||
|
|
||||||
License
|
License
|
||||||
-------
|
-------
|
||||||
|
|
||||||
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>`_.
|
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>`_.
|
||||||
|
|||||||
1
changelog.d/20240621_170044_regis.md
Normal file
1
changelog.d/20240621_170044_regis.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
- [Bugfix] Fix legacy warnings during Docker build. (by @regisb)
|
||||||
@ -0,0 +1 @@
|
|||||||
|
- 💥 [Deprecation] Drop support for python 3.8 and set Python 3.9 as the minimum supported python version. (by @Faraz32123)
|
||||||
@ -1,2 +0,0 @@
|
|||||||
- [Improvement] Migrate from pylint and black to ruff. (by @mlabeeb03)
|
|
||||||
- [Improvement] Test python package distribution build when running make test. (by @mlabeeb03)
|
|
||||||
@ -1,2 +0,0 @@
|
|||||||
- [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.
|
|
||||||
@ -1,86 +1,2 @@
|
|||||||
# 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]
|
[build-system]
|
||||||
requires = ["hatchling"]
|
requires = ["setuptools", "wheel"]
|
||||||
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]
|
|
||||||
|
|||||||
61
setup.py
Normal file
61
setup.py
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
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.9",
|
||||||
|
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.9",
|
||||||
|
"Programming Language :: Python :: 3.10",
|
||||||
|
"Programming Language :: Python :: 3.11",
|
||||||
|
"Programming Language :: Python :: 3.12",
|
||||||
|
],
|
||||||
|
)
|
||||||
@ -1 +1 @@
|
|||||||
__version__ = "20.0.0"
|
__version__ = "18.0.0"
|
||||||
|
|||||||
@ -15,8 +15,8 @@ spec:
|
|||||||
app.kubernetes.io/name: credentials
|
app.kubernetes.io/name: credentials
|
||||||
spec:
|
spec:
|
||||||
securityContext:
|
securityContext:
|
||||||
runAsUser: {{ APP_USER_ID }}
|
runAsUser: 1000
|
||||||
runAsGroup: {{ APP_USER_ID }}
|
runAsGroup: 1000
|
||||||
containers:
|
containers:
|
||||||
- name: credentials
|
- name: credentials
|
||||||
image: {{ CREDENTIALS_DOCKER_IMAGE }}
|
image: {{ CREDENTIALS_DOCKER_IMAGE }}
|
||||||
|
|||||||
@ -11,7 +11,7 @@ from tutormfe.hooks import MFE_APPS, MFE_ATTRS_TYPE
|
|||||||
|
|
||||||
from .__about__ import __version__
|
from .__about__ import __version__
|
||||||
|
|
||||||
# Handle version suffix in main mode, just like tutor core
|
# Handle version suffix in nightly mode, just like tutor core
|
||||||
if __version_suffix__:
|
if __version_suffix__:
|
||||||
__version__ += "-" + __version_suffix__
|
__version__ += "-" + __version_suffix__
|
||||||
|
|
||||||
@ -24,7 +24,7 @@ config: t.Dict[str, t.Dict[str, t.Any]] = {
|
|||||||
"defaults": {
|
"defaults": {
|
||||||
"VERSION": __version__,
|
"VERSION": __version__,
|
||||||
"BACKEND_SERVICE_EDX_OAUTH2_KEY": "{{ CREDENTIALS_OAUTH2_KEY }}",
|
"BACKEND_SERVICE_EDX_OAUTH2_KEY": "{{ CREDENTIALS_OAUTH2_KEY }}",
|
||||||
"DOCKER_IMAGE": "{{ DOCKER_REGISTRY }}overhangio/openedx-credentials:{{ CREDENTIALS_VERSION }}", # noqa: E501
|
"DOCKER_IMAGE": "{{ DOCKER_REGISTRY }}overhangio/openedx-credentials:{{ CREDENTIALS_VERSION }}",
|
||||||
"EXTRA_PIP_REQUIREMENTS": [],
|
"EXTRA_PIP_REQUIREMENTS": [],
|
||||||
"HOST": "credentials.{{ LMS_HOST }}",
|
"HOST": "credentials.{{ LMS_HOST }}",
|
||||||
"MYSQL_DATABASE": "credentials",
|
"MYSQL_DATABASE": "credentials",
|
||||||
@ -68,7 +68,7 @@ tutor_hooks.Filters.CONFIG_OVERRIDES.add_items(
|
|||||||
|
|
||||||
@MFE_APPS.add() # type: ignore
|
@MFE_APPS.add() # type: ignore
|
||||||
def _add_learner_record_mfe(
|
def _add_learner_record_mfe(
|
||||||
apps: dict[str, MFE_ATTRS_TYPE],
|
apps: dict[str, MFE_ATTRS_TYPE]
|
||||||
) -> dict[str, MFE_ATTRS_TYPE]:
|
) -> dict[str, MFE_ATTRS_TYPE]:
|
||||||
apps.update(
|
apps.update(
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,12 +1,8 @@
|
|||||||
# syntax=docker/dockerfile:1
|
# syntax=docker/dockerfile:1
|
||||||
###### Minimal image with base system requirements for most stages
|
###### Minimal image with base system requirements for most stages
|
||||||
FROM docker.io/ubuntu:24.04 AS minimal
|
FROM docker.io/ubuntu:20.04 AS minimal
|
||||||
|
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
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 \
|
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
|
||||||
--mount=type=cache,target=/var/lib/apt,sharing=locked \
|
--mount=type=cache,target=/var/lib/apt,sharing=locked \
|
||||||
apt update && \
|
apt update && \
|
||||||
@ -15,6 +11,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
|
|||||||
ENV LC_ALL=en_US.UTF-8
|
ENV LC_ALL=en_US.UTF-8
|
||||||
{{ patch("credentials-dockerfile-minimal") }}
|
{{ patch("credentials-dockerfile-minimal") }}
|
||||||
|
|
||||||
|
|
||||||
###### Install python with pyenv in /opt/pyenv and create virtualenv in /openedx/venv
|
###### Install python with pyenv in /opt/pyenv and create virtualenv in /openedx/venv
|
||||||
FROM minimal AS python
|
FROM minimal AS python
|
||||||
# https://github.com/pyenv/pyenv/wiki/Common-build-problems#prerequisites
|
# https://github.com/pyenv/pyenv/wiki/Common-build-problems#prerequisites
|
||||||
@ -22,7 +19,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
|
|||||||
--mount=type=cache,target=/var/lib/apt,sharing=locked apt update && \
|
--mount=type=cache,target=/var/lib/apt,sharing=locked apt update && \
|
||||||
apt install -y libssl-dev zlib1g-dev libbz2-dev \
|
apt install -y libssl-dev zlib1g-dev libbz2-dev \
|
||||||
libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \
|
libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \
|
||||||
xz-utils tk-dev libffi-dev liblzma-dev python3-openssl git
|
xz-utils tk-dev libffi-dev liblzma-dev python-openssl git
|
||||||
|
|
||||||
# Install pyenv
|
# Install pyenv
|
||||||
# https://www.python.org/downloads/
|
# https://www.python.org/downloads/
|
||||||
@ -39,9 +36,6 @@ RUN $PYENV_ROOT/versions/$PYTHON_VERSION/bin/python -m venv /openedx/venv
|
|||||||
|
|
||||||
###### Checkout credentials
|
###### Checkout credentials
|
||||||
FROM minimal AS code
|
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_REPOSITORY="{{ CREDENTIALS_REPOSITORY }}"
|
||||||
ARG CREDENTIALS_VERSION="{{ CREDENTIALS_REPOSITORY_VERSION }}"
|
ARG CREDENTIALS_VERSION="{{ CREDENTIALS_REPOSITORY_VERSION }}"
|
||||||
RUN mkdir -p /openedx/credentials && \
|
RUN mkdir -p /openedx/credentials && \
|
||||||
@ -70,7 +64,7 @@ RUN --mount=type=cache,target=/openedx/.cache/pip,sharing=shared pip install \
|
|||||||
# https://pypi.org/project/setuptools/
|
# https://pypi.org/project/setuptools/
|
||||||
# https://pypi.org/project/pip/
|
# https://pypi.org/project/pip/
|
||||||
# https://pypi.org/project/wheel/
|
# https://pypi.org/project/wheel/
|
||||||
setuptools==77.0.3 pip==25.0.1 wheel==0.45.1
|
setuptools==69.1.1 pip==24.0 wheel==0.43.0
|
||||||
|
|
||||||
# Install base requirements
|
# Install base requirements
|
||||||
RUN --mount=type=cache,target=/openedx/.cache/pip,sharing=shared pip install -r requirements/production.txt
|
RUN --mount=type=cache,target=/openedx/.cache/pip,sharing=shared pip install -r requirements/production.txt
|
||||||
@ -80,7 +74,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/
|
# Use redis as a django cache https://pypi.org/project/django-redis/
|
||||||
django-redis==5.4.0 \
|
django-redis==5.4.0 \
|
||||||
# uwsgi server https://pypi.org/project/uWSGI/
|
# uwsgi server https://pypi.org/project/uWSGI/
|
||||||
uwsgi==2.0.28
|
uwsgi==2.0.24
|
||||||
|
|
||||||
{{ patch("credentials-dockerfile-post-python-requirements") }}
|
{{ patch("credentials-dockerfile-post-python-requirements") }}
|
||||||
|
|
||||||
@ -108,15 +102,15 @@ FROM minimal AS production
|
|||||||
# Install system requirements
|
# Install system requirements
|
||||||
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
|
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
|
||||||
--mount=type=cache,target=/var/lib/apt,sharing=locked apt update \
|
--mount=type=cache,target=/var/lib/apt,sharing=locked apt update \
|
||||||
&& apt install -y libxml2 libmysqlclient-dev media-types mailcap
|
&& apt install -y libxml2 libmysqlclient-dev mime-support
|
||||||
|
|
||||||
# From then on, run as unprivileged "app" user
|
# From then on, run as unprivileged "app" user
|
||||||
ARG APP_USER_ID={{ HOST_USER_ID }}
|
ARG APP_USER_ID=1000
|
||||||
RUN if [ "$APP_USER_ID" = 0 ]; then echo "app user may not be root" && false; fi
|
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
|
RUN useradd --home-dir /openedx --create-home --shell /bin/bash --uid ${APP_USER_ID} app
|
||||||
USER ${APP_USER_ID}
|
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=code /openedx/credentials /openedx/credentials
|
||||||
COPY --chown=app:app --from=python /opt/pyenv /opt/pyenv
|
COPY --chown=app:app --from=python /opt/pyenv /opt/pyenv
|
||||||
COPY --chown=app:app --from=python-requirements /openedx/venv /openedx/venv
|
COPY --chown=app:app --from=python-requirements /openedx/venv /openedx/venv
|
||||||
@ -135,8 +129,6 @@ RUN python manage.py compilemessages
|
|||||||
|
|
||||||
# Setup minimal yml config file, which is required by production settings
|
# Setup minimal yml config file, which is required by production settings
|
||||||
RUN echo "{}" > /openedx/config.yml
|
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
|
ENV CREDENTIALS_CFG=/openedx/config.yml
|
||||||
|
|
||||||
{{ patch("credentials-dockerfile-pre-assets") }}
|
{{ patch("credentials-dockerfile-pre-assets") }}
|
||||||
@ -160,13 +152,13 @@ EXPOSE 8000
|
|||||||
###### Final image with production cmd
|
###### Final image with production cmd
|
||||||
FROM production AS final
|
FROM production AS final
|
||||||
|
|
||||||
CMD ["uwsgi", \
|
CMD uwsgi \
|
||||||
"--static-map", "/static=/openedx/credentials/credentials/assets", \
|
--static-map /static=/openedx/credentials/credentials/assets \
|
||||||
"--static-map", "/media=/openedx/credentials/credentials/media", \
|
--static-map /media=/openedx/credentials/credentials/media \
|
||||||
"--http", "0.0.0.0:8000", \
|
--http 0.0.0.0:8000 \
|
||||||
"--thunder-lock", \
|
--thunder-lock \
|
||||||
"--single-interpreter", \
|
--single-interpreter \
|
||||||
"--enable-threads", \
|
--enable-threads \
|
||||||
"--processes=2", \
|
--processes=${UWSGI_WORKERS:-2} \
|
||||||
"--buffer-size=8192", \
|
--buffer-size=8192 \
|
||||||
"--wsgi-file", "credentials/wsgi.py"]
|
--wsgi-file credentials/wsgi.py
|
||||||
|
|||||||
@ -11,7 +11,7 @@ INSERT {{ CREDENTIALS_MYSQL_DATABASE }}.core_user (password, last_login, is_supe
|
|||||||
lms_user.is_staff, \
|
lms_user.is_staff, \
|
||||||
lms_user.is_active, \
|
lms_user.is_active, \
|
||||||
lms_user.date_joined, \
|
lms_user.date_joined, \
|
||||||
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, \
|
CASE WHEN NOT ISNULL(lms_profile.name) THEN lms_profile.name ELSE lms_user.first_name + ' ' + lms_user.last_name END as full_name, \
|
||||||
lms_user.id as lms_user_id \
|
lms_user.id as lms_user_id \
|
||||||
FROM {{ OPENEDX_MYSQL_DATABASE }}.auth_user lms_user \
|
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) \
|
LEFT JOIN {{ OPENEDX_MYSQL_DATABASE }}.auth_userprofile as lms_profile ON (lms_user.id = lms_profile.user_id) \
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user