Skip to content

Commit 07f6e89

Browse files
Merge pull request #316 from Sunbird-Knowlg/release-8.1.0
Release 8.1.0
2 parents 8d23ccd + f485a05 commit 07f6e89

22 files changed

Lines changed: 14578 additions & 10215 deletions

.circleci/config.yml

Lines changed: 0 additions & 37 deletions
This file was deleted.

.github/workflows/ghcr-publish.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Build and Publish Docker Image
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
build-and-push:
10+
runs-on: ubuntu-latest
11+
12+
permissions:
13+
contents: read
14+
packages: write
15+
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v3
19+
with:
20+
submodules: 'recursive'
21+
token: ${{ secrets.GITHUB_TOKEN }}
22+
23+
- name: Log in to GitHub Container Registry
24+
uses: docker/login-action@v3
25+
with:
26+
registry: ghcr.io
27+
username: ${{ github.actor }}
28+
password: ${{ secrets.GITHUB_TOKEN }}
29+
30+
- name: Get short commit hash
31+
id: vars
32+
run: echo "commit_hash=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
33+
34+
- name: Prepare Docker image name and tag
35+
run: |
36+
REPO_NAME_LOWERCASE=$(echo "${GITHUB_REPOSITORY}" | tr '[:upper:]' '[:lower:]')
37+
TAG_NAME=$(echo "${GITHUB_REF_NAME}" | tr '[:upper:]' '[:lower:]')
38+
BUILD_TAG="${TAG_NAME}_${{ steps.vars.outputs.commit_hash }}_${GITHUB_RUN_NUMBER}"
39+
40+
echo "IMAGE_NAME=ghcr.io/${REPO_NAME_LOWERCASE}" >> $GITHUB_ENV
41+
echo "IMAGE_TAG=${BUILD_TAG}" >> $GITHUB_ENV
42+
43+
- name: Build Docker image
44+
run: docker build -t $IMAGE_NAME:$IMAGE_TAG .
45+
46+
- name: Push Docker image
47+
run: docker push $IMAGE_NAME:$IMAGE_TAG

Dockerfile

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,13 @@
1-
FROM circleci/node:8.11.2-stretch
2-
MAINTAINER "Manojvv" "manojv@ilimi.in"
3-
USER root
4-
COPY src /opt/content/
1+
FROM node:22.17.1-bookworm
2+
RUN useradd -m sunbird-dev
3+
USER sunbird-dev
4+
COPY --chown=sunbird-dev src /opt/content/
55
WORKDIR /opt/content/
6-
RUN npm install --unsafe-perm
6+
RUN npm install
77

8-
FROM node:8.11-slim
9-
MAINTAINER "Manojvv" "manojv@ilimi.in"
10-
RUN sed -i '/jessie-updates/d' /etc/apt/sources.list \
11-
&& apt update && apt install openssl imagemagick -y \
12-
&& apt-get clean \
13-
&& useradd -m sunbird
14-
USER sunbird
15-
ADD ImageMagick-i386-pc-solaris2.11.tar.gz /home/sunbird
16-
ENV GRAPH_HOME "/home/sunbird/ImageMagick-6.9.3"
17-
ENV PATH "$GRAPH_HOME/bin:$PATH"
18-
ENV MAGICK_HOME "/home/sunbird/ImageMagick-6.9.3"
19-
ENV PATH "$MAGICK_HOME/bin:$PATH"
8+
FROM node:22.17.1-bookworm
9+
10+
RUN useradd -m sunbird
2011
COPY --from=0 --chown=sunbird /opt/content /home/sunbird/mw/content
2112
WORKDIR /home/sunbird/mw/content/
22-
CMD ["node", "app.js", "&"]
13+
CMD ["node", "app.js"]

