Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to pydantic v2 #504

Closed
Closed
Show file tree
Hide file tree
Changes from 64 commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
fce3add
🎨(tests) rename converter tests with path pattern
quitterie-lcs Sep 5, 2023
773a14c
🔥(models) remove context extensions for base edx to xapi converter
quitterie-lcs Sep 5, 2023
6447fc5
⬆️(project) upgrade python dependencies
renovate[bot] Oct 9, 2023
8662eec
✨(backends) add data and lrs backend interfaces
SergioSim Apr 25, 2023
a08adf7
✨(backends) add FSDataBackend
SergioSim Apr 25, 2023
05f5025
✨(backends) fix base List type using pydantic
Ardawo May 12, 2023
de601dd
✨(backends) add mongo unified interface
Ardawo May 12, 2023
23e6aa3
🏗️(backends) add SwiftDataBackend
wilbrdt May 15, 2023
684d6ef
✨(backends) add LDPDataBackend
SergioSim May 22, 2023
cf9b825
✨(backends) add s3 backend with unified interface
wilbrdt Apr 4, 2023
eb1b8b6
✨(backends) add clickhouse unified interface
Ardawo May 9, 2023
68cf852
✅(tests) use requests_mock fixture in LDPDataBackend tests
SergioSim Jul 7, 2023
24657bf
✨(backends) add ESDataBackend
SergioSim May 22, 2023
84b72b4
✨(backends) add FSLRSBackend
SergioSim Jun 20, 2023
4b8fb53
♻️(backends) move backends utils method to `utils.py`
wilbrdt Aug 7, 2023
a144698
✨(backends) add base for async backends
wilbrdt Jun 21, 2023
162a8fa
✨(backends) add async elasticsearch data backend
wilbrdt Jun 18, 2023
12620e9
✅(backends) update MongoDataBackend tests
SergioSim Jun 22, 2023
6e42e64
✨(backends) add AsyncMongoDatabase backend
SergioSim Mar 9, 2023
4bfe594
🎨(backends) improve several points for all unified backends
wilbrdt Aug 18, 2023
7b9948b
🏗️(backends) add close method to sync backends
wilbrdt Aug 7, 2023
3ba6ddc
🐛(backends) fix bug iterating over async mongo collections
wilbrdt Aug 28, 2023
8191318
🏗️(backends) unify stream backend settings
wilbrdt Aug 17, 2023
8f5d686
🏗️(backends) unify http backend settings
wilbrdt Aug 17, 2023
e75afd5
🏗️(backends) integrate unified backends in the CLI
wilbrdt Aug 18, 2023
61422a1
✨(cli) make async backends usable in cli
wilbrdt Sep 6, 2023
c48a205
🐛(backends) fix clickhouse client options int type
wilbrdt Sep 6, 2023
4797c35
🏗️(backends) integrate unified backends in API
wilbrdt Sep 7, 2023
7205ea3
🏗️(backends) integrate async backends in API
wilbrdt Sep 10, 2023
72db481
🐛(test) fix pyfakefs failure of file creation
quitterie-lcs Oct 11, 2023
95e856a
🐛(tray) fix elasticsearch env variables
wilbrdt Oct 12, 2023
9ff6dcd
📝(project) update CHANGELOG.md
wilbrdt Oct 12, 2023
7cda560
🚨(backends) fix `too-many-arguments` pylint warning
wilbrdt Oct 12, 2023
ea0edc0
⬆️(project) upgrade python dependencies
renovate[bot] Oct 16, 2023
a07e6d5
📝(project) update CHANGELOG.md
quitterie-lcs Oct 16, 2023
a00b439
🐛(backends) fix default RALPH_BACKENDS__HTTP__LRS__HEADERS variable
SergioSim Oct 13, 2023
95c6ede
🎨(tests) clean tests by factoring statements and renaming
Leobouloc Oct 12, 2023
d7afb5b
✨(cli) sort backend arguments alphabetically
SergioSim Oct 17, 2023
cf9977f
📝(docs) add useful commands to "contributing" in README
Leobouloc Oct 19, 2023
f8b75c8
🐛(helm) fix clickhouse Helm's version (#477)
claudusd Oct 20, 2023
8493ac6
⬆️(project) upgrade python dependencies
renovate[bot] Oct 23, 2023
8495825
📝(project) update CHANGELOG.md
quitterie-lcs Oct 23, 2023
85be17e
🔧(helm) improve volumes and ingress configurations
rprin Sep 15, 2023
247be51
🔧(helm) improve ingress's host management (#476)
claudusd Oct 23, 2023
04c636f
✨(api) add option to enforce scopes
Leobouloc Oct 24, 2023
04c655e
🐛(backends) fix limit in `read` method of `async_es` backend
wilbrdt Oct 12, 2023
7111335
✨(api) add ability to use async backends for `runserver` command
wilbrdt Oct 16, 2023
2b19975
🔧(projet) remove elasticsearch volume
wilbrdt Oct 17, 2023
ae2cec6
✅(api) update tests to cover async backends
wilbrdt Oct 17, 2023
2e37c9d
✨(project) add mypy configuration for type checking
quitterie-lcs May 9, 2023
10c53e6
🚨(project) fix mypy linter warnings
quitterie-lcs May 24, 2023
55189e5
🔧(docs) add mike tools for docs versioning
wilbrdt Oct 26, 2023
06d2038
💚(docs) add docs versioning in CI
wilbrdt Oct 26, 2023
7aa8f45
📝(project) unify infinitive use in docstrings
quitterie-lcs Oct 27, 2023
91c0523
⬆️(project) upgrade python dependencies
renovate[bot] Oct 30, 2023
ce0e618
📝(project) update CHANGELOG.md
quitterie-lcs Oct 30, 2023
a4802c9
allow multipe auth after unification
Leobouloc Oct 31, 2023
d436ad1
add missing import
Leobouloc Oct 31, 2023
ceaf708
start migrating to pydantic v2
Leobouloc Oct 31, 2023
fef360f
progress with pydantic v2
Leobouloc Nov 2, 2023
739b541
wip
Leobouloc Nov 2, 2023
f2ff59d
wip
Leobouloc Nov 7, 2023
f60de9b
wip
Leobouloc Nov 8, 2023
606658d
wip
Leobouloc Nov 10, 2023
a324201
wip
Leobouloc Nov 10, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ jobs:
- v1-dependencies-<< parameters.python-image >>-{{ .Revision }}
- run:
name: Install development dependencies
command: pip install --user .[backend-clickhouse,backend-es,backend-ldp,backend-lrs,backend-mongo,backend-swift,backend-ws,cli,dev,lrs]
command: pip install --user .[backend-clickhouse,backend-es,backend-ldp,backend-lrs,backend-mongo,backend-s3,backend-swift,backend-ws,cli,dev,lrs]
- save_cache:
paths:
- ~/.local
Expand Down Expand Up @@ -495,8 +495,17 @@ jobs:
command: |
git config --global user.email "[email protected]"
git config --global user.name "FUN MOOC Bot"
~/.local/bin/mkdocs gh-deploy

