[WSO2 APIM] Deploy APIM artifacts to multiple environments, Dev,QA & Prod

WSO2 APIM 1.7.0 does not support moving APIs from one environment to another in WSO2 APIM.
What we normally do is Keep separate instances for each environment and govern them.
We have planned to introduce API archiving in future release.

Workaround:

There are 3 parts that we should consider when moving APIs from one environment to another.
1.Registry entries
2.Synapse config folder
3.APIM relational database

1.
Let’s say we have two APIM instances for dev & qa environments.
When we create an API from API publisher, the related registry entries are stored in ‘/_system/governance/apimgt’ path.
Now if you create an API in API publisher in dev environment, the related entries will be stored in child folders of above path.
In order to move this particular registry entries to qa environment, we need to checkout the registry folder structure in dev environment and check-in that into ‘/_system/governance/apimgt’ location in the qa setup.

For that we can use WSO2 Governance Registry check-in client [1].

Ex: Go to wso2greg-4.6.0/bin folder and execute following commands.
check-out:
sh checkin-client.sh co https://localhost:9443/registry/_system/governance/apimgt -u admin -p admin -f bk.dump
(now a bk.dump file will be created)

check-in:
sh checkin-client.sh ci https://localhost:9446/registry/_system/governance/apimgt -u admin -p admin -f bk.dump

In the dev env, the APIs you create are gone to ‘/_system/governance/apimgt/applicationdata/provider/admin/’ path.

So, if you do the checkin checkout properly, in the exact path of the qa environment setup, you will see the API you created.

2.
In order to be able to invoke the api, in qa environment, we need to copy the synapse config folder of dev env to qa env as well.

So, just copy & replace the ‘wso2am-1.7.0/repository/deployment/server/synapse-configs’ folder in ‘dev’ setup to the ‘qa’ setup.

3.
Finally we need to copy the dev setup APIM database entries to the qa setup APIM database.
Basically, if you only want to move API details, the only tables you want to copy are
AM_API
AM_API_SCOPES
AM_TIER_PERMISSIONS
AM_API_URL_MAPPING

The above tables does not contain subscription related data. If you want subscription data as well, you can copy tables related to that as well.

(Please note, this moving of artifacts will not ensure indexing functionality)

[1]https://docs.wso2.com/display/Governance460/Check-in+Client+Examples

Author: denuwanthi

Graduate of Department of Computer Science & Engineering, University of Moratuwa, Sri Lanka.Currently working in WSO2 Lanka (pvt)Ltd.

Leave a comment