Deploying multiple active revisions of same proxy with different virtual hosts and same base path

We have a requirement to deploy multiple active revisions of the same api proxy in our dev environment,
The base path remains same for all versions but the virtual host and target servers are different to make the URL's unique.
We are trying to achieve this with the help of maven plugin for Apigee, but this is not working as expected.
From Apigee console We could observe that the new version(s) api proxies are getting imported but they are not activated.
We are able to activate them manually.
Is there a way to import and activate multiple revisions of same api proxy with same base path but different virtual hosts using the maven plugins/apigee api’s?

Environment Revision  URL
dev 46 https://dev3.abc.com/testproxy/v1/dummyurl/actuator
dev 45 https://dev2.abc.com/testproxy/v1/dummyurl/actuator
dev 40 https://dev1.abc.com/testproxy/v1/dummyurl/actuator

@ssvaidyanathan 

0 6 185
6 REPLIES 6

Why not deploy the proxy with multiple virtual host? and have the route rules to point to the appropriate target servers depending on the Virtual host

Target 1 if "virtualhost.name=abc"

Target 2 if "virtualhost.name=def"

Will that work?

Sai's answer suggests maybe you are not asking the right question?  Maybe there is a better way to accomplish what you want. Maybe you do not need to deploy TWO different revisions.  It might be a simpler way of doing things.

In case that is somehow not satisfactory, I'll answer your original question:

Is there a way to import and activate multiple revisions of same api proxy with same base path but different virtual hosts ...

Yes, that should be no problem.  And you've seen you can do it with the manual deployment.

...using the maven plugins/apigee api’s?

not sure about this! 

If not you may need to add a step in your deployment pipeline. 

Please find the detailed steps on what we are doing.
We would like to achieve step 3. d without any manual intervention

1. Created 2 virtual hosts as below

Name -> Alias
-------------------------------------
virtual-host-1 -> dev1.abc.com
virtual-host-2 -> dev2.abc.com

2. zip files for proxy code
a) proxy-code-1 to be deployed referencing virtual-host-1
<HTTPProxyConnection>
<BasePath>/testproxy/v1/dummyurl/actuator</BasePath>
<VirtualHost>virtual-host-1</VirtualHost>
</HTTPProxyConnection>


b) proxy-code-2 to be deployed referencing virtual-host-2
<HTTPProxyConnection>
<BasePath>/testproxy/v1/dummyurl/actuator</BasePath>
<VirtualHost>virtual-host-2</VirtualHost>
</HTTPProxyConnection>

3. Deployment
We are deploying with apigee-deploy-maven-plugin

a) deploying proxy-code-1 with maven plugin via jenkins pipeline - no issues, revision 1 imported and activated
Apigee console
Environment Revision Status URL
-------------------------------------------------
dev 1 green https://dev1.abc.comk/testproxy/v1/dummyurl/actuator

b) redeploying proxy-code-1 with maven plugin via jenkins pipeline - no issues, revision 2 imported and activated (revision 1 deactivated)
Apigee console
Environment Revision Status URL
-------------------------------------------------
dev 2 green https://dev1.abc.comk/testproxy/v1/dummyurl/actuator


c)deploying proxy-code-2 with maven plugin via jenkins pipeline - no issues reported, revision 3 imported and activated (revision 2 deactivated)
Apigee console
Environment Revision Status URL
-------------------------------------------------
dev 3 green https://dev2.abc.comk/testproxy/v1/dummyurl/actuator

I am able to deploy the deactivated revions 2 code to dev evironment from console
Apigee console
Environment Revision Status URL
-------------------------------------------------
dev 2 green https://dev1.abc.comk/testproxy/v1/dummyurl/actuator
dev 3 green https://dev2.abc.comk/testproxy/v1/dummyurl/actuator

d)deploying proxy-code-1 with maven plugin via jenkins pipeline , below mention error is thrown, revision 4 imported but not activated (revision 3 deactivated)
"code" : "distribution.DeploymentPathConflict",
"message" : "Path testproxy/v1/dummyurl/actuator conflicts with existing deployment path for revision 2 of the APIProxy test-api-proxy in organization abcd, environment dev"
Apigee console
Environment Revision Status URL
-------------------------------------------------
dev 2 green https://dev1.abc.comk/testproxy/v1/dummyurl/actuator

now I am able to deploy both version 3 and version 4 to dev env from console and I can see the below
Apigee console
Environment Revision Status URL
-------------------------------------------------
dev 4 green https://dev1.abc.comk/testproxy/v1/dummyurl/actuator
dev 3 green https://dev2.abc.comk/testproxy/v1/dummyurl/actuator

 

Both proxy-code-1 and proxy-code-2 are pointing to different Target Servers and we have successfully tested which proves traffic is served in both endpoints even though Base path is same for revisions 3 and 4

https://dev1.abc.comk/testproxy/v1/dummyurl/actuator and

https://dev2.abc.comk/testproxy/v1/dummyurl/actuator

Can you please open a GitHub issue with these details? Also provide the Plugin version you are using.

https://github.com/apigee/apigee-deploy-maven-plugin/issues/216
Apigee edge maven version=1.2.3
Apigee config maven version=1.4.4

Working as expected. Had to add the "override" flag to the pom profile to avoid conflicts

Sundar - please mark this post as answered