README.md

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,38 +5,34 @@ This is the repository for content management micro-service.
55
The code in this repository is licensed under MIT unless otherwise noted. Please see the [LICENSE](https://github.com/project-sunbird/sunbird-content-service/blob/master/LICENSE) file for details.
66

77
## Pre Requirements
8-
1. Node
9-
2. Install imagemagick, graphicsmagick ref:https://www.npmjs.com/package/gm
8+
1. Node JS
109

1110
## Environment Variables:
12-
* sunbird_content_provider_api_base_url: content provider API base url. e.g.: https://qa.ekstep.in or https://api.ekstep.in
1311
* sunbird_content_repo_api_key: API key for the content provider URL
1412
* sunbird_search_service_api_key: API key for the search provider URL
1513
* sunbird_dial_repo_api_key : API key for the dial URL
1614
* sunbird_plugin_repo_api_key: API key for the plugin URL
1715
* sunbird_data_service_api_key: API key for the data service URL
18-
* sunbird_content_service_log_level : sets the log level e.g debug , info etc.
16+
* sunbird_content_service_log_level : sets the log level Example debug , info etc.
1917
* sunbird_language_service_api_key: API key for the language service
20-
* sunbird_default_channel: Default channel. e.g. sunbird (string)
21-
* sunbird_content_plugin_base_url: Content plugin base url. e.g.: https://qa.ekstep.in or https://community.ekstep.in
22-
* sunbird_environment: e.g : sunbird.env (string)
23-
* sunbird_instance : e.g : sunbird.ins(string)
24-
* sunbird_keycloak_auth_server_url: Sunbird keycloak auth server url e.g.: https://dev.open-sunbird.org/auth (string)
25-
* sunbird_keycloak_realm: Sunbird keycloak realm e.g.: sunbird (string)
26-
* sunbird_keycloak_client_id: Sunbird keycloak client id e.g: portal (string)
27-
* sunbird_keycloak_public: Sunbird keycloak public e.g.: true (boolean)
28-
* sunbird_cache_store: Sunbird cache store e.g.: memory (string)
29-
* sunbird_cache_ttl: Sunbird cachec time to live e.g.: 1800(number)
30-
* sunbird_image_storage_url
31-
* sunbird_azure_account_name
32-
* sunbird_azure_account_key
18+
* sunbird_default_channel: Default channel. Example. sunbird (string)
19+
* sunbird_content_plugin_base_url: Content plugin base url. Example.: https://qa.ekstep.in or https://community.ekstep.in
20+
* sunbird_environment: Example : sunbird.env (string)
21+
* sunbird_instance : Example : sunbird.ins(string)
22+
* sunbird_keycloak_auth_server_url: Sunbird keycloak auth server url Example.: https://dev.open-sunbird.org/auth (string)
23+
* sunbird_keycloak_realm: Sunbird keycloak realm Example.: sunbird (string)
24+
* sunbird_keycloak_client_id: Sunbird keycloak client id Example: portal (string)
25+
* sunbird_keycloak_public: Sunbird keycloak public Example.: true (boolean)
26+
* sunbird_cache_store: Sunbird cache store Example.: memory (string)
27+
* sunbird_cache_ttl: Sunbird cachec time to live Example.: 1800(number)
3328
* sunbird_dial_code_registry_url eg: staging.open-sunbird.org/dial/
34-
* sunbird_cassandra_ips e.g : 127.0.0.1,127.0.0.2
35-
* sunbird_cassandra_port e.g: 9042
36-
* sunbird_telemetry_sync_batch_size e.g: 20
37-
* sunbird_learner_service_local_base_url e.g: 'http://learner-service:9000'
38-
* sunbird_content_service_local_base_url e.g: 'http://localhost:5000'
39-
* sunbird_content_upload_data_limit: Content upload data limit e.g.: 50mb (string)
29+
* sunbird_cassandra_urls Example : 127.0.0.1,127.0.0.2
30+
* sunbird_cassandra_consistency_level Example: 9042
31+
* sunbird_cassandra_replication_strategy Example: '{"class":"SimpleStrategy","replication_factor":1}'
32+
* sunbird_telemetry_sync_batch_size Example: 20
33+
* sunbird_learner_service_local_base_url Example: 'http://learner-service:9000'
34+
* sunbird_content_service_local_base_url Example: 'http://localhost:5000'
35+
* sunbird_content_upload_data_limit: Content upload data limit Example.: 50mb (string)
4036

4137
## Setup Instructions
4238
* Clone the project.eg .(git clone --recursive url)

build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ name=knowledge-mw-service
66
node=$2
77
org=$3
88

9-
[[ -f ImageMagick-i386-pc-solaris2.11.tar.gz ]] || wget https://www.imagemagick.org/download/binaries/ImageMagick-i386-pc-solaris2.11.tar.gz
109
docker build -f ./Dockerfile --label commitHash=$(git rev-parse --short HEAD) -t ${org}/${name}:${build_tag} .
1110
echo {\"image_name\" : \"${name}\", \"image_tag\" : \"${build_tag}\", \"node_name\" : \"$node\"} > metadata.json
11+

setup.md

Lines changed: 0 additions & 37 deletions
This file was deleted.

src/.eslintrc

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,25 @@
11
{
22
"extends": "standard",
33
"globals": {
4-
"globalEkstepProxyBaseUrl": true
4+
"globalEkstepProxyBaseUrl": "readonly"
55
},
66
"rules": {
7-
"indent": ["error", 2],
8-
"max-len": ["error", 120, 2, {"ignoreUrls": true, "ignoreComments": true}],
9-
"quotes": ["error", "single"]
7+
"indent": [
8+
"error",
9+
2
10+
],
11+
"max-len": [
12+
"error",
13+
120,
14+
2,
15+
{
16+
"ignoreUrls": true,
17+
"ignoreComments": true
18+
}
19+
],
20+
"quotes": [
21+
"error",
22+
"single"
23+
]
1024
}
11-
}
25+
}

src/app.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ const dialRepoBaseUrl = process.env.sunbird_dial_repo_api_base_url || 'https://q
4444
const pluginRepoBaseUrl = process.env.sunbird_plugin_repo_api_base_url || 'https://qa.ekstep.in/api'
4545
const dataServiceBaseUrl = process.env.sunbird_data_service_api_base_url || 'https://qa.ekstep.in/api'
4646
const languageServiceBaseUrl = process.env.sunbird_language_service_api_base_url || 'https://qa.ekstep.in/api/language'
47+
const taxonomyServiceBaseUrl = process.env.sunbird_taxonomy_service_api_base_url || 'http://taxonomy-service:9000'
4748

4849
const searchServiceApiKey = process.env.sunbird_search_service_api_key
4950
const dialRepoApiKey = process.env.sunbird_dial_repo_api_key
@@ -59,6 +60,7 @@ const isHealthCheckEnabled = process.env.sunbird_health_check_enable || 'true'
5960
const contentServiceLocalBaseUrl = process.env.sunbird_content_service_local_base_url ? process.env.sunbird_content_service_local_base_url : 'http://knowledge-mw-service:5000'
6061
const sunbirdGzipEnable = process.env.sunbird_gzip_enable || 'true'
6162
const kidTokenPublicKeyBasePath = process.env.sunbird_kid_public_key_base_path || '/keys/'
63+
const userTokenValidateEnable = process.env.enable_user_token_validation || 'true'
6264

6365
configUtil.setContentProviderApi(contentProviderApiConfig.API)
6466
configUtil.setConfig('CONTENT_SERVICE_BASE_URL', contentServiceBaseUrl)
@@ -88,6 +90,8 @@ configUtil.setConfig('CASSANDRA_DB_HEALTH_STATUS', 'true')
8890
configUtil.setConfig('EKSTEP_HEALTH_STATUS', 'true')
8991
configUtil.setConfig('CONTENT_SERVICE_LOCAL_BASE_URL', contentServiceLocalBaseUrl)
9092
configUtil.setConfig('ENABLE_GZIP', sunbirdGzipEnable)
93+
configUtil.setConfig('ENABLE_USER_TOKEN_VALIDATION', userTokenValidateEnable)
94+
configUtil.setConfig('TAXONOMY_SERVICE_BASE_URL', taxonomyServiceBaseUrl)
9195

9296
process.env.sunbird_cassandra_urls = process.env.sunbird_cassandra_urls || '127.0.0.1'
9397
process.env.dial_code_image_temp_folder = 'temp'
@@ -151,8 +155,7 @@ app.use(methodOverride())
151155
app.use(function (req, res, next) {
152156
res.header('Access-Control-Allow-Origin', '*')
153157
res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,PATCH,DELETE,OPTIONS')
154-
res.header('Access-Control-Allow-Headers', 'Content-Type, Authorization,' +
155-
'cid, user-id, x-auth, Cache-Control, X-Requested-With, *')
158+
res.header('Access-Control-Allow-Headers', '*')
156159

157160
if (req.method === 'OPTIONS') {
158161
res.sendStatus(200)

src/config/contentProviderApiConfig.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
"UPDATE_COLLABORATOR": "/content/v1/collaborator/update",
4141
"RESERVE_DIALCODE": "/content/v3/dialcode/reserve",
4242
"RELEASE_DIALCODE": "/content/v3/dialcode/release",
43+
"GET_DIALCODE_BATCH": "/dialcode/v4/batch/read",
4344

4445
"CHANNEL_URI": "/channel/v3/read",
4546
"CHANNEL_LIST_URI": "/channel/v3/list",
@@ -78,6 +79,8 @@
7879
"CREATE_LOCK": "/lock/v1/create",
7980
"REFRESH_LOCK": "/lock/v1/refresh",
8081
"RETIRE_LOCK": "/lock/v1/retire",
81-
"LIST_LOCK": "/lock/v1/list"
82+
"LIST_LOCK": "/lock/v1/list",
83+
84+
"UPDATE_QUESTION_SET_URI": "/questionset/v2/update"
8285
}
8386
}

src/gulpfile.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,18 @@ gulp.task('clean-coverage-report', function (cb) {
1616
})
1717

1818
// Below task is used setup source files
19-
gulp.task('pre-test-node', function () {
19+
gulp.task('pre-test-node', function (done) {
2020
return gulp.src(paths.scripts)
21-
.pipe(istanbul({includeUntested: true}))
21+
.pipe(istanbul({ includeUntested: true }))
2222
.pipe(istanbul.hookRequire())
23+
.on('finish', done)
2324
})
2425

2526
// Below task used to run the test cases
26-
gulp.task('test', ['clean-coverage-report', 'pre-test-node'], function () {
27+
gulp.task('test', gulp.series('clean-coverage-report', 'pre-test-node', function () {
2728
return gulp.src(paths.tests)
2829
.pipe(jasmineNode({
2930
timeout: 10000
3031
}))
31-
.pipe(istanbul.writeReports({dir: paths.coverage, reporters: ['html', 'text-summary']}))
32-
})
32+
.pipe(istanbul.writeReports({ dir: paths.coverage, reporters: ['html', 'text-summary'] }))
33+
}))

0 commit comments

Comments
 (0)