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

Feature errors cleanup #248

Merged
merged 28 commits into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
861ad8e
fixed file storage errors
holashchand Sep 4, 2023
ea2eaa9
added missing exception class file
holashchand Sep 4, 2023
189c0f2
fixed tests failure
holashchand Sep 4, 2023
222c5a3
fixed elastic search issues
holashchand Sep 4, 2023
16799e5
fixed signing and certificate service logs
holashchand Sep 4, 2023
fa87187
fixed errors for audit, notification, encryption, swagger, Api Messag…
holashchand Sep 5, 2023
9f2c1ee
fixed registry helper tests failing
holashchand Sep 6, 2023
17c824a
enabling certificate and claims only when enabled
holashchand Sep 6, 2023
920da2d
fixed make tests failing
holashchand Sep 7, 2023
bb02f4f
added health check to metrics service and fixed metrics service issues
holashchand Sep 8, 2023
2fc87d3
added missing metrics files
holashchand Sep 8, 2023
abf6d03
fixed error messages
holashchand Sep 8, 2023
d391071
minor fix
holashchand Sep 11, 2023
99b4d15
fixed certificate api docker file
holashchand Sep 11, 2023
a516175
added debug plugin
holashchand Sep 11, 2023
bb1d82a
added public key
holashchand Sep 11, 2023
33b074a
added manual workflow
holashchand Sep 11, 2023
33411eb
suppressing exception while loading schema from db
holashchand Sep 11, 2023
263d211
fixed elastic search version and removed debug config
holashchand Sep 12, 2023
c4a3453
fixed error messages
holashchand Sep 12, 2023
78c9c8b
fixed error messages
holashchand Sep 12, 2023
03145c7
change error messages to print stack
holashchand Sep 12, 2023
9c6dc53
changed kafka port exposing to 9092
holashchand Sep 13, 2023
5d186fd
fixed error messages, failing tests and renamed test environments
holashchand Sep 14, 2023
488bdef
throwing notify exception
holashchand Sep 14, 2023
65eb66c
reverted from error messages to stack trace
holashchand Sep 14, 2023
ffbfcda
fixed error messages for golang
holashchand Sep 15, 2023
43f260d
adding ensure index at startup back
holashchand Sep 15, 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
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
6 changes: 2 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,10 @@ java/registry/target/registry.jar: $(SOURCES)
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));
holashchand marked this conversation as resolved.
Show resolved Hide resolved
throw e;
}

}
Expand Down
16 changes: 13 additions & 3 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,6 +40,7 @@ services:
- 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 @@ -54,15 +55,18 @@ services:
- sunbird_sso_admin_client_id=${KEYCLOAK_ADMIN_CLIENT_ID-admin-api}
- sunbird_sso_client_id=${KEYCLOAK_CLIENT_ID-registry-frontend}
- 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=true
- certificate_enabled=${CERTIFICATE_ENABLED-false}
holashchand marked this conversation as resolved.
Show resolved Hide resolved
- 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 @@ -281,9 +285,15 @@ services:
REDIS_URL: redis:6379
ports:
- "8070:8070"
healthcheck:
test:
[ "CMD-SHELL", "wget -nv -t1 --spider http://localhost:8070/health || exit 1" ]
interval: 30s
timeout: 10s
retries: 10
depends_on:
kafka:
condition: service_started
condition: service_healthy
registry:
condition: service_healthy
redis:
Expand Down
1 change: 0 additions & 1 deletion java/.mvn/wrapper/MavenWrapperDownloader.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ public static void main(String args[]) {
System.exit(0);
} catch (Throwable e) {
System.out.println("- Error downloading");
e.printStackTrace();
System.exit(1);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "BirthCertificate16",
"schema": "{\n \"$schema\": \"http://json-schema.org/draft-07/schema\",\n \"type\": \"object\",\n \"properties\": {\n \"BirthCertificate\": {\n \"$ref\": \"#/definitions/BirthCertificate\"\n }\n },\n \"required\": [\n \"BirthCertificate\"\n ],\n \"title\": \"BirthCertificate\",\n \"definitions\": {\n \"BirthCertificate\": {\n \"$id\": \"#/properties/BirthCertificate\",\n \"type\": \"object\",\n \"title\": \"The BirthCertificate Schema\",\n \"required\": [\n \"name\",\n \"gender\",\n \"date_of_birth\",\n \"place_of_birth\",\n \"contact\"\n ],\n \"properties\": {\n \"name\": {\n \"type\": \"string\"\n },\n \"gender\": {\n \"type\": \"string\"\n },\n \"date_of_birth\": {\n \"type\": \"string\",\n \"format\": \"date-time\"\n },\n \"hospital\": {\n \"type\": \"string\"\n },\n \"place_of_birth\": {\n \"type\": \"string\",\n \"enum\": [\"Bangalore\", \"Mysore\", \"Mandya\"]\n },\n \"name_of_mother\": {\n \"type\": \"string\"\n },\n \"name_of_father\": {\n \"type\": \"string\"\n },\n \"present_address\": {\n \"type\": \"string\",\n \"minLength\": 10,\n \"maxLength\": 50\n },\n \"contact\": {\n \"type\": \"string\"\n }\n }\n }\n },\n \"_osConfig\": {\n \"uniqueIndexFields\": [\n \"contact\"\n ],\n \"ownershipAttributes\": [],\n \"roles\": [],\n \"inviteRoles\": [\n \"anonymous\"\n ],\n \"credentialTemplate\": {\n \"@context\": [\n \"https://www.w3.org/2018/credentials/v1\",\n {\n \"@context\": {\n \"@version\": 1.1,\n \"@protected\": true,\n \"BirthCertificate\": {\n \"@id\": \"https://github.com/sunbird-specs/vc-specs#BirthCertificate\",\n \"@context\": {\n \"id\": \"@id\",\n \"@version\": 1.1,\n \"@protected\": true,\n \"skills\": \"schema:Text\",\n \"name\": \"schema:Text\",\n \"gender\": \"schema:Text\",\n \"date_of_birth\": \"schema:Text\",\n \"hospital\": \"schema:Text\",\n \"place_of_birth\": \"schema:Text\",\n \"name_of_mother\": \"schema:Text\",\n \"name_of_father\": \"schema:Text\",\n \"present_address\": \"schema:Text\",\n \"contact\": \"schema:Text\"\n }\n }\n }\n }\n ],\n \"type\": [\n \"VerifiableCredential\"\n ],\n \"issuanceDate\": \"2021-08-27T10:57:57.237Z\",\n \"credentialSubject\": {\n \"type\": \"BirthCertificate\",\n \"name\": \"{{name}}\",\n \"gender\": \"{{gender}}\",\n \"date_of_birth\": \"{{date_of_birth}}\",\n \"hospital\": \"{{hospital}}\",\n \"place_of_birth\": \"{{place_of_birth}}\",\n \"name_of_mother\": \"{{name_of_mother}}\",\n \"name_of_father\": \"{{name_of_father}}\",\n \"present_address\": \"{{present_address}}\",\n \"contact\": \"{{contact}}\"\n },\n \"issuer\": \"did:web:sunbirdrc.dev/vc/BirthCertificate\"\n },\n \"certificateTemplates\": {\n \"html\": \"https://gist.githubusercontent.com/tejash-jl/56b97ffcb99f93e2e1ec49e88c0c2c7f/raw/1242b9af7f58b9d5ca1e4f11d442aa4815598a31/BirthCertificate.html\"\n }\n }\n}",
"schema": "{\n \"$schema\": \"http://json-schema.org/draft-07/schema\",\n \"type\": \"object\",\n \"properties\": {\n \"BirthCertificate\": {\n \"$ref\": \"#/definitions/BirthCertificate\"\n }\n },\n \"required\": [\n \"BirthCertificate\"\n ],\n \"title\": \"BirthCertificate\",\n \"definitions\": {\n \"BirthCertificate\": {\n \"$id\": \"#/properties/BirthCertificate\",\n \"type\": \"object\",\n \"title\": \"The BirthCertificate Schema\",\n \"required\": [\n \"name\",\n \"gender\",\n \"date_of_birth\",\n \"place_of_birth\",\n \"contact\"\n ],\n \"properties\": {\n \"name\": {\n \"type\": \"string\"\n },\n \"gender\": {\n \"type\": \"string\"\n },\n \"date_of_birth\": {\n \"type\": \"string\",\n \"format\": \"date-time\"\n },\n \"hospital\": {\n \"type\": \"string\"\n },\n \"place_of_birth\": {\n \"type\": \"string\",\n \"enum\": [\"Bangalore\", \"Mysore\", \"Mandya\"]\n },\n \"name_of_mother\": {\n \"type\": \"string\"\n },\n \"name_of_father\": {\n \"type\": \"string\"\n },\n \"present_address\": {\n \"type\": \"string\",\n \"minLength\": 10,\n \"maxLength\": 50\n },\n \"contact\": {\n \"type\": \"string\"\n }\n }\n }\n },\n \"_osConfig\": {\n \"uniqueIndexFields\": [\n \"contact\"\n ],\n \"ownershipAttributes\": [],\n \"roles\": [],\n \"inviteRoles\": [\n \"anonymous\"\n ],\n \"credentialTemplate\": {\n \"@context\": [\n \"https://www.w3.org/2018/credentials/v1\",\n {\n \"@context\": {\n \"@version\": 1.1,\n \"@protected\": true,\n \"BirthCertificate\": {\n \"@id\": \"https://github.com/sunbird-specs/vc-specs#BirthCertificate\",\n \"@context\": {\n \"id\": \"@id\",\n \"@version\": 1.1,\n \"@protected\": true,\n \"skills\": \"schema:Text\",\n \"name\": \"schema:Text\",\n \"gender\": \"schema:Text\",\n \"date_of_birth\": \"schema:Text\",\n \"hospital\": \"schema:Text\",\n \"place_of_birth\": \"schema:Text\",\n \"name_of_mother\": \"schema:Text\",\n \"name_of_father\": \"schema:Text\",\n \"present_address\": \"schema:Text\",\n \"contact\": \"schema:Text\"\n }\n }\n }\n }\n ],\n \"type\": [\n \"VerifiableCredential\"\n ],\n \"issuanceDate\": \"2021-08-27T10:57:57.237Z\",\n \"credentialSubject\": {\n \"type\": \"BirthCertificate\",\n \"name\": \"{{name}}\",\n \"gender\": \"{{gender}}\",\n \"date_of_birth\": \"{{date_of_birth}}\",\n \"hospital\": \"{{hospital}}\",\n \"place_of_birth\": \"{{place_of_birth}}\",\n \"name_of_mother\": \"{{name_of_mother}}\",\n \"name_of_father\": \"{{name_of_father}}\",\n \"present_address\": \"{{present_address}}\",\n \"contact\": \"{{contact}}\"\n },\n \"issuer\": \"did:web:sunbirdrc.dev/vc/BirthCertificate\"\n },\n \"certificateTemplates\": {\n \"html\": \"https://gist.githubusercontent.com/holashchand/03785ec73f278f955c2dec749afc9e76/raw/b18edeca22980dd388d498e12cb1223e3d6c3a49/BirthCertificate.html\"\n }\n }\n}",
"status": "PUBLISHED"
}
Loading
Loading