-
Notifications
You must be signed in to change notification settings - Fork 216
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #160 from chamindi-a/2.5.x
Add apim-Is-as km ver.5.6 files
- Loading branch information
Showing
15 changed files
with
356 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
# ------------------------------------------------------------------------ | ||
# | ||
# Copyright 2018 WSO2, Inc. (http://wso2.com) | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License | ||
# | ||
# ------------------------------------------------------------------------ | ||
|
||
# set to latest Alpine | ||
FROM openjdk:8u171-jdk-alpine3.8 | ||
MAINTAINER WSO2 Docker Maintainers "dev@wso2.org” | ||
# set user configurations | ||
ARG USER=wso2carbon | ||
ARG USER_ID=802 | ||
ARG USER_GROUP=wso2 | ||
ARG USER_GROUP_ID=802 | ||
ARG USER_HOME=/home/${USER} | ||
# set dependant files directory | ||
ARG FILES=./files | ||
# set wso2 product configurations | ||
ARG WSO2_SERVER=wso2is-km | ||
ARG WSO2_SERVER_VERSION=5.6.0 | ||
ARG WSO2_SERVER_PACK=${WSO2_SERVER}-${WSO2_SERVER_VERSION} | ||
ARG WSO2_SERVER_HOME=${USER_HOME}/${WSO2_SERVER_PACK} | ||
# install required packages | ||
RUN apk add --update --no-cache \ | ||
curl \ | ||
netcat-openbsd && \ | ||
rm -rf /var/cache/apk/* && \ | ||
echo '[ ! -z "$TERM" -a -r /etc/motd ] && cat /etc/motd' \ | ||
>> /etc/bash.bashrc \ | ||
; echo "\n\ | ||
Welcome to WSO2 Docker Resources \n\ | ||
--------------------------------- \n\ | ||
This Docker container comprises of a WSO2 product, running with its latest updates \n\ | ||
which are under the End User License Agreement (EULA) 2.0. \n\ | ||
Read more about EULA 2.0 here @ https://wso2.com/licenses/wso2-update/2.0 \n" \ | ||
> /etc/motd | ||
# create a user group and a user | ||
RUN addgroup -g ${USER_GROUP_ID} ${USER_GROUP}; \ | ||
adduser -u ${USER_ID} -D -g '' -h ${USER_HOME} -G ${USER_GROUP} ${USER} ; | ||
# copy wso2 product distribution zip files to user's home directory and set ownership | ||
COPY --chown=wso2carbon:wso2 ${FILES}/${WSO2_SERVER_PACK} ${WSO2_SERVER_HOME}/ | ||
# copy shared artifacts to a temporary location | ||
COPY --chown=wso2carbon:wso2 ${FILES}/${WSO2_SERVER_PACK}/repository/deployment/ ${USER_HOME}/wso2-tmp/deployment/ | ||
# copy init script to user home | ||
COPY --chown=wso2carbon:wso2 init.sh ${USER_HOME}/ | ||
# copy mysql connector jar to the server as a third party library | ||
COPY --chown=wso2carbon:wso2 ${FILES}/mysql-connector-java-*-bin.jar ${WSO2_SERVER_HOME}/repository/components/lib/ | ||
# add libraries for Kubernetes membership scheme based clustering | ||
ADD --chown=wso2carbon:wso2 https://repo1.maven.org/maven2/dnsjava/dnsjava/2.1.8/dnsjava-2.1.8.jar ${WSO2_SERVER_HOME}/repository/components/lib/ | ||
ADD --chown=wso2carbon:wso2 https://repo1.maven.org/maven2/org/wso2/carbon/kubernetes/artifacts/kubernetes-membership-scheme/1.0.5/kubernetes-membership-scheme-1.0.5.jar ${WSO2_SERVER_HOME}/repository/components/dropins/ | ||
# create Java prefs dir | ||
# this is to avoid warning logs printed by FileSystemPreferences class | ||
RUN mkdir -p ${USER_HOME}/.java/.systemPrefs && \ | ||
mkdir -p ${USER_HOME}/.java/.userPrefs && \ | ||
chmod -R 755 ${USER_HOME}/.java && \ | ||
chown -R ${USER}:${USER_GROUP} ${USER_HOME}/.java | ||
# set environment variables | ||
ENV WORKING_DIRECTORY=${USER_HOME} \ | ||
WSO2_SERVER_HOME=${WSO2_SERVER_HOME} \ | ||
JAVA_OPTS="-Djava.util.prefs.systemRoot=${USER_HOME}/.java -Djava.util.prefs.userRoot=${USER_HOME}/.java/.userPrefs" | ||
# set the user and work directory | ||
USER ${USER_ID} | ||
WORKDIR ${USER_HOME} | ||
# expose ports | ||
EXPOSE 9763 9443 | ||
# initiate container and start WSO2 Carbon server | ||
ENTRYPOINT ${WORKING_DIRECTORY}/init.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# Dockerfile for WSO2 Identity Server deployed as the API Key Manager # | ||
The section defines the step-by-step instructions to build the Docker image for WSO2 IS deployed as API Key Manager. | ||
|
||
## Prerequisites | ||
|
||
* [Docker](https://www.docker.com/get-docker) v17.09.0 or above | ||
|
||
## How to build an image and run | ||
##### 1. Checkout this repository into your local machine using the following git command. | ||
``` | ||
git clone https://github.com/wso2/docker-apim.git | ||
``` | ||
|
||
>The local copy of the `dockerfiles/is-as-km` directory will be referred to as `IS_KM_DOCKERFILE_HOME` from this point onwards. | ||
##### 2. Add JDK, WSO2 API Manager distributions and MySQL connector to `<IS_KM_DOCKERFILE_HOME>/files` | ||
- Download [JDK 1.8](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html) | ||
and extract that to `<IS_KM_DOCKERFILE_HOME>/files`. | ||
- Download the WSO2 Identity Server as Key Manager 5.6.0 distribution (http://wso2.com/api-management/try-it/) | ||
and extract that to `<IS_KM_DOCKERFILE_HOME>/files`. <br> | ||
- Once both JDK and WSO2 API Manager distributions are extracted the folder structure should be as follows; | ||
|
||
```bash | ||
<IS_KM_DOCKERFILE_HOME>/files/jdk<version>/ | ||
<IS_KM_DOCKERFILE_HOME>/files/wso2is-km-5.6.0/ | ||
``` | ||
- Download [MySQL Connector/J](https://dev.mysql.com/downloads/connector/j/) v5.1.45 and then copy that to `<IS_KM_DOCKERFILE_HOME>/files` folder | ||
|
||
>Please refer to [WSO2 Update Manager documentation](https://docs.wso2.com/display/ADMIN44x/Updating+WSO2+Products) | ||
in order to obtain latest bug fixes and updates for the product. | ||
|
||
##### 3. Build the Docker image. | ||
- Navigate to `<IS_KM_DOCKERFILE_HOME>` directory. <br> | ||
Execute `docker build` command as shown below. | ||
+ `docker build -t wso2is-km:5.6.0-alpine .` | ||
|
||
##### 4. Running the Docker image. | ||
- `docker run -it -p 9443:9443 wso2is-km:5.6.0-alpine` | ||
|
||
##### 5. Accessing management console. | ||
- To access the management console, use the docker host IP and port 9443. | ||
+ `https:<DOCKER_HOST>:9443/carbon` | ||
|
||
>In here, <DOCKER_HOST> refers to hostname or IP of the host machine on top of which containers are spawned. | ||
|
||
|
||
## How to update configurations | ||
Configurations would lie on the Docker host machine and they can be volume mounted to the container. <br> | ||
As an example, steps required to change the port offset using `carbon.xml` is as follows. | ||
|
||
##### 1. Stop the API Manager container if it's already running. | ||
In WSO2 API Manager 2.5.0 product distribution, `carbon.xml` configuration file <br> | ||
can be found at `<DISTRIBUTION_HOME>/repository/conf`. Copy the file to some suitable location of the host machine, <br> | ||
referred to as `<SOURCE_CONFIGS>/carbon.xml` and change the offset value under ports to 1. | ||
|
||
##### 2. Grant read permission to `other` users for `<SOURCE_CONFIGS>/carbon.xml` | ||
``` | ||
chmod o+r <SOURCE_CONFIGS>/carbon.xml | ||
``` | ||
##### 3. Run the image by mounting the file to container as follows. | ||
``` | ||
docker run \ | ||
-p 9444:9444 \ | ||
--volume <SOURCE_CONFIGS>/carbon.xml:<TARGET_CONFIGS>/carbon.xml \ | ||
wso2is-km:5.6.0-alpine | ||
``` | ||
>In here, <TARGET_CONFIGS> refers to /home/wso2carbon/wso2is-km-5.6.0/repository/conf folder of the container. | ||
## Docker command usage references | ||
* [Docker build command reference](https://docs.docker.com/engine/reference/commandline/build/) | ||
* [Docker run command reference](https://docs.docker.com/engine/reference/run/) | ||
* [Dockerfile reference](https://docs.docker.com/engine/reference/builder/) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#!/bin/sh | ||
# ------------------------------------------------------------------------ | ||
# Copyright 2018 WSO2, Inc. (http://wso2.com) | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License | ||
# ------------------------------------------------------------------------ | ||
|
||
set -e | ||
|
||
# volume mounts | ||
config_volume=${WORKING_DIRECTORY}/wso2-config-volume | ||
artifact_volume=${WORKING_DIRECTORY}/wso2-artifact-volume | ||
deployment_volume=${WSO2_SERVER_HOME}/repository/deployment | ||
# original deployment artifacts | ||
original_deployment_artifacts=${WORKING_DIRECTORY}/wso2-tmp/deployment | ||
|
||
# capture Docker container IP from the container's /etc/hosts file | ||
docker_container_ip=$(awk 'END{print $1}' /etc/hosts) | ||
|
||
# check if the WSO2 non-root user home exists | ||
test ! -d ${WORKING_DIRECTORY} && echo "WSO2 Docker non-root user home does not exist" && exit 1 | ||
|
||
# check if the WSO2 product home exists | ||
test ! -d ${WSO2_SERVER_HOME} && echo "WSO2 Docker product home does not exist" && exit 1 | ||
|
||
# if a deployment_volume is present and empty, copy original deployment artifacts to server... | ||
# copying original artifacts to ${WORKING_DIRECTORY}/wso2-tmp/deployment was already done in the Dockerfile | ||
# these artifacts will be copied to deployment_volume if it is empty, before the server is started | ||
if test -d ${original_deployment_artifacts}; then | ||
if [ -z "$(ls -A ${deployment_volume}/)" ]; then | ||
# if no artifact is found under <WSO2_SERVER_HOME>/repository/deployment; copy originals | ||
echo "Copying original deployment artifacts from temporary location to server..." | ||
cp -R ${original_deployment_artifacts}/* ${deployment_volume}/ | ||
fi | ||
fi | ||
|
||
# copy any configuration changes mounted to config_volume | ||
test -d ${config_volume}/ && cp -RL ${config_volume}/* ${WSO2_SERVER_HOME}/ | ||
# copy any artifact changes mounted to artifact_volume | ||
test -d ${artifact_volume}/ && cp -RL ${artifact_volume}/* ${WSO2_SERVER_HOME}/ | ||
|
||
# make any node specific configuration changes | ||
# for example, set the Docker container IP as the `localMemberHost` under axis2.xml clustering configurations (effective only when clustering is enabled) | ||
sed -i "s#<parameter\ name=\"localMemberHost\".*<\/parameter>#<parameter\ name=\"localMemberHost\">${docker_container_ip}<\/parameter>#" ${WSO2_SERVER_HOME}/repository/conf/axis2/axis2.xml | ||
|
||
# start WSO2 Carbon server | ||
sh ${WSO2_SERVER_HOME}/bin/wso2server.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.