Skip to content

Commit

Permalink
Merge pull request #89 from ThilinaManamgoda/master
Browse files Browse the repository at this point in the history
Add MySQL connector via Dockerfile
  • Loading branch information
DilanUA authored Feb 22, 2018
2 parents bc64476 + 06e9ff9 commit 6906c14
Show file tree
Hide file tree
Showing 12 changed files with 41 additions and 61 deletions.
26 changes: 10 additions & 16 deletions docker-compose/apim-analytics/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
## Quick Start Guide

1. Build the WSO2 API manager 2.1.0 and API Manager Analytics 2.1.0 Docker images:

* [WSO2 API Manager Dockerfile](../../dockerfiles/apim/README.md)
* [WSO2 API Manager Analytics Dockerfile](../../dockerfiles/apim-analytics/README.md)


* [WSO2 API Manager Dockerfile](../../dockerfiles/apim/README.md)
* [WSO2 API Manager Analytics Dockerfile](../../dockerfiles/apim-analytics/README.md)
> In the `docker-compose.yml`, remove the `dockerhub.wso2.com/` prefix from the `image` name
> For example, change the line `image: dockerhub.wso2.com/wso2am:2.1.0` to `image: wso2am:2.1.0`
2. Pull MySQL Docker image:
```
docker pull mysql:5.7.19
Expand All @@ -24,29 +24,23 @@
cd [docker-apim]/docker-compose/apim-analytics
```

