wso2 / product-apim

Welcome to the WSO2 API Manager source code! For info on working with the WSO2 API Manager repository and contributing code, click the link below.
http://wso2.github.io/
Apache License 2.0
845 stars 785 forks source link

How to restore an API from database and config files in 3.2.0? #11228

Open natechols opened 3 years ago

natechols commented 3 years ago

I need to be able to copy over an existing API (stored in an existing Postgresql database) to a new installation directory. In API Manager 2.0.0 this just magically worked without any additional steps. In 3.2.0, the API is not listed in the publisher or devportal or the lists returned from /api/am/store/applications, although if I know where to look I can still find it. Attempting to reimport the API from a swagger JSON fails with an HTTP 409 error because the API is already present in the database, just unusable. (Oddly, this does not happen 100% of the time, just most of the time.)

Based on the documentation I have already attempted: 1) Copying over the entire directory repository/deployment/server/synapse-configs from the old install 2) Delete the Solr cache 3) Add this to my deployment.toml:

[indexing]
re_indexing = 1

None of which had any effect. Obviously there is another piece that I'm missing, but nothing in the documentation or the log files indicates what it might be. What is tying my API to the original install directory?

PS. I tried following the tip in the API migration instructions too:

After importing, if the APIs are not visible in the API Publisher UI, do the following to re-index the artifacts in the registry.
1. Shut down the API Manager 3.2.0, backup and delete the <API-M_3.2.0_HOME>/solr directory.
2. Rename the <lastAccessTimeLocation> element in the <API-M_3.2.0_HOME>/repository/conf/registry.xml file. If you use a distributed API Manager setup, change the file in the API Publisher node. For example, change the /_system/local/repository/components/org.wso2.carbon.registry/indexing/lastaccesstime registry path to /_system/local/repository/components/org.wso2.carbon.registry/indexing/lastaccesstime_1
3. Restart API Manager 3.2.0 server.

This didn't fix the problem either. Also, I found the value in registry.xml consistently got reset to whatever it was before. Are there some database records I could wipe that would solve the problem?

ananthrajb commented 2 years ago

Hi @natechols, Do you have any luck on this issue. I am working APIM 4.1 and landed in the same issue. I don't find any way to load the api's to publisher and devportal.

I just tried modifying the local database to point to a different database.

natechols commented 1 year ago

Sorry @ananthrajb, we gave up and stuck with 2.0.0 for now and are investigating other platforms.