Skip to content

Commit

Permalink
[INJICERT-212] make download plugins from artifactory in to default i…
Browse files Browse the repository at this point in the history
…mplementation

Signed-off-by: Challarao <[email protected]>
  • Loading branch information
challabeehyv committed Jun 5, 2024
1 parent 1a6ca4d commit 4414da2
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 11 deletions.
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Execute installation script
1. Clone the repository and navigate to its directory:

```bash
cd inji-certify
cd inji-certify/docker-compose
./install.sh
```

Expand All @@ -47,10 +47,15 @@ Execute installation script
* take note of `$.schema[0].author` and `$.schema[0].id` from the create credential schema request
6. Create a folder with name loader_path [here](docker-compose/docker-compose-certify).
7. Add the jar file of Digital Credential Stack(DCS) plugin implementations for eSignet and certify:
* For eSignet create a folder with name esignet inside loader_path folder created in the above step and add the jar files inside the folder.
* For eSignet:
* create a folder with name esignet inside loader_path folder created in the above step and add the jar files inside the folder.
* JAR file for sunbird can be downloaded [here](https://mvnrepository.com/artifact/io.mosip.esignet.sunbirdrc/sunbird-rc-esignet-integration-impl).
* JAR file for mock identity can be downloaded [here](https://repo1.maven.org/maven2/io/mosip/esignet/mock/mock-esignet-integration-impl/0.9.2/mock-esignet-integration-impl-0.9.2.jar)
* For certify create a folder with name certify inside loader_path folder created in the above step and add the jar file inside the folder. The JAR can be built [from source](https://github.com/mosip/digital-credential-plugins/tree/INJICERT-13/sunbird-rc-certify-integration-impl).
* For certify:
* By default, the plugin will be taken from artifactory server
* For custom plugin:
* In the [docker compose file](docker-compose/docker-compose-certify/docker-compose.yml) uncomment the [enable_certify_artifactory](docker-compose/docker-compose-certify/docker-compose.yml#L74) and [volume](docker-compose/docker-compose-certify/docker-compose.yml#L78)
* create a folder with name certify inside loader_path folder created in the above step and add the jar file inside the folder. The JAR can be built [from source](https://github.com/mosip/digital-credential-plugins/tree/INJICERT-13/sunbird-rc-certify-integration-impl).
8. Modify the properties of the Esignet and Certify services located in the [esignet-default.properties](docker-compose/docker-compose-certify/config/esignet-default.properties) and [certify-default.properties](docker-compose/docker-compose-certify/config/certify-default.properties) files respectively.
- Include Issuer ID and credential schema ID for the following properties:
- esignet-default-properties:
Expand Down
14 changes: 11 additions & 3 deletions certify-service/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ ENV is_glowroot_env=${is_glowroot}
# environment variable to pass artifactory url, at docker runtime
ENV artifactory_url_env=${artifactory_url}

# environment variable for certify artifactory plugins to pass at docker run time
ENV enable_certify_artifactory="true"

# can be passed during Docker build as build time environment for github branch to pickup configuration from.
ARG container_user=mosip

Expand All @@ -54,7 +57,7 @@ ARG container_user_gid=1001

# install packages and create user
RUN apk -q update \
&& apk add -q unzip \
&& apk add -q unzip sudo bash curl \
&& addgroup -g ${container_user_gid} ${container_user_group} \
&& adduser -s /bin/sh -u ${container_user_uid} -G ${container_user_group} -h /home/${container_user} --disabled-password ${container_user}

Expand All @@ -70,6 +73,10 @@ RUN mkdir -p ${loader_path}

ENV loader_path_env=${loader_path}

ADD configure_start.sh configure_start.sh

RUN chmod +x configure_start.sh

COPY ./target/certify-service-*.jar certify-service.jar

# change permissions of file inside working dir
Expand All @@ -81,9 +88,10 @@ USER ${container_user_uid}:${container_user_gid}
EXPOSE 8090
EXPOSE 9010

#ENTRYPOINT [ "./configure_start.sh" ]
ENTRYPOINT [ "./configure_start.sh" ]

CMD if [ "$is_glowroot_env" = "present" ]; then \
wget -q --show-progress "${artifactory_url_env}"/artifactory/libs-release-local/io/mosip/testing/glowroot.zip ; \
wget -q "${artifactory_url_env}"/artifactory/libs-release-local/io/mosip/testing/glowroot.zip ; \
unzip glowroot.zip ; \
rm -rf glowroot.zip ; \
sed -i 's/<service_name>/idp-service/g' glowroot/glowroot.properties ; \
Expand Down
32 changes: 32 additions & 0 deletions certify-service/configure_start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash

set -e

download_and_extract() {
local url=$1
local dest_dir=$2
shift 2
local files_to_extract=("$@")
local temp_zip=$(mktemp)

wget -q "$url" -O "$temp_zip"

for file in "${files_to_extract[@]}"; do
unzip -o -j "$temp_zip" "$file" -d "$dest_dir"
done

rm -f "$temp_zip"
}

#if [ "$enable_esignet_artifactory" = "true" ]; then
# download_and_extract "${artifactory_url_env}/artifactory/libs-release-local/esignet/esignet-wrapper.zip" "${loader_path_env}" "esignet-mock-wrapper.jar" "sunbird-rc-esignet-integration-impl.jar"
#fi

if [ "$enable_certify_artifactory" = "true" ]; then
download_and_extract "${artifactory_url_env}/artifactory/libs-release-local/certify/certify-plugin.zip" "${loader_path_env}" "certify-sunbird-plugin.jar"
fi

echo "Installation complete"
cd $work_dir

exec "$@"
9 changes: 5 additions & 4 deletions docker-compose/docker-compose-certify/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ services:
networks:
- network
artifactory-server:
image: 'mosipid/artifactory-server:1.4.0-ES'
image: 'mosipdev/artifactory-server:develop'
ports:
- 8080:8080
networks:
Expand Down Expand Up @@ -61,20 +61,21 @@ services:
networks:
- network
certify:
image: mosipdev/inji-certify:INJICERT-13
image: mosipdev/inji-certify:develop
user: root
ports:
- 8090:8090
environment:
- artifactory_url_env=http://artifactory-server:8080/
- artifactory_url_env=http://artifactory-server:8080
- container_user=mosip
- active_profile_env=default
- SPRING_CONFIG_NAME=certify,certify-plugin
- SPRING_CONFIG_LOCATION=/home/mosip/certify-default.properties,/home/mosip/certify-plugin-default.properties
# - enable_certify_artifactory=false
volumes:
- ./config/certify-default.properties:/home/mosip/certify-default.properties
- ./config/certify-plugin-default.properties:/home/mosip/certify-plugin-default.properties
- ./loader_path/certify/:/home/mosip/additional_jars/
# - ./loader_path/certify/:/home/mosip/additional_jars/
depends_on:
- esignet
networks:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,7 @@
}
},
"url": {
"raw": "{{certifyServiceUrl}}/v1/certify/issuance/credential",
"raw": "{{certifyServiceUrl}}/issuance/credential",
"host": [
"{{certifyServiceUrl}}"
],
Expand Down

0 comments on commit 4414da2

Please sign in to comment.