4. Download [MySQL Connector/J](https://dev.mysql.com/downloads/connector/j/) v5.1.45 and copy its JAR file to the following path:
```
[docker-apim]/docker-compose/apim-analytics/apim/repository/components/lib/mysql-connector-java-5.1.45-bin.jar
[docker-apim]/docker-compose/apim-analytics/apim-analytics/repository/components/lib/mysql-connector-java-5.1.45-bin.jar
```

6. Execute the following Docker Compose command to start the deployment:
4. Execute the following Docker Compose command to start the deployment:
```
docker-compose up
```

7. Add the following entrie to the /etc/hosts.
5. Add the following entrie to the /etc/hosts.
```
127.0.0.1 api-manager
```
8. Access the API Publisher and Store via the URLs given below.
6. Access the API Publisher and Store via the URLs given below.

* API Publisher
```
https://api-manager/publisher
https://api-manager:9443/publisher
```

* API Store
```
https://api-manager/store/
https://api-manager:9443/store/
```
Empty file.
Empty file.
6 changes: 2 additions & 4 deletions docker-compose/apim-analytics/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ services:
mysql:
condition: service_healthy
volumes:
- ./apim-analytics/repository/components/lib/mysql-connector-java-5.1.45-bin.jar:/home/wso2carbon/wso2am-analytics-2.1.0/repository/components/lib/mysql-connector-java-5.1.45-bin.jar
- ./apim-analytics/repository/conf/datasources/analytics-datasources.xml:/home/wso2carbon/wso2am-analytics-2.1.0/repository/conf/datasources/analytics-datasources.xml
- ./apim-analytics/repository/conf/datasources/stats-datasources.xml:/home/wso2carbon/wso2am-analytics-2.1.0/repository/conf/datasources/stats-datasources.xml
links:
Expand All @@ -44,13 +43,12 @@ services:
am-analytics:
condition: service_healthy
volumes:
- ./apim/repository/components/lib/mysql-connector-java-5.1.45-bin.jar:/home/wso2carbon/wso2am-2.1.0/repository/components/lib/mysql-connector-java-5.1.45-bin.jar
- ./apim/repository/conf/datasources/master-datasources.xml:/home/wso2carbon/wso2am-2.1.0/repository/conf/datasources/master-datasources.xml
- ./apim/repository/conf/api-manager.xml:/home/wso2carbon/wso2am-2.1.0/repository/conf/api-manager.xml
- ./apim/repository/conf/carbon.xml:/home/wso2carbon/wso2am-2.1.0/repository/conf/carbon.xml
- ./apim/repository/conf/tomcat/catalina-server.xml:/home/wso2carbon/wso2am-2.1.0/repository/conf/tomcat/catalina-server.xml
ports:
- "80:9763"
- "443:9443"
- "9763:9763"
- "9443:9443"
- "8280:8280"
- "8243:8243"
26 changes: 11 additions & 15 deletions docker-compose/apim-is-as-km/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@
* [WSO2 API Manager Dockerfile](../../dockerfiles/apim/README.md)
* [WSO2 API Manager Analytics Dockerfile](../../dockerfiles/apim-analytics/README.md)
* [WSO2 IS as KM](../../dockerfiles/is-as-km/README.md)



> In the `docker-compose.yml`, remove the `dockerhub.wso2.com/` prefix from the `image` name
> For example, change the line `image: dockerhub.wso2.com/wso2am:2.1.0` to `image: wso2am:2.1.0`
2. Pull MySQL Docker image:
```
docker pull mysql:5.7.19
Expand All @@ -24,32 +27,25 @@
cd [docker-apim]/docker-compose/apim-is-as-km
```

4. Download [MySQL Connector/J](https://dev.mysql.com/downloads/connector/j/) v5.1.45 and copy its JAR file to the following path:
```
[docker-apim]/docker-compose/apim-is-as-km/apim/repository/components/lib/mysql-connector-java-5.1.45-bin.jar
[docker-apim]/docker-compose/apim-is-as-km/apim-analytics/repository/components/lib/mysql-connector-java-5.1.45-bin.jar
[docker-apim]/docker-compose/apim-is-as-km/is-as-km/repository/components/lib/mysql-connector-java-5.1.45-bin.jar
```

6. Execute the following Docker Compose command to start the deployment:
4. Execute the following Docker Compose command to start the deployment:
```
docker-compose up
```

7. Add the following host entry to the /etc/hosts file.
5. Add the following host entry to the /etc/hosts file.
```
127.0.0.1 api-manager
```
8. Access the API Publisher and Store via the URLs given below.
6. Access the API Publisher and Store via the URLs given below.

* API Publisher
```
https://api-manager/publisher
https://api-manager:9443/publisher
```

* API Store
```
https://api-manager/store/
https://api-manager:9443/store/
```

WSO2 API Manager will use the WSO2 Identity Server to generate OAuth2 tokens and validate those token during API invocations.
WSO2 API Manager will use the WSO2 Identity Server to generate OAuth2 tokens and validate those token during API invocations.
7 changes: 2 additions & 5 deletions docker-compose/apim-is-as-km/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ services:
mysql:
condition: service_healthy
volumes:
- ./apim-analytics/repository/components/lib/mysql-connector-java-5.1.45-bin.jar:/home/wso2carbon/wso2am-analytics-2.1.0/repository/components/lib/mysql-connector-java-5.1.45-bin.jar
- ./apim-analytics/repository/conf/datasources/analytics-datasources.xml:/home/wso2carbon/wso2am-analytics-2.1.0/repository/conf/datasources/analytics-datasources.xml
- ./apim-analytics/repository/conf/datasources/stats-datasources.xml:/home/wso2carbon/wso2am-analytics-2.1.0/repository/conf/datasources/stats-datasources.xml
is-as-km:
Expand All @@ -42,7 +41,6 @@ services:
am-analytics:
condition: service_healthy
volumes:
- ./is-as-km/repository/components/lib/mysql-connector-java-5.1.45-bin.jar:/home/wso2carbon/wso2is-km-5.3.0/repository/components/lib/mysql-connector-java-5.1.45-bin.jar
- ./is-as-km/repository/conf/datasources/master-datasources.xml:/home/wso2carbon/wso2is-km-5.3.0/repository/conf/datasources/master-datasources.xml
- ./is-as-km/repository/conf/user-mgt.xml:/home/wso2carbon/wso2is-km-5.3.0/repository/conf/user-mgt.xml
- ./is-as-km/repository/conf/registry.xml:/home/wso2carbon/wso2is-km-5.3.0/repository/conf/registry.xml
Expand All @@ -60,7 +58,6 @@ services:
is-as-km:
condition: service_healthy
volumes:
- ./apim/repository/components/lib/mysql-connector-java-5.1.45-bin.jar:/home/wso2carbon/wso2am-2.1.0/repository/components/lib/mysql-connector-java-5.1.45-bin.jar
- ./apim/repository/conf/datasources/master-datasources.xml:/home/wso2carbon/wso2am-2.1.0/repository/conf/datasources/master-datasources.xml
- ./apim/repository/conf/api-manager.xml:/home/wso2carbon/wso2am-2.1.0/repository/conf/api-manager.xml
- ./apim/repository/conf/carbon.xml:/home/wso2carbon/wso2am-2.1.0/repository/conf/carbon.xml
Expand All @@ -70,7 +67,7 @@ services:
- ./apim/repository/conf/axis2/axis2.xml:/home/wso2carbon/wso2am-2.1.0/repository/conf/axis2/axis2.xml
- ./apim/bin/wso2server.sh:/home/wso2carbon/wso2am-2.1.0/bin/wso2server.sh
ports:
- "80:9763"
- "443:9443"
- "9763:9763"
- "9443:9443"
- "8280:8280"
- "8243:8243"
9 changes: 3 additions & 6 deletions dockerfiles/apim-analytics/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,17 @@ ARG WSO2_SERVER_HOME=${USER_HOME}/${WSO2_SERVER}-${WSO2_SERVER_VERSION}
# install required packages
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \
curl \
iproute2 \
telnet \
unzip && \
curl && \
rm -rf /var/lib/apt/lists/*

# 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 the jdk and wso2 product distributions to user's home directory
# copy the jdk and wso2 product distributions to user's home directory and copy the mysql connector jar to server distribution
COPY --chown=wso2carbon:wso2 ${FILES}/${JDK} ${USER_HOME}/java/
COPY --chown=wso2carbon:wso2 ${FILES}/${WSO2_SERVER_DIST}/ ${USER_HOME}/${WSO2_SERVER_DIST}/

COPY --chown=wso2carbon:wso2 ${FILES}/mysql-connector-java-*-bin.jar ${USER_HOME}/${WSO2_SERVER_DIST}/repository/components/lib/
# set the user and work directory
USER ${USER_ID}
WORKDIR ${USER_HOME}
Expand Down
3 changes: 2 additions & 1 deletion dockerfiles/apim-analytics/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ git clone https://github.com/wso2/docker-apim.git

>The local copy of the `dockerfile/apim-analytics` directory will be referred to as `ANALYTICS_DOCKERFILE_HOME` from this point onwards.
##### 2. Add JDK and WSO2 API Manager Analytics distributions to `<ANALYTICS_DOCKERFILE_HOME>/files`
##### 2. Add JDK, WSO2 API Manager Analytics distributions and MySQL Connector to `<ANALYTICS_DOCKERFILE_HOME>/files`
- Download [JDK 1.8](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html)
and extract that to `<ANALYTICS_DOCKERFILE_HOME>/files`.
- Download the WSO2 API Manager Analytics 2.1.0 distribution (http://wso2.com/api-management/try-it/)
Expand All @@ -24,6 +24,7 @@ and extract that to `<ANALYTICS_DOCKERFILE_HOME>/files`. <br>
<ANALYTICS_DOCKERFILE_HOME>/files/jdk<version>/
<ANALYTICS_DOCKERFILE_HOME>/files/wso2am-analytics-2.1.0/
```
- Download [MySQL Connector/J](https://dev.mysql.com/downloads/connector/j/) v5.1.45 and then copy that to `<ANALYTICS_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.
Expand Down
9 changes: 3 additions & 6 deletions dockerfiles/apim/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,17 @@ ARG WSO2_SERVER_HOME=${USER_HOME}/${WSO2_SERVER}-${WSO2_SERVER_VERSION}
# install required packages
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \
curl \
iproute2 \
telnet \
unzip && \
curl && \
rm -rf /var/lib/apt/lists/*

# 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 the jdk and wso2 product distributions to user's home directory
# copy the jdk and wso2 product distributions to user's home directory and copy the mysql connector jar to server distribution
COPY --chown=wso2carbon:wso2 ${FILES}/${JDK} ${USER_HOME}/java/
COPY --chown=wso2carbon:wso2 ${FILES}/${WSO2_SERVER_DIST} ${USER_HOME}/${WSO2_SERVER_DIST}

COPY --chown=wso2carbon:wso2 ${FILES}/mysql-connector-java-*-bin.jar ${USER_HOME}/${WSO2_SERVER_DIST}/repository/components/lib/
# set the user and work directory
USER ${USER_ID}
WORKDIR ${USER_HOME}
Expand Down
4 changes: 3 additions & 1 deletion dockerfiles/apim/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ 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.
##### 2. Add JDK and WSO2 API Manager distributions to `<AM_DOCKERFILE_HOME>/files`
##### 2. Add JDK, WSO2 API Manager distributions and MySQL connector to `<AM_DOCKERFILE_HOME>/files`
- Download [JDK 1.8](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html)
and extract that in `<AM_DOCKERFILE_HOME>/files` folder.
- Download the WSO2 API Manager 2.1.0 distribution (http://wso2.com/api-management/try-it/)
Expand All @@ -25,6 +25,8 @@ and extract that in `<AM_DOCKERFILE_HOME>/files` folder.
<AM_DOCKERFILE_HOME>/files/jdk<version>/
<AM_DOCKERFILE_HOME>/files/wso2am-2.1.0/
```
- Download [MySQL Connector/J](https://dev.mysql.com/downloads/connector/j/) v5.1.45 and then copy that to `<AM_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.
Expand Down
9 changes: 3 additions & 6 deletions dockerfiles/is-as-km/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,17 @@ ARG WSO2_SERVER_HOME=${USER_HOME}/${WSO2_SERVER}-${WSO2_SERVER_VERSION}
# install required packages
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \
curl \
iproute2 \
telnet \
unzip && \
curl && \
rm -rf /var/lib/apt/lists/*

# 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 the jdk and wso2 product distributions to user's home directory
# copy the jdk and wso2 product distributions to user's home directory and copy the mysql connector jar to server distribution
COPY --chown=wso2carbon:wso2 ${FILES}/${JDK} ${USER_HOME}/java/
COPY --chown=wso2carbon:wso2 ${FILES}/${WSO2_SERVER_DIST} ${USER_HOME}/${WSO2_SERVER_DIST}

COPY --chown=wso2carbon:wso2 ${FILES}/mysql-connector-java-*-bin.jar ${USER_HOME}/${WSO2_SERVER_DIST}/repository/components/lib/
# set the user and work directory
USER ${USER_ID}
WORKDIR ${USER_HOME}
Expand Down
3 changes: 2 additions & 1 deletion dockerfiles/is-as-km/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ 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 and WSO2 API Manager distributions to `<IS_KM_DOCKERFILE_HOME>/files`
##### 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.3.0 distribution (http://wso2.com/api-management/try-it/)
Expand All @@ -24,6 +24,7 @@ and extract that to `<IS_KM_DOCKERFILE_HOME>/files`. <br>
<IS_KM_DOCKERFILE_HOME>/files/jdk<version>/
<IS_KM_DOCKERFILE_HOME>/files/wso2is-km-5.3.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.
Expand Down

0 comments on commit 6906c14

Please sign in to comment.