How to deploy WSO2 API Manager 4.0.0 on localhost as a distributed setup (CP+GW)
In this article I will discuss how to configure a distributed WSO2 API-M deployment with Gateway and Control Plane instances.
- Download WSO2 API Manager 4.0.0 zip file from here
- Extract the zip file twice to two different folders. (let’s name them
control-plane
andgateway-worker
)
Setup the shared database
3. Setup a mysql database using docker. Follow the steps 1 to 11 in this article with following 2 changes.
- In step 5, get
mysql.sql
file from/control-plane/dbscripts/mysql.sql
instead of<API-M_HOME>/dbscripts/apimgt/mysql.sql
. - In step 8 and 9, use
shared_db
as the database name instead oftest
.
4. Download and copy mysql-connector-java-<version>.jar
from this link to both /control-plane/repository/components/lib
and /gateway-worker/repository/components/lib
directories.
Setup control-plane profile
5. Go to /control-plane/bin
and run sh profileSetup.sh -Dprofile=control-plane
command.
6. Open /control-plane/repository/conf/deployment.toml
in a text editor and change the configs as follows.
...[database.shared_db]
type = "mysql"
url = "jdbc:mysql://localhost:3306/shared_db?useSSL=false&allowPublicKeyRetrieval=true"
username = "root"
password = "root"...[[apim.gateway.environment]]
name = "Default"
type = "hybrid"
display_in_api_console = true
description = "This is a hybrid gateway that handles both production and sandbox token traffic."
show_as_token_endpoint_url = true
service_url = "https://localhost:9444/services/"
username= "${admin.username}"
password= "${admin.password}"
ws_endpoint = "ws://localhost:9099"
wss_endpoint = "wss://localhost:8099"
http_endpoint = "http://localhost:8281"
https_endpoint = "https://localhost:8244"
7. Go to /control-plane/bin
and run sh api-manager.sh -Dprofile=control-plane
command to start the control-plane instance.
Setup gateway-worker profile
8. Go to /gateway-worker/bin
and run sh profileSetup.sh -Dprofile=gateway-worker
command.
9. Open /gateway-worker/repository/conf/deployment.toml
in a text editor and change the configs as follows.
...[database.shared_db]
type = "mysql"
url = "jdbc:mysql://localhost:3306/shared_db?useSSL=false&allowPublicKeyRetrieval=true"
username = "root"
password = "root"...[apim.key_manager]
service_url = "https://localhost:9443/services/"
username = "$ref{super_admin.username}"
password = "$ref{super_admin.password}"...[apim.throttling]
username= "$ref{super_admin.username}"
password= "$ref{super_admin.password}"
service_url = "https://localhost:9443/services/"
throttle_decision_endpoints = ["tcp://localhost:5672"]
enable_unlimited_tier = true
enable_header_based_throttling = false
enable_jwt_claim_based_throttling = false
enable_query_param_based_throttling = false[[apim.throttling.url_group]]
traffic_manager_urls=["tcp://localhost:9611"]
traffic_manager_auth_urls=["ssl://localhost:9711"]
10. Go to /gateway-worker/bin
and run sh api-manager.sh -Dprofile=gateway-worker -DportOffset=1
command to start the gateway instance.
Hooray! you have successfully deployed the WSO2 API Manager 4.0.0 on localhost as a distributed setup. Use following URLs to access the portals.
- Publisher: https://localhost:9443/publisher/
- Developer Portal: https://localhost:9443/devportal/
- Admin Portal: https://localhost:9443/admin/
- Carbon Console: https://localhost:9443/carbon/admin/