-
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.
Change scripts to compatible with jenkins process
- Loading branch information
1 parent
7ec77c2
commit 4ac16c6
Showing
39 changed files
with
644 additions
and
1,181 deletions.
There are no files selected for viewing
Binary file not shown.
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,99 @@ | ||
# ------------------------------------------------------------------------ | ||
# Copyright (c) 2020 WSO2 Inc. (http://www.wso2.org) All Rights Reserved. | ||
# | ||
# WSO2 Inc. licenses this file to you 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 Ubuntu LTS | ||
FROM ubuntu:16.04 | ||
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 JDK configurations | ||
ARG JAVA_HOME=${USER_HOME}/java | ||
ARG JDK_NAME=jdk-8u261-linux-x64.tar.gz | ||
# build arguments for WSO2 product installation | ||
ARG WSO2_SERVER_VERSION=2.1.0 | ||
ARG WSO2_SERVER_NAME=wso2am-analytics | ||
ARG WSO2_SERVER_REPOSITORY=product-apim | ||
ARG WSO2_SERVER=${WSO2_SERVER_NAME}-${WSO2_SERVER_VERSION} | ||
ARG WSO2_SERVER_HOME=${USER_HOME}/${WSO2_SERVER} | ||
ARG WSO2_SERVER_DIST_URL | ||
ARG JDK_URL | ||
# build arguments for external artifacts | ||
ARG MYSQL_CONNECTOR_VERSION=5.1.49 | ||
# build argument for MOTD | ||
ARG MOTD="\n\ | ||
Welcome to WSO2 Docker resources.\n\ | ||
------------------------------------ \n\ | ||
This Docker container comprises of a WSO2 product, running with its latest GA release \n\ | ||
which is under the Apache License, Version 2.0. \n\ | ||
Read more about Apache License, Version 2.0 here @ http://www.apache.org/licenses/LICENSE-2.0.\n" | ||
|
||
# create a user group and a user | ||
RUN groupadd --system -g ${USER_GROUP_ID} ${USER_GROUP} && \ | ||
useradd --system --create-home --home-dir ${USER_HOME} --no-log-init -g ${USER_GROUP_ID} -u ${USER_ID} ${USER} | ||
|
||
# copy init script to user home | ||
COPY --chown=wso2carbon:wso2 docker-entrypoint.sh ${USER_HOME}/ | ||
|
||
# install required packages | ||
RUN \ | ||
apt-get update \ | ||
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ | ||
libxml2-utils \ | ||
netcat \ | ||
unzip \ | ||
wget \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# installe Oracle JDK | ||
RUN \ | ||
mkdir -p ${JAVA_HOME} \ | ||
&& wget --no-check-certificate -O ${JDK_NAME} ${JDK_URL} \ | ||
&& tar -xf ${JDK_NAME} -C ${JAVA_HOME} --strip-components=1 \ | ||
&& chown wso2carbon:wso2 -R ${JAVA_HOME} \ | ||
&& rm -f ${JDK_NAME} | ||
|
||
# add the WSO2 product distribution to user's home directory | ||
RUN \ | ||
wget --no-check-certificate -O ${WSO2_SERVER}.zip "${WSO2_SERVER_DIST_URL}" \ | ||
&& unzip -d ${USER_HOME} ${WSO2_SERVER}.zip \ | ||
&& chown wso2carbon:wso2 -R ${WSO2_SERVER_HOME} \ | ||
&& mkdir ${USER_HOME}/wso2-tmp \ | ||
&& cp -r ${WSO2_SERVER_HOME}/repository/deployment/server ${USER_HOME}/wso2-tmp/server \ | ||
&& rm -f ${WSO2_SERVER}.zip | ||
# add MySQL JDBC connector to server home as a third party library | ||
ADD --chown=wso2carbon:wso2 https://repo1.maven.org/maven2/mysql/mysql-connector-java/${MYSQL_CONNECTOR_VERSION}/mysql-connector-java-${MYSQL_CONNECTOR_VERSION}.jar ${WSO2_SERVER_HOME}/repository/components/dropins/ | ||
|
||
# set the user and work directory | ||
USER ${USER_ID} | ||
WORKDIR ${USER_HOME} | ||
|
||
# set environment variables | ||
ENV JAVA_HOME=${JAVA_HOME} \ | ||
PATH=$JAVA_HOME/bin:$PATH \ | ||
WSO2_SERVER_HOME=${WSO2_SERVER_HOME} \ | ||
WORKING_DIRECTORY=${USER_HOME} | ||
|
||
# expose ports | ||
EXPOSE 9764 9444 7712 7612 | ||
|
||
# initiate container and start WSO2 Carbon Server | ||
ENTRYPOINT ${WORKING_DIRECTORY}/docker-entrypoint.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,71 @@ | ||
# Dockerfile for WSO2 API Manager Analytics # | ||
The section defines the step-by-step instructions to build the Docker image for WSO2 API Manager Analytics 2.1.0. | ||
|
||
## Prerequisites | ||
* [Docker](https://www.docker.com/get-docker) v17.09.0 or above | ||
* [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) client | ||
* WSO2 API Manager Analytics pack downloaded through [WUM](https://wso2.com/wum/download) | ||
* Download JDK 8 through [Oracle](https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html) | ||
- Host the downloaded pack and JDK locally or on a remote location. | ||
>The hosted product pack location and JDK location will be passed as the build arguments WSO2_SERVER_DIST_URL and JDK_URL when building the Docker image. | ||
## 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 `dockerfile/apim` directory will be referred to as `ANALYTICS_DOCKERFILE_HOME` from this point onwards. | ||
>Please refer to [WSO2 Update Manager documentation](https://docs.wso2.com/display/updates/Getting+Started) | ||
in order to obtain latest bug fixes and updates for the product. | ||
|
||
##### 2. Build the Docker image. | ||
- Navigate to `<ANALYTICS_DOCKERFILE_HOME>` directory. <br> | ||
Execute `docker build` command as shown below. | ||
|
||
+ `docker build --build-arg WSO2_SERVER_DIST_URL=<URL_OF_THE_HOSTED_LOCATION/FILENAME> JDK_URL=<URL_OF_THE_HOSTED_JDK_LOCATION/FILENAME> -t wso2am-analytics:2.1.0 .` | ||
- eg:- Hosted locally: docker build --build-arg WSO2_SERVER_DIST_URL=http://172.17.0.1:8000/wso2am-analytics-2.1.0.zip JDK_URL=http://172.17.0.1:8000/jdk-8u261-linux-x64.tar.gz -t wso2am-analytics:2.1.0 . | ||
- eg:- Hosted remotely: docker build --build-arg WSO2_SERVER_DIST_URL=http://<public_ip:port>/wso2am-analytics-2.1.0.zip JDK_URL=http://172.17.0.1:8000/jdk-8u261-linux-x64.tar.gz -t wso2am-analytics:2.1.0 . | ||
|
||
##### 3. Running the Docker image. | ||
- `docker run -it -p 9444:9444 wso2am-analytics:2.1.0` | ||
>Here, only port 9444 (HTTPS servlet transport) has been mapped to a Docker host port. | ||
You may map other container service ports, which have been exposed to Docker host ports, as desired. | ||
|
||
##### 4. Accessing management console. | ||
- To access the management console, use the docker host IP and port 9444. | ||
+ `https:<DOCKER_HOST>:9444/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 Analytics 2.1.0 product distribution, `carbon.xml` configuration file <br> | ||
can be found at `<DISTRIBUTION_HOME>/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 9445:9445 | ||
--volume <SOURCE_CONFIGS>/carbon.xml:<TARGET_CONFIGS>/carbon.xml | ||
wso2am-analytics:2.1.0 | ||
``` | ||
|
||
>In here, <TARGET_CONFIGS> refers to /home/wso2carbon/wso2am-analytics-2.1.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/) |
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,36 @@ | ||
#!/bin/sh | ||
# ------------------------------------------------------------------------ | ||
# Copyright (c) 2020 WSO2 Inc. (http://www.wso2.org) All Rights Reserved. | ||
# | ||
# WSO2 Inc. licenses this file to you 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 | ||
|
||
# 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 | ||
|
||
# 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}/ | ||
|
||
# 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
# ------------------------------------------------------------------------ | ||
# Copyright (c) 2020 WSO2 Inc. (http://www.wso2.org) All Rights Reserved. | ||
# | ||
# WSO2 Inc. licenses this file to you 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 Ubuntu LTS | ||
FROM ubuntu:16.04 | ||
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 JDK configurations | ||
ARG JAVA_HOME=${USER_HOME}/java | ||
ARG JDK_NAME=jdk-8u261-linux-x64.tar.gz | ||
# build arguments for WSO2 product installation | ||
ARG WSO2_SERVER_NAME=wso2am | ||
ARG WSO2_SERVER_VERSION=2.1.0 | ||
ARG WSO2_SERVER_REPOSITORY=product-apim | ||
ARG WSO2_SERVER=${WSO2_SERVER_NAME}-${WSO2_SERVER_VERSION} | ||
ARG WSO2_SERVER_HOME=${USER_HOME}/${WSO2_SERVER} | ||
ARG WSO2_SERVER_DIST_URL | ||
ARG JDK_URL | ||
# build arguments for external artifacts | ||
ARG MYSQL_CONNECTOR_VERSION=5.1.49 | ||
# build argument for MOTD | ||
ARG MOTD="\n\ | ||
Welcome to WSO2 Docker resources.\n\ | ||
------------------------------------ \n\ | ||
This Docker container comprises of a WSO2 product, running with its latest GA release \n\ | ||
which is under the Apache License, Version 2.0. \n\ | ||
Read more about Apache License, Version 2.0 here @ http://www.apache.org/licenses/LICENSE-2.0.\n" | ||
|
||
# create the non-root user and group and set MOTD login message | ||
RUN \ | ||
groupadd --system -g ${USER_GROUP_ID} ${USER_GROUP} \ | ||
&& useradd --system --create-home --home-dir ${USER_HOME} --no-log-init -g ${USER_GROUP_ID} -u ${USER_ID} ${USER} \ | ||
&& echo '[ ! -z "${TERM}" -a -r /etc/motd ] && cat /etc/motd' >> /etc/bash.bashrc; echo "${MOTD}" > /etc/motd | ||
|
||
# copy init script to user home | ||
COPY --chown=wso2carbon:wso2 docker-entrypoint.sh ${USER_HOME}/ | ||
|
||
# install required packages | ||
RUN \ | ||
apt-get update \ | ||
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ | ||
libxml2-utils \ | ||
netcat \ | ||
unzip \ | ||
wget \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# installe Oracle JDK | ||
RUN \ | ||
mkdir -p ${JAVA_HOME} \ | ||
&& wget --no-check-certificate -O ${JDK_NAME} ${JDK_URL} \ | ||
&& tar -xf ${JDK_NAME} -C ${JAVA_HOME} --strip-components=1 \ | ||
&& chown wso2carbon:wso2 -R ${JAVA_HOME} \ | ||
&& rm -f ${JDK_NAME} | ||
|
||
# add the WSO2 product distribution to user's home directory | ||
RUN \ | ||
wget --no-check-certificate -O ${WSO2_SERVER}.zip "${WSO2_SERVER_DIST_URL}" \ | ||
&& unzip -d ${USER_HOME} ${WSO2_SERVER}.zip \ | ||
&& chown wso2carbon:wso2 -R ${WSO2_SERVER_HOME} \ | ||
&& mkdir ${USER_HOME}/wso2-tmp \ | ||
&& cp -r ${WSO2_SERVER_HOME}/repository/deployment/server ${USER_HOME}/wso2-tmp/server \ | ||
&& rm -f ${WSO2_SERVER}.zip | ||
# add MySQL JDBC connector to server home as a third party library | ||
ADD --chown=wso2carbon:wso2 https://repo1.maven.org/maven2/mysql/mysql-connector-java/${MYSQL_CONNECTOR_VERSION}/mysql-connector-java-${MYSQL_CONNECTOR_VERSION}.jar ${WSO2_SERVER_HOME}/repository/components/dropins/ | ||
|
||
# set the user and work directory | ||
USER ${USER_ID} | ||
WORKDIR ${USER_HOME} | ||
|
||
# set environment variables | ||
ENV JAVA_HOME=${JAVA_HOME} \ | ||
PATH=$JAVA_HOME/bin:$PATH \ | ||
WSO2_SERVER_HOME=${WSO2_SERVER_HOME} \ | ||
WORKING_DIRECTORY=${USER_HOME} | ||
|
||
# expose ports | ||
EXPOSE 8280 8243 9763 9443 9099 5672 9711 9611 7711 7611 10397 | ||
|
||
# initiate container and start WSO2 Carbon Server | ||
ENTRYPOINT ${WORKING_DIRECTORY}/docker-entrypoint.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,69 @@ | ||
# Dockerfile for WSO2 API Manager # | ||
The section defines the step-by-step instructions to build the Docker image for WSO2 API Manager 2.1.0. | ||
|
||
## Prerequisites | ||
* [Docker](https://www.docker.com/get-docker) v17.09.0 or above | ||
* [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) client | ||
* WSO2 API Manager pack downloaded through [WUM](https://wso2.com/wum/download) | ||
* Download JDK 8 through [Oracle](https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html) | ||
- Host the downloaded pack and JDK locally or on a remote location. | ||
>The hosted product pack location and JDK location will be passed as the build arguments WSO2_SERVER_DIST_URL and JDK_URL when building the Docker image. | ||
## 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 `dockerfile/apim` directory will be referred to as `AM_DOCKERFILE_HOME` from this point onwards. | ||
>Please refer to [WSO2 Update Manager documentation](https://docs.wso2.com/display/updates/Getting+Started) | ||
in order to obtain latest bug fixes and updates for the product. | ||
|
||
##### 2. Build the Docker image. | ||
- Navigate to `<AM_DOCKERFILE_HOME>` directory. <br> | ||
Execute `docker build` command as shown below. | ||
|
||
+ `docker build --build-arg WSO2_SERVER_DIST_URL=<URL_OF_THE_HOSTED_LOCATION/FILENAME> JDK_URL=<URL_OF_THE_HOSTED_JDK_LOCATION/FILENAME> -t wso2am:2.1.0 .` | ||
- eg:- Hosted locally: docker build --build-arg WSO2_SERVER_DIST_URL=http://172.17.0.1:8000/wso2am-2.1.0.zip JDK_URL=http://172.17.0.1:8000/jdk-8u261-linux-x64.tar.gz -t wso2am:2.1.0 . | ||
- eg:- Hosted remotely: docker build --build-arg WSO2_SERVER_DIST_URL=http://<public_ip:port>/wso2am-2.1.0.zip JDK_URL=http://172.17.0.1:8000/jdk-8u261-linux-x64.tar.gz -t wso2am:2.1.0 . | ||
|
||
##### 3. Running the Docker image. | ||
- `docker run -it -p 9443:9443 wso2am:2.1.0` | ||
|
||
##### 4. 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.1.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 \ | ||
wso2am:2.1.0 | ||
``` | ||
|
||
>In here, <TARGET_CONFIGS> refers to /home/wso2carbon/wso2am-2.1.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/) |
Oops, something went wrong.