# Deploy docs with either:
# - DOCS_VERSION: 1.1 (for git tag v1.1.2)
# - DOCS_ALIAS: latest
# or
# - DOCS_VERSION: dev (for master branch)
# - No DOCS_ALIAS
DOCS_VERSION=$([[ -z "$CIRCLE_TAG" ]] && echo $CIRCLE_BRANCH || echo ${CIRCLE_TAG} | sed 's/^v\([0-9]\.[0-9]*\)\..*/\1/')
DOCS_ALIAS=$([[ -z "$CIRCLE_TAG" ]] && echo "" || echo "latest")
echo "DOCS_VERSION: ${DOCS_VERSION}"
echo "DOCS_ALIAS: ${DOCS_ALIAS}"
~/.local/bin/mike deploy --push --update-aliases ${DOCS_VERSION} ${DOCS_ALIAS}
# Make a new github release
release:
docker:
Expand Down Expand Up @@ -670,8 +679,8 @@ workflows:
only: /^v.*/

# Publish the documentation website to GitHub Pages.
# Only do it for master as tagged releases are supposed to tag their own version of the
# documentation in the release commit on master before they go out.
# Only do it for master and for tagged releases with a tag starting with
# the letter v.
- deploy-docs:
requires:
- tray
Expand All @@ -680,7 +689,7 @@ workflows:
branches:
only: master
tags:
only: /.*/
only: /^v.*/

