Install Docker. Please follow the instructions below. Original document for instructions available here(https://docs.docker.com/compose/install/). But only change is we need to change version to 1.7.0 as i listed here.
- Install Docker Engine:
- The Docker Toolbox installation includes both Engine and Compose, so Mac and Windows users are done installing. Others should continue to the next step.
- Go to the Compose repository release page on GitHub.
- Follow the instructions from the release page and run the
curl
command, which the release page specifies, in your terminal.
Note: If you get a “Permission denied” error, your
The following is an example command illustrating the format:/usr/local/bin
directory probably isn’t writable and you’ll need to install Compose as the superuser. Runsudo -i
, then the two commands below, thenexit
.
If you have problems installing withcurl -L https://github.com/docker/compose/releases/download/1.7.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
curl
, see Alternative Install Options. - Apply executable permissions to the binary:
$ chmod +x /usr/local/bin/docker-compose
- Optionally, install command completion for the
bash
andzsh
shell. - Test the installation.
$ docker-compose --version docker-compose version: 1.7.0
127.0.0.1 api-manager
Then we can refer api-manager url from host machine and access API Manager deployment. We are going to have simple deployment with following components.
- One WSO2 API Manager 1.10 instance.
- Nginx instance to act as proxy.
- One MySQL instance to store data.
See following docker compose file with server definitions.
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=100
links:
- nginx:api-manager
nginx:
container_name: nginx
build:
context: .
dockerfile: nginx/Dockerfile
environment:
- SLEEP=100
ports:
- "444:9443"
- "81:9763"
- "8280:8280"
- "8243:8243"
First we need to have docker base image for API Manager and you have to create it using docker or can download from docker repos. If you downloaded then you can import it as follows to local repository. You need to follow same steps to nginx and mysql servers as well(these base images will available on docker public repo).
Import image.
docker load < wso2am.tgz
List loaded images.
docker images
docker load < wso2am.tgz
List loaded images.
docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
dockerhub.private.wso2.com/sanjeewa-testubuntu latest a71fcdc506aa 18 minutes ago 188 MB
sanjeewa-ubuntu latest a71fcdc506aa 18 minutes ago 188 MB
dockerhub.private.wso2.com/wso2am 1.10.0 7ae5de86a076 3 weeks ago 1.032 GB
dockerhub.private.wso2.com/nginx latest 2fede7433e44 4 weeks ago 182.8 MB
dockerhub.private.wso2.com/svnrepo latest 0530ac8e24b0 9 weeks ago 228.8 MB
dockerhub.private.wso2.com/ubuntu latest b72889fa879c 11 weeks ago 188 MB
dockerhub.private.wso2.com/mysql 5.5 783151ba5745 11 weeks ago 256.9 MB
dockerhub.private.wso2.com/sanjeewa-testubuntu latest a71fcdc506aa 18 minutes ago 188 MB
sanjeewa-ubuntu latest a71fcdc506aa 18 minutes ago 188 MB
dockerhub.private.wso2.com/wso2am 1.10.0 7ae5de86a076 3 weeks ago 1.032 GB
dockerhub.private.wso2.com/nginx latest 2fede7433e44 4 weeks ago 182.8 MB
dockerhub.private.wso2.com/svnrepo latest 0530ac8e24b0 9 weeks ago 228.8 MB
dockerhub.private.wso2.com/ubuntu latest b72889fa879c 11 weeks ago 188 MB
dockerhub.private.wso2.com/mysql 5.5 783151ba5745 11 weeks ago 256.9 MB
Now you have API Manager image in repo and can use it for your deployments. Complete deployment pattern is available here and you need to download it. Then unzip content to directory. Then you will see following content.
As you can see we have all configuration files and data required for this deployment. When we start instances these config files and artifacts will replaced in original images.
docker-compose up --build
Stop running deployment.
docker-compose down
Cleanup files.
docker rm -f $(docker ps -qa)
docker rm -f $(docker ps -qa)
Then access created instance from host machine by accessing following URL.
https://apim-publisher:444/publisher/
Then you can login to publisher, store and management console to perform user operations. If you need to setup complex deployment you can design it and create docker compose file in same way we discussed here.
No comments:
Post a Comment