Skip to content

Commit

Permalink
Merge branch 'main' into RC_801_Feature_Enhance_the_Sunbird-RC_CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
Sreejit-K committed Sep 19, 2023
2 parents 7d13521 + d94f7e6 commit cf33a8a
Show file tree
Hide file tree
Showing 139 changed files with 1,034 additions and 506 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ jobs:
cache: 'maven'
- name: Set up properties
run: sh configure-dependencies.sh
# # debug step
# - name: Setup upterm session
# uses: lhotari/action-upterm@v1
# with:
# ## limits ssh access and adds the ssh public key for the user which triggered the workflow ie holashchand
# limit-access-to-actor: true
- name: Build and test
run: make test
# test:
Expand Down
8 changes: 4 additions & 4 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ node {
}

stage('Build image') {
app = docker.build("dockerhub/sunbird-rc-core","target")
claimApp = docker.build("dockerhub/sunbird-rc-claim-ms","java/claim")
app = docker.build("ghcr.io/sunbird-rc/sunbird-rc-core","target")
claimApp = docker.build("ghcr.io/sunbird-rc/sunbird-rc-claim-ms","java/claim")
}

// stage('Test image') {
Expand All @@ -39,8 +39,8 @@ node {

// stage('Deploy image') {
// sh "ssh [email protected] 'kubectl get pods -n ndear'"
// sh "ssh [email protected] 'kubectl set image deployment/registry registry=dockerhub/sunbird-rc:${env.BUILD_NUMBER} --record --namespace=ndear'"
// sh "ssh [email protected] 'kubectl set image deployment/claim-ms claim-ms=dockerhub/sunbird-rc-claim-ms:${env.BUILD_NUMBER} --record --namespace=ndear'"
// sh "ssh [email protected] 'kubectl set image deployment/registry registry=ghcr.io/sunbird-rc/sunbird-rc:${env.BUILD_NUMBER} --record --namespace=ndear'"
// sh "ssh [email protected] 'kubectl set image deployment/claim-ms claim-ms=ghcr.io/sunbird-rc/sunbird-rc-claim-ms:${env.BUILD_NUMBER} --record --namespace=ndear'"
// }

}
Expand Down
18 changes: 8 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
rwildcard=$(wildcard $1$2) $(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2))
SOURCES := $(call rwildcard,java/,*.java)
RELEASE_VERSION = v0.0.14
IMAGES := dockerhub/sunbird-rc-core dockerhub/sunbird-rc-nginx dockerhub/sunbird-rc-context-proxy-service \
dockerhub/sunbird-rc-public-key-service dockerhub/sunbird-rc-keycloak dockerhub/sunbird-rc-certificate-api \
dockerhub/sunbird-rc-certificate-signer dockerhub/sunbird-rc-notification-service dockerhub/sunbird-rc-claim-ms \
dockerhub/sunbird-rc-digilocker-certificate-api dockerhub/sunbird-rc-bulk-issuance dockerhub/sunbird-rc-metrics
IMAGES := ghcr.io/sunbird-rc/sunbird-rc-core ghcr.io/sunbird-rc/sunbird-rc-nginx ghcr.io/sunbird-rc/sunbird-rc-context-proxy-service \
ghcr.io/sunbird-rc/sunbird-rc-public-key-service ghcr.io/sunbird-rc/sunbird-rc-keycloak ghcr.io/sunbird-rc/sunbird-rc-certificate-api \
ghcr.io/sunbird-rc/sunbird-rc-certificate-signer ghcr.io/sunbird-rc/sunbird-rc-notification-service ghcr.io/sunbird-rc/sunbird-rc-claim-ms \
ghcr.io/sunbird-rc/sunbird-rc-digilocker-certificate-api ghcr.io/sunbird-rc/sunbird-rc-bulk-issuance ghcr.io/sunbird-rc/sunbird-rc-metrics
build: java/registry/target/registry.jar
echo ${SOURCES}
rm -rf java/claim/target/*.jar
cd target && rm -rf * && jar xvf ../java/registry/target/registry.jar && cp ../java/Dockerfile ./ && docker build -t dockerhub/sunbird-rc-core .
cd target && rm -rf * && jar xvf ../java/registry/target/registry.jar && cp ../java/Dockerfile ./ && docker build -t ghcr.io/sunbird-rc/sunbird-rc-core .
make -C java/claim
make -C services/certificate-api docker
make -C services/certificate-signer docker
Expand All @@ -20,20 +20,18 @@ build: java/registry/target/registry.jar
make -C services/metrics docker
make -C services/digilocker-certificate-api docker
make -C services/bulk_issuance docker
docker build -t dockerhub/sunbird-rc-nginx .
docker build -t ghcr.io/sunbird-rc/sunbird-rc-nginx .

java/registry/target/registry.jar: $(SOURCES)
echo $(SOURCES)
sh configure-dependencies.sh
cd java && ./mvnw clean install

test: build
@echo "VIEW_DIR=java/apitest/src/test/resources/views" >> .env || echo "no permission to append to file"
@echo "SCHEMA_DIR=java/apitest/src/test/resources/schemas" >> .env || echo "no permission to append to file"
@docker-compose down
@rm -rf db-data* || echo "no permission to delete"
# test with distributed definition manager and native search
@SEARCH_PROVIDER_NAME=dev.sunbirdrc.registry.service.NativeSearchService RELEASE_VERSION=latest KEYCLOAK_IMPORT_DIR=java/apitest/src/test/resources KEYCLOAK_SECRET=a52c5f4a-89fd-40b9-aea2-3f711f14c889 MANAGER_TYPE=DistributedDefinitionsManager DB_DIR=db-data-1 docker-compose up -d db keycloak registry certificate-signer certificate-api redis
@docker-compose --env-file test_environments/test_with_distributedDefManager_nativeSearch.env up -d db keycloak registry certificate-signer certificate-api redis
@echo "Starting the test" && sh build/wait_for_port.sh 8080
@echo "Starting the test" && sh build/wait_for_port.sh 8081
@docker-compose ps
Expand All @@ -42,7 +40,7 @@ test: build
@docker-compose down
@rm -rf db-data-1 || echo "no permission to delete"
# test with kafka(async), events, notifications,
@NOTIFICATION_ENABLED=true NOTIFICATION_URL=http://notification-ms:8765/notification-service/v1/notification TRACK_NOTIFICATIONS=true EVENT_ENABLED=true ASYNC_ENABLED=true RELEASE_VERSION=latest KEYCLOAK_IMPORT_DIR=java/apitest/src/test/resources KEYCLOAK_SECRET=a52c5f4a-89fd-40b9-aea2-3f711f14c889 DB_DIR=db-data-2 docker-compose up -d db clickhouse redis es keycloak registry certificate-signer certificate-api kafka zookeeper notification-ms metrics
@docker-compose --env-file test_environments/test_with_asyncCreate_events_notifications.env up -d db clickhouse redis es keycloak registry certificate-signer certificate-api kafka zookeeper notification-ms metrics
@echo "Starting the test" && sh build/wait_for_port.sh 8080
@echo "Starting the test" && sh build/wait_for_port.sh 8081
@docker-compose ps
Expand Down
2 changes: 1 addition & 1 deletion build/wait_for_port.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ echo "Waiting service to launch on $1..."
i=0
while ! curl localhost:$1; do
sleep 10
let i=i+1
((i=i+1))
if [[ $i -gt 60 ]]; then
echo "Failed to get the service in sane state!"
exit 1;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package in.divoc.api.authenticator;

import okhttp3.*;
import org.jboss.logging.Logger;

import org.apache.commons.lang.exception.ExceptionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.BufferedReader;
import java.io.IOException;
Expand All @@ -12,7 +14,7 @@
import java.nio.charset.StandardCharsets;

public class NotifyService {
private static final Logger logger = Logger.getLogger(NotifyService.class);
private static final Logger logger = LoggerFactory.getLogger(NotifyService.class);
private static final String notificationURL = System.getenv().getOrDefault("NOTIFICATION_SERVICE_URL", "http://localhost:8765/notification-service/v1/notification");
private static final String messageTemplate = System.getenv().getOrDefault("MESSAGE_TEMPLATE", "Your OTP to access SunbirdRC portal is %s. Please dont share this with anyone.");

Expand Down Expand Up @@ -44,7 +46,8 @@ public void notify(String to, String otp) throws IOException {
System.out.println(response.toString());
}
} catch (IOException e) {
logger.error(e);
logger.error("Exception occurred while notifying: {}", ExceptionUtils.getStackTrace(e));
throw e;
}

}
Expand Down
4 changes: 2 additions & 2 deletions deps/keycloak/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
build:
echo "Building docker image"
@cd ../keycloak-mobile-number-login-spi/ && sh ./build.sh
@docker build -t dockerhub/sunbird-rc-keycloak .
@docker build -t ghcr.io/sunbird-rc/sunbird-rc-keycloak .

push:
@docker push dockerhub/sunbird-rc-keycloak
@docker push ghcr.io/sunbird-rc/sunbird-rc-keycloak
2 changes: 1 addition & 1 deletion deps/keycloak/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ services:
- POSTGRES_USER=keycloak
- POSTGRES_PASSWORD=keycloak
keycloak:
image: dockerhub/keycloak
image: ghcr.io/sunbird-rc/keycloak
# build:
# .
environment:
Expand Down
33 changes: 18 additions & 15 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: '2.4'

services:
es:
image: docker.elastic.co/elasticsearch/elasticsearch:8.8.1
image: docker.elastic.co/elasticsearch/elasticsearch:7.17.13
environment:
- discovery.type=single-node
- 'ES_JAVA_OPTS=-Xms512m -Xmx512m'
Expand Down Expand Up @@ -40,14 +40,15 @@ services:
timeout: 5s
retries: 5
registry:
image: dockerhub/sunbird-rc-core:${RELEASE_VERSION}
image: ghcr.io/sunbird-rc/sunbird-rc-core:${RELEASE_VERSION}
volumes:
- ./${SCHEMA_DIR-java/registry/src/main/resources/public/_schemas}:/home/sunbirdrc/config/public/_schemas
- ./${VIEW_DIR-java/registry/src/main/resources/views}:/home/sunbirdrc/config/views/
environment:
- connectionInfo_uri=jdbc:postgresql://db:5432/registry
- connectionInfo_username=postgres
- connectionInfo_password=postgres
- encryption_enabled=${ENCRYPTION_ENABLED-false}
- event_enabled=${EVENT_ENABLED-false}
- event_topic=events
- event_providerName=dev.sunbirdrc.registry.service.impl.KafkaEventService
Expand All @@ -64,14 +65,16 @@ services:
- sunbird_sso_admin_client_secret=${KEYCLOAK_SECRET}
- claims_enabled=${CLAIMS_ENABLED-false}
- claims_url=http://claim-ms:8082
- signature_enabled=${SIGNATURE_ENABLED-false}
- sign_url=http://certificate-signer:8079/sign
- verify_url=http://certificate-signer:8079/verify
- sign_health_check_url=http://certificate-signer:8079/health
- signature_enabled=${SIGNATURE_ENABLED-true}
- certificate_enabled=${CERTIFICATE_ENABLED-false}
- pdf_url=http://certificate-api:8078/api/v1/certificatePDF
- certificate_health_check_url=http://certificate-api:8078/health
- template_base_url=http://registry:8081/api/v1/templates/ #Looks for certificate templates for pdf copy of the signed certificate
- sunbird_keycloak_user_set_password=true
- filestorage_enabled=false
- filestorage_connection_url=http://file-storage:9000
- filestorage_access_key=admin
- filestorage_secret_key=12345678
Expand Down Expand Up @@ -106,7 +109,7 @@ services:
timeout: 10s
retries: 10
keycloak:
image: dockerhub/sunbird-rc-keycloak:latest
image: ghcr.io/sunbird-rc/sunbird-rc-keycloak:latest
volumes:
- ./${KEYCLOAK_IMPORT_DIR-imports}:/opt/jboss/keycloak/imports
environment:
Expand All @@ -133,7 +136,7 @@ services:
db:
condition: service_started
claim-ms:
image: dockerhub/sunbird-rc-claim-ms:${RELEASE_VERSION}
image: ghcr.io/sunbird-rc/sunbird-rc-claim-ms:${RELEASE_VERSION}
environment:
- connectionInfo_uri=jdbc:postgresql://db:5432/registry
- connectionInfo_username=postgres
Expand All @@ -156,7 +159,7 @@ services:
timeout: 10s
retries: 10
certificate-signer:
image: dockerhub/sunbird-rc-certificate-signer:${RELEASE_VERSION}
image: ghcr.io/sunbird-rc/sunbird-rc-certificate-signer:${RELEASE_VERSION}
environment:
- PORT=8079
- TIME_ZONE=Asia/Kolkata
Expand All @@ -170,7 +173,7 @@ services:
timeout: 10s
retries: 10
certificate-api:
image: dockerhub/sunbird-rc-certificate-api:${RELEASE_VERSION}
image: ghcr.io/sunbird-rc/sunbird-rc-certificate-api:${RELEASE_VERSION}
environment:
- PORT=8078
ports:
Expand Down Expand Up @@ -201,7 +204,7 @@ services:
timeout: 20s
retries: 10
notification-ms:
image: dockerhub/sunbird-rc-notification-service:${RELEASE_VERSION}
image: ghcr.io/sunbird-rc/sunbird-rc-notification-service:${RELEASE_VERSION}
ports:
- '8765:8765'
healthcheck:
Expand Down Expand Up @@ -254,7 +257,7 @@ services:
timeout: 10s
retries: 10
public-key-service:
image: dockerhub/sunbird-rc-public-key-service
image: ghcr.io/sunbird-rc/sunbird-rc-public-key-service
environment:
- CONFIG_BASE_PATH=/etc/keys
ports:
Expand All @@ -268,7 +271,7 @@ services:
volumes:
- ./imports:/etc/keys
context-proxy-service:
image: dockerhub/sunbird-rc-context-proxy-service
image: ghcr.io/sunbird-rc/sunbird-rc-context-proxy-service
ports:
- '4400:4400'
healthcheck:
Expand All @@ -277,7 +280,7 @@ services:
timeout: 10s
retries: 10
nginx:
image: dockerhub/sunbird-rc-nginx
image: ghcr.io/sunbird-rc/sunbird-rc-nginx
ports:
- '80:80'
depends_on:
Expand All @@ -299,7 +302,7 @@ services:
timeout: 10s
retries: 10
metrics:
image: dockerhub/sunbird-rc-metrics
image: ghcr.io/sunbird-rc/sunbird-rc-metrics
environment:
CLICK_HOUSE_URL: clickhouse:9000
CLICKHOUSE_DATABASE: default
Expand All @@ -310,15 +313,15 @@ services:
- '8070:8070'
depends_on:
kafka:
condition: service_started
condition: service_healthy
registry:
condition: service_healthy
redis:
image: redis:latest
ports:
- '6379:6379'
digilocker-certificate-api:
image: dockerhub/sunbird-rc-digilocker-certificate-api
image: ghcr.io/sunbird-rc/sunbird-rc-digilocker-certificate-api
volumes:
- ./services/digilocker-certificate-api/config/:/go/config/
ports:
Expand All @@ -330,7 +333,7 @@ services:
DIGILOCKER_AUTH_KEYNAME: x-digilocker-hmac
PORT: 8087
bulk_issuance:
image: dockerhub/sunbird-rc-bulk-issuance
image: ghcr.io/sunbird-rc/sunbird-rc-bulk-issuance
ports:
- '5665:5665'
environment:
Expand Down
2 changes: 1 addition & 1 deletion dockerPushToRepo.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh

cd target && jar -xvf ../java/registry/target/registry.jar && cd -
docker build -t dockerhub/sunbird-rc .
docker build -t ghcr.io/sunbird-rc/sunbird-rc .

e () {
echo $( echo ${1} | jq ".${2}" | sed 's/\"//g')
Expand Down
1 change: 0 additions & 1 deletion imports/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@
}
}
}

2 changes: 1 addition & 1 deletion infra/helm_charts/charts/certificate-api/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
replicaCount: 1

image:
repository: dockerhub/sunbird-rc-certificate-api
repository: ghcr.io/sunbird-rc/sunbird-rc-certificate-api
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: ""
Expand Down
2 changes: 1 addition & 1 deletion infra/helm_charts/charts/certificate-signer/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
replicaCount: 1

image:
repository: dockerhub/sunbird-rc-certificate-signer
repository: ghcr.io/sunbird-rc/sunbird-rc-certificate-signer
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: ""
Expand Down
2 changes: 1 addition & 1 deletion infra/helm_charts/charts/claim-ms/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
replicaCount: 1

image:
repository: dockerhub/sunbird-rc-claim-ms
repository: ghcr.io/sunbird-rc/sunbird-rc-claim-ms
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: ""
Expand Down
2 changes: 1 addition & 1 deletion infra/helm_charts/charts/context-proxy-service/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
replicaCount: 1

image:
repository: dockerhub/sunbird-rc-context-proxy-service
repository: ghcr.io/sunbird-rc/sunbird-rc-context-proxy-service
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: ""
Expand Down
2 changes: 1 addition & 1 deletion infra/helm_charts/charts/keycloak-service/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
replicaCount: 1

image:
repository: dockerhub/sunbird-rc-keycloak
repository: ghcr.io/sunbird-rc/sunbird-rc-keycloak
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: ""
Expand Down
2 changes: 1 addition & 1 deletion infra/helm_charts/charts/notification-ms/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
replicaCount: 1

image:
repository: dockerhub/sunbird-rc-notification-service
repository: ghcr.io/sunbird-rc/sunbird-rc-notification-service
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: ""
Expand Down
2 changes: 1 addition & 1 deletion infra/helm_charts/charts/public-key-service/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
replicaCount: 1

image:
repository: dockerhub/sunbird-rc-public-key-service
repository: ghcr.io/sunbird-rc/sunbird-rc-public-key-service
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: ""
Expand Down
Loading

0 comments on commit cf33a8a

Please sign in to comment.