How to run Wso2am-analytics in docker container

Ujitha Iroshan
2 min readJan 26, 2020

--

In this article I’m showing how to run wso2am-analytic-worker as a docker container

Prerequisite for this deployment

  • Docker is installed in the machine
  • Data base server is installed in local machine (Ex: — Mysql, postgresql)
  • In this example we are using Postgres as Database server

Here we are going to run wso2am-analytic-worker 3.0.0 as docker container

First pull the image to local registry (Optional)

docker pull wso2/wso2am-analytics-worker

Before run the docker container we need to mount the config directory/files

we need to mount containers <WSO2AM-Analytics Home>/conf/worker/deployment.yaml file with deployment.yaml file in the host machine

Copy the deployment.yaml file in a specific location in the host machine let’s say <Source_config_path>/deployment.yaml and do the following changes to config the database changes

- name: APIM_ANALYTICS_DB

description: “The datasource used for APIM statistics aggregated data.”

jndiConfig:

name: jdbc/APIM_ANALYTICS_DB

definition:

type: RDBMS

configuration:

jdbcUrl: ‘jdbc:postgresql://host.docker.internal:5432/analytic_db’

username: <db-username>

password: <db-password>

driverClassName: org.postgresql.Driver

maxPoolSize: 50

idleTimeout: 60000

connectionTestQuery: SELECT 1

validationTimeout: 30000

isAutoCommit: false

Here we are configuring the analytic_db (We need to have analytic_db database created in out database server before configuring this)

Please note ‘jdbc:postgresql://host.docker.internal:5432/analytic_db’ here host.docker.internal is the hostname of the host machine which is shown from the docker container

And then we need to add Postgres driver to analytics as follows, copy <WSO2AM-Analytics-Home>/lib directory to a specific Location in the host machine lets say <Source_lib_path>/lib and add Postgres JDBC driver to it.

Find postgres driver from this link

Now we can run the docker command to run the container

docker run -it -d -v <Source_config_path>/deployment.yaml:/home/wso2carbon/wso2am-analytics-3.0.0/conf/worker/deployment.yaml -v <Source_lib_path>/lib:/home/wso2carbon/wso2am-analytics-3.0.0/lib -p 9450:9444 — name analytics-worker wso2/wso2am-analytics-worker

Now you can check the status of the container by docker ps and check the database analytic_db you will see tables are created successfully

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Ujitha Iroshan
Ujitha Iroshan

Written by Ujitha Iroshan

Developer, Integration Consultant, Microservice enthusiast. Ex WSO2

No responses yet