In this post i will discuss how we can setup IS as key manager with docker.
For this you need to download pre configured IS as key manager pack. You can find more information about this pattern from here(https://docs.wso2.com/display/CLUSTER44x/Configuring+the+Pre-Packaged+Identity+Server+5.1.0+with+API+Manager+1.10.0).
Also we need to download pre configured pack from this location(http://product-dist.wso2.com/downloads/api-manager/1.10.0/identity-server/wso2is-5.1.0.zip)
Then clone docker files repo with following command.
>git clone https://github.com/wso2/dockerfiles/
Once you did checkout copy JDK and downloaded IS as key manager pack to following location.
/dockerfiles/common/provision/default/files
File named should be as follows.
jdk-7u80-linux-x64.tar.gz
wso2is_km-5.1.0.zip
Then add following content to build.sh file.
+++ b/common/scripts/entrypoint.sh@@ -19,6 +19,12 @@ set -e source /etc/profile.d/set_java_home.sh ++if [ ! -z $SLEEP ];then+ echo "Going to sleep for ${SLEEP}s..."+ sleep $SLEEP+fi+ prgdir=$(dirname "$0") script_path=$(cd "$prgdir"; pwd)
Then download wso2is_km.zip and copy it to /dockerfiles root and unzip it. It will have all scripts required to build docker image.
Now we are going to build docker image. For that first you need to run following command from extracted folder(/dockerfiles/wso2is_km).
>./build.sh -v 5.1.0
Then it will build docker image and add it to local repo. You can check it by typing following command.
>docker images
>wso2is_km 5.1.0 9483d4962e97 2 hours ago 889.8 MB
Now we have docker image. Now we are going to setup deployment using docker-compose and we will use above created image to setup key manager instance.
My Docker compose file will be as follows. And you can see one API Manager, Key Manager, Database server and Nginx instance there.
version: '2'services: dbms: container_name: apim_rdbms build: context: . dockerfile: database/Dockerfile environment: MYSQL_ROOT_PASSWORD: root api-manager: container_name: api-manager build: context: . dockerfile: api-manager/Dockerfile environment: - SLEEP=20 links: - nginx:api-manager key-manager: container_name: key-manager build: context: . dockerfile: key-manager/Dockerfile environment: - SLEEP=30 links: - nginx:key-manager nginx: container_name: nginx build: context: . dockerfile: nginx/Dockerfile environment: - SLEEP=100 ports: - "444:9443" - "81:9763" - "8280:8280" - "8243:8243"
Please refer below deployment diagram to get clear idea about deployment we are going to have.
You can download complete docker-compose archive from this location(pattern-simple-iskm.zip). You need to download it and unzip it. Then move to that directory(/pattern-simple-iskm).
Then you can run this deployment using following commands.
Build and start deployment
docker-compose up --build
docker-compose up --build
Stop running deployment.
docker-compose down
Cleanup files.
docker rm -f $(docker ps -qa)
docker rm -f $(docker ps -qa)
Now you can access API Manager instance using following URLs from host machine.
Store - https://api-manager:444/store
Publisher - https://api-manager:444/store
Gateway - https://api-manager:8243/
KeyManager - https://key-manager:444/carbon
No comments:
Post a Comment