# Release
- release:
Expand Down
153 changes: 93 additions & 60 deletions .env.dist
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ RALPH_APP_DIR=/app/.ralph
# Uncomment lines (by removing # characters at the beginning of target lines)
# to define environment variables associated to the backend(s) you need.

# LDP storage backend
# LDP data backend
#
# You need to generate an API token for your OVH's account and fill the service
# name and stream id you are targeting.
Expand All @@ -13,63 +13,96 @@ RALPH_APP_DIR=/app/.ralph
# define them for convenience purpose during development, but they can be
# passed as CLI options.

# RALPH_BACKENDS__STORAGE__LDP__ENDPOINT=
# RALPH_BACKENDS__STORAGE__LDP__APPLICATION_KEY=
# RALPH_BACKENDS__STORAGE__LDP__APPLICATION_SECRET=
# RALPH_BACKENDS__STORAGE__LDP__CONSUMER_KEY=
# RALPH_BACKENDS__STORAGE__LDP__SERVICE_NAME=
# RALPH_BACKENDS__STORAGE__LDP__STREAM_ID=

# Swift storage backend

# RALPH_BACKENDS__STORAGE__SWIFT__OS_AUTH_URL=http://swift:35357/v3/
# RALPH_BACKENDS__STORAGE__SWIFT__OS_IDENTITY_API_VERSION=3
# RALPH_BACKENDS__STORAGE__SWIFT__OS_USER_DOMAIN_NAME=Default
# RALPH_BACKENDS__STORAGE__SWIFT__OS_PROJECT_DOMAIN_NAME=Default
# RALPH_BACKENDS__STORAGE__SWIFT__OS_TENANT_ID=cd238e84310a46e58af7f1d515887d88
# RALPH_BACKENDS__STORAGE__SWIFT__OS_TENANT_NAME=RegionOne
# RALPH_BACKENDS__STORAGE__SWIFT__OS_USERNAME=demo
# RALPH_BACKENDS__STORAGE__SWIFT__OS_PASSWORD=demo
# RALPH_BACKENDS__STORAGE__SWIFT__OS_REGION_NAME=RegionOne
# RALPH_BACKENDS__STORAGE__SWIFT__OS_STORAGE_URL=http://swift:8080/v1/KEY_cd238e84310a46e58af7f1d515887d88/test_container

# S3 storage backend

# RALPH_BACKENDS__STORAGE__S3__ACCESS_KEY_ID=
# RALPH_BACKENDS__STORAGE__S3__SECRET_ACCESS_KEY=
# RALPH_BACKENDS__STORAGE__S3__SESSION_TOKEN=
# RALPH_BACKENDS__STORAGE__S3__DEFAULT_REGION=
# RALPH_BACKENDS__STORAGE__S3__BUCKET_NAME=
# RALPH_BACKENDS__STORAGE__S3__ENDPOINT_URL=

# ES database backend

RALPH_BACKENDS__DATABASE__ES__HOSTS=http://elasticsearch:9200
RALPH_BACKENDS__DATABASE__ES__INDEX=statements
RALPH_BACKENDS__DATABASE__ES__TEST_HOSTS=http://elasticsearch:9200
RALPH_BACKENDS__DATABASE__ES__TEST_INDEX=test-index-foo
RALPH_BACKENDS__DATABASE__ES__TEST_FORWARDING_INDEX=test-index-foo-2

# MONGO database backend

RALPH_BACKENDS__DATABASE__MONGO__COLLECTION=foo
RALPH_BACKENDS__DATABASE__MONGO__DATABASE=statements
RALPH_BACKENDS__DATABASE__MONGO__CONNECTION_URI=mongodb://mongo:27017/
RALPH_BACKENDS__DATABASE__MONGO__TEST_COLLECTION=foo
RALPH_BACKENDS__DATABASE__MONGO__TEST_FORWARDING_COLLECTION=foo-2
RALPH_BACKENDS__DATABASE__MONGO__TEST_DATABASE=statements
RALPH_BACKENDS__DATABASE__MONGO__TEST_CONNECTION_URI=mongodb://mongo:27017/

# ClickHouse database backend

RALPH_BACKENDS__DATABASE__CLICKHOUSE__HOST=clickhouse
RALPH_BACKENDS__DATABASE__CLICKHOUSE__PORT=8123
RALPH_BACKENDS__DATABASE__CLICKHOUSE__XAPI_DATABASE=xapi
RALPH_BACKENDS__DATABASE__CLICKHOUSE__EVENT_TABLE_NAME=xapi_events_all
RALPH_BACKENDS__DATABASE__CLICKHOUSE__TEST_DATABASE=test_statements
RALPH_BACKENDS__DATABASE__CLICKHOUSE__TEST_HOST=clickhouse
RALPH_BACKENDS__DATABASE__CLICKHOUSE__TEST_PORT=8123
RALPH_BACKENDS__DATABASE__CLICKHOUSE__TEST_TABLE_NAME=test_xapi_events_all
# RALPH_BACKENDS__DATA__LDP__APPLICATION_KEY=
# RALPH_BACKENDS__DATA__LDP__APPLICATION_SECRET=
# RALPH_BACKENDS__DATA__LDP__CONSUMER_KEY=
# RALPH_BACKENDS__DATA__LDP__DEFAULT_STREAM_ID=
# RALPH_BACKENDS__DATA__LDP__ENDPOINT=
# RALPH_BACKENDS__DATA__LDP__REQUEST_TIMEOUT=
# RALPH_BACKENDS__DATA__LDP__SERVICE_NAME=

# Swift data backend

# RALPH_BACKENDS__DATA__SWIFT__AUTH_URL=http://swift:35357/v3/
# RALPH_BACKENDS__DATA__SWIFT__USERNAME=demo
# RALPH_BACKENDS__DATA__SWIFT__PASSWORD=demo
# RALPH_BACKENDS__DATA__SWIFT__IDENTITY_API_VERSION=3
# RALPH_BACKENDS__DATA__SWIFT__TENANT_ID=cd238e84310a46e58af7f1d515887d88
# RALPH_BACKENDS__DATA__SWIFT__TENANT_NAME=RegionOne
# RALPH_BACKENDS__DATA__SWIFT__PROJECT_DOMAIN_NAME=Default
# RALPH_BACKENDS__DATA__SWIFT__REGION_NAME=RegionOne
# RALPH_BACKENDS__DATA__SWIFT__OBJECT_STORAGE_URL=http://swift:8080/v1/KEY_cd238e84310a46e58af7f1d515887d88/test_container
# RALPH_BACKENDS__DATA__SWIFT__USER_DOMAIN_NAME=Default
# RALPH_BACKENDS__DATA__SWIFT__DEFAULT_CONTAINER=
# RALPH_BACKENDS__DATA__SWIFT__LOCALE_ENCODING=Default

# S3 data backend

# RALPH_BACKENDS__DATA__S3__ACCESS_KEY_ID=
# RALPH_BACKENDS__DATA__S3__SECRET_ACCESS_KEY=
# RALPH_BACKENDS__DATA__S3__SESSION_TOKEN=
# RALPH_BACKENDS__DATA__S3__ENDPOINT_URL=
# RALPH_BACKENDS__DATA__S3__DEFAULT_REGION=
# RALPH_BACKENDS__DATA__S3__DEFAULT_BUCKET_NAME=
# RALPH_BACKENDS__DATA__S3__DEFAULT_CHUNK_SIZE=
# RALPH_BACKENDS__DATA__S3__LOCALE_ENCODING=

# ES data backend

RALPH_BACKENDS__DATA__ES__HOSTS=http://elasticsearch:9200
RALPH_BACKENDS__DATA__ES__DEFAULT_INDEX=statements
# RALPH_BACKENDS__DATA__ES__ALLOW_YELLOW_STATUS=False
# RALPH_BACKENDS__DATA__ES__CLIENT_OPTIONS__ca_certs=False
# RALPH_BACKENDS__DATA__ES__CLIENT_OPTIONS__verify_certs=False
# RALPH_BACKENDS__DATA__ES__DEFAULT_CHUNK_SIZE=500
# RALPH_BACKENDS__DATA__ES__LOCALE_ENCODING=utf8
# RALPH_BACKENDS__DATA__ES__POINT_IN_TIME_KEEP_ALIVE=1m
# RALPH_BACKENDS__DATA__ES__REFRESH_AFTER_WRITE=False
RALPH_BACKENDS__DATA__ES__TEST_HOSTS=http://elasticsearch:9200
RALPH_BACKENDS__DATA__ES__TEST_INDEX=test-index-foo
RALPH_BACKENDS__DATA__ES__TEST_FORWARDING_INDEX=test-index-foo-2

# MONGO data backend

RALPH_BACKENDS__DATA__MONGO__CONNECTION_URI=mongodb://mongo:27017/
RALPH_BACKENDS__DATA__MONGO__DEFAULT_COLLECTION=foo
RALPH_BACKENDS__DATA__MONGO__DEFAULT_DATABASE=statements
# RALPH_BACKENDS__DATA__MONGO__CLIENT_OPTIONS__document_class=
# RALPH_BACKENDS__DATA__MONGO__CLIENT_OPTIONS__tz_aware=False
# RALPH_BACKENDS__DATA__MONGO__DEFAULT_CHUNK_SIZE=500
# RALPH_BACKENDS__DATA__MONGO__LOCALE_ENCODING=utf8
RALPH_BACKENDS__DATA__MONGO__TEST_COLLECTION=foo
RALPH_BACKENDS__DATA__MONGO__TEST_FORWARDING_COLLECTION=foo-2
RALPH_BACKENDS__DATA__MONGO__TEST_DATABASE=statements
RALPH_BACKENDS__DATA__MONGO__TEST_CONNECTION_URI=mongodb://mongo:27017/

# ClickHouse data backend

RALPH_BACKENDS__DATA__CLICKHOUSE__HOST=clickhouse
RALPH_BACKENDS__DATA__CLICKHOUSE__PORT=8123
RALPH_BACKENDS__DATA__CLICKHOUSE__DATABASE=xapi
RALPH_BACKENDS__DATA__CLICKHOUSE__EVENT_TABLE_NAME=xapi_events_all
# RALPH_BACKENDS__DATA__CLICKHOUSE__USERNAME=
# RALPH_BACKENDS__DATA__CLICKHOUSE__PASSWORD=
# RALPH_BACKENDS__DATA__CLICKHOUSE__CLIENT_OPTIONS__date_time_input_format=
# RALPH_BACKENDS__DATA__CLICKHOUSE__CLIENT_OPTIONS__allow_experimental_object_type=
# RALPH_BACKENDS__DATA__CLICKHOUSE__DEFAULT_CHUNK_SIZE=500
# RALPH_BACKENDS__DATA__CLICKHOUSE__LOCALE_ENCODING=utf8
RALPH_BACKENDS__DATA__CLICKHOUSE__TEST_DATABASE=test_statements
RALPH_BACKENDS__DATA__CLICKHOUSE__TEST_HOST=clickhouse
RALPH_BACKENDS__DATA__CLICKHOUSE__TEST_PORT=8123
RALPH_BACKENDS__DATA__CLICKHOUSE__TEST_TABLE_NAME=test_xapi_events_all


# LRS HTTP backend

RALPH_BACKENDS__HTTP__LRS__BASE_URL=http://ralph:[email protected]:8100/
RALPH_BACKENDS__HTTP__LRS__USERNAME=ralph
RALPH_BACKENDS__HTTP__LRS__PASSWORD=secret
RALPH_BACKENDS__HTTP__LRS__HEADERS__X_EXPERIENCE_API_VERSION=1.0.3
RALPH_BACKENDS__HTTP__LRS__HEADERS__CONTENT_TYPE=application/json
RALPH_BACKENDS__HTTP__LRS__STATUS_ENDPOINT=/__heartbeat__
RALPH_BACKENDS__HTTP__LRS__STATEMENTS_ENDPOINT=/xAPI/statements

# Sentry

Expand All @@ -83,9 +116,9 @@ RALPH_BACKENDS__DATABASE__CLICKHOUSE__TEST_TABLE_NAME=test_xapi_events_all

# RALPH_CONVERTER_EDX_XAPI_UUID_NAMESPACE=

# LRS API
# LRS API

RALPH_RUNSERVER_AUTH_BACKEND=basic
RALPH_RUNSERVER_AUTH_BACKENDS=Basic
RALPH_RUNSERVER_AUTH_OIDC_AUDIENCE=http://localhost:8100
RALPH_RUNSERVER_AUTH_OIDC_ISSUER_URI=http://learning-analytics-playground_keycloak_1:8080/auth/realms/fun-mooc
RALPH_RUNSERVER_BACKEND=es
Expand Down
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,6 @@ venv.bak/
.pylint.d
.pytest_cache

# Test fixtures
data/

# Documentation site
site/

Expand Down
19 changes: 17 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,25 @@ and this project adheres to
- Implement Pydantic model for LRS Statements resource query parameters
- Implement xAPI LMS Profile statements validation
- `EdX` to `xAPI` converters for enrollment events
- Helm: Add variable ``ingress.hosts``

### Changed

- Upgrade `cachetools` to `5.3.2`
- Refactor `database` and `storage` backends under the unified `data` backend
interface [BC]
- Refactor LRS `query_statements` and `query_statements_by_ids` backends
methods under the unified `lrs` backend interface [BC]
- Refactor LRS Statements resource query parameters defined for `ralph` API
- Helm chart: improve chart modularity
- User credentials must now include an "agent" field which can be created
using the cli
- `GET /statements` now has "mine" option which matches statements that
have an authority field matching that of the user
- CLI: change `push` to `write` and `fetch` to `read` [BC]
- Upgrade `fastapi` to `0.103.2`
- Upgrade `fastapi` to `0.104.0`
- Upgrade `more-itertools` to `10.1.0`
- Upgrade `sentry_sdk` to `1.31.0`
- Upgrade `sentry_sdk` to `1.32.0`
- Upgrade `uvicorn` to `0.23.2`
- API: Invalid parameters now return 400 status code
- API: Forwarding PUT now uses PUT (instead of POST)
Expand All @@ -40,6 +46,13 @@ have an authority field matching that of the user
with camelCase alias, in `LRSStatementsQuery`
- API: Add `RALPH_LRS_RESTRICT_BY_AUTHORITY` option making `?mine=True`
implicit
- CLI: list cli usage strings in alphabetical order
- Helm: Fix clickhouse version
- Helm: improve volumes and ingress configurations
- API: Add `RALPH_LRS_RESTRICT_BY_SCOPE` option enabling endpoint access
control by user scopes
- API: Variable `RUNSERVER_AUTH_BACKEND` becomes `RUNSERVER_AUTH_BACKENDS`, and
multiple authentication methods are supported simultaneously

### Fixed

Expand All @@ -48,7 +61,9 @@ have an authority field matching that of the user

### Removed

- `school`, `course`, `module` context extensions in Edx to xAPI base converter
- `name` field in `VideoActivity` xAPI model mistakenly used in `video` profile
- Helm: remove variable ``ingress.hostname`` and ``ingress.tls``

## [3.9.0] - 2023-07-21

Expand Down
8 changes: 7 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ RUN apt-get update && \
libffi-dev && \
rm -rf /var/lib/apt/lists/*

RUN pip install .[backend-clickhouse,backend-es,backend-ldp,backend-lrs,backend-mongo,backend-swift,backend-ws,cli,lrs]
RUN pip install .[backend-clickhouse,backend-es,backend-ldp,backend-lrs,backend-mongo,backend-s3,backend-swift,backend-ws,cli,lrs]


# -- Core --
Expand Down Expand Up @@ -59,6 +59,12 @@ RUN if [ "$TARGETPLATFORM" = "linux/arm64" ]; \
rm -rf /var/lib/apt/lists/*; \
fi;

# Install git for documentation deployment
RUN apt-get update && \
apt-get install -y \
git && \
rm -rf /var/lib/apt/lists/*;

# Uninstall ralph and re-install it in editable mode along with development
# dependencies
RUN pip uninstall -y ralph-malph
Expand Down
27 changes: 21 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,14 @@ COMPOSE = DOCKER_USER=$(DOCKER_USER) docker compose
COMPOSE_RUN = $(COMPOSE) run --rm
COMPOSE_TEST_RUN = $(COMPOSE_RUN)
COMPOSE_TEST_RUN_APP = $(COMPOSE_TEST_RUN) app
MKDOCS = $(COMPOSE_RUN) --no-deps --publish "8000:8000" app mkdocs
COMPOSE_RUN_DOCS = $(COMPOSE_RUN) --no-deps --publish "8000:8000" app


# -- Documentation
DOCS_COMMITTER_NAME = "FUN MOOC Bot"
DOCS_COMMITTER_EMAIL = [email protected]
MKDOCS = $(COMPOSE_RUN_DOCS) mkdocs
MIKE = GIT_COMMITTER_NAME=$(DOCS_COMMITTER_NAME) GIT_COMMITTER_EMAIL=$(DOCS_COMMITTER_EMAIL) $(COMPOSE_RUN_DOCS) mike

# -- Elasticsearch
ES_PROTOCOL = http
Expand Down Expand Up @@ -66,7 +73,7 @@ bin/init-cluster:
-u $(RALPH_LRS_AUTH_USER_NAME) \
-p $(RALPH_LRS_AUTH_USER_PWD) \
-s $(RALPH_LRS_AUTH_USER_SCOPE) \
-M $(RALPH_LRS_AUTH_USER_AGENT_MBOX)
-M $(RALPH_LRS_AUTH_USER_AGENT_MBOX)
-w


Expand All @@ -79,7 +86,7 @@ arnold-bootstrap: \
$(ARNOLD) -d -c $(ARNOLD_CUSTOMER) -e $(ARNOLD_ENVIRONMENT) -a $(ARNOLD_APP) create_app_vaults && \
$(ARNOLD) -d -c $(ARNOLD_CUSTOMER) -e $(ARNOLD_ENVIRONMENT) -a elasticsearch create_app_vaults && \
$(ARNOLD) -d -c $(ARNOLD_CUSTOMER) -e $(ARNOLD_ENVIRONMENT) -- vault -a $(ARNOLD_APP) decrypt
sed -i 's/^# RALPH_BACKENDS__DATABASE__ES/RALPH_BACKENDS__DATABASE__ES/g' group_vars/customer/$(ARNOLD_CUSTOMER)/$(ARNOLD_ENVIRONMENT)/secrets/$(ARNOLD_APP).vault.yml
sed -i 's/^# RALPH_BACKENDS__DATA__ES/RALPH_BACKENDS__DATA__ES/g' group_vars/customer/$(ARNOLD_CUSTOMER)/$(ARNOLD_ENVIRONMENT)/secrets/$(ARNOLD_APP).vault.yml
source .k3d-cluster.env.sh && \
$(ARNOLD) -d -c $(ARNOLD_CUSTOMER) -e $(ARNOLD_ENVIRONMENT) -- vault -a $(ARNOLD_APP) encrypt
echo "skip_verification: True" > $(ARNOLD_APP_VARS)
Expand Down Expand Up @@ -140,11 +147,14 @@ docs-build: ## build documentation site
.PHONY: docs-build

docs-deploy: ## deploy documentation site
@$(MKDOCS) gh-deploy
# Using env variables GIT_COMMITTER_NAME and GIT_COMMITTER_EMAIL will work with mike 2.0
# Until that you need to set local git config user.name and user.email manually
@echo "Deploying docs with version dev"
@${MIKE} deploy dev
.PHONY: docs-deploy

docs-serve: ## run mkdocs live server
@$(MKDOCS) serve --dev-addr 0.0.0.0:8000
docs-serve: ## run mike live server
@$(MIKE) serve --dev-addr 0.0.0.0:8000
.PHONY: docs-serve

down: ## stop and remove backend containers
Expand Down Expand Up @@ -222,6 +232,11 @@ lint-pydocstyle: ## lint Python docstrings with pydocstyle
@$(COMPOSE_TEST_RUN_APP) pydocstyle
.PHONY: lint-pydocstyle

lint-mypy: ## lint back-end python sources with mypy
@echo 'lint:mypy started…'
@$(COMPOSE_TEST_RUN_APP) mypy
.PHONY: lint-mypy

logs: ## display app logs (follow mode)
@$(COMPOSE) logs -f app
.PHONY: logs
Expand Down
Loading