Hi Martin, For more information, the following links explain the end-to-end process flow involved in deploying and undeploying an application, and the artifact correlation.
[1] https://cwiki.apache.org/confluence/display/STRATOS/4.1.0+How+to+Deploy+an+Application [2] https://cwiki.apache.org/confluence/display/STRATOS/4.1.0+How+to+Undeploy+an+Application [3] https://cwiki.apache.org/confluence/display/STRATOS/4.1.0+Artifact+Correlation Regards, Mariangela *Mariangela Hills* Senior Technical Writer - WSO2, Inc. http://wso2.com Committer and PMC member - Apache Stratos email:[email protected] | mobile: +94 773 500185 On Thu, Jun 25, 2015 at 6:23 PM, Reka Thirunavukkarasu <[email protected]> wrote: > HI Martin > > It seems that you are not deleting the application before removing a group > definition. The application flow is as below [1]: > > 1. add application > 2. deploy application > 3. undeploy application > 4. delete application > > Please check the sample commands as below: > > > echo "Creating application..." > curl -X POST -H "Content-Type: application/json" -d > "@${artifacts_path}/application.json" -k -v -u admin:admin https:// > ${host_ip}:${host_port}/api/applications > > echo "Deploying application..." > curl -X POST -H "Content-Type: application/json" -k -v -u admin:admin > https:// > ${host_ip}:${host_port}/api/applications/complex-app-with-lb/deploy/application-policy-1 > > > echo "Undeploying application..." > curl -X POST -H "Content-Type: application/json" -k -v -u admin:admin > https:// > ${host_ip}:${host_port}/api/applications/complex-app-with-lb/undeploy > > echo "Deleting application..." > curl -X DELETE -H "Content-Type: application/json" -k -v -u admin:admin > https://${host_ip}:${host_port}/api/applications/complex-app-with-lb > > [1] > https://cwiki.apache.org/confluence/display/STRATOS/4.1.0+Working+with+Applications > > Thanks, > Reka > > > > On Thu, Jun 25, 2015 at 5:58 PM, Martin Eppel (meppel) <[email protected]> > wrote: > >> Sure, there is one scheduled already with Reka for today >> >> >> >> *From:* Imesh Gunaratne [mailto:[email protected]] >> *Sent:* Thursday, June 25, 2015 5:27 AM >> >> *To:* dev >> *Cc:* Reka Thirunavukkarasu; Ryan Du Plessis (rdupless); Shaheedur Haque >> (shahhaqu) >> *Subject:* Re: Testing Stratos 4.1 - application removal still fails in >> certain cases >> >> >> >> May be it would be easier to investigate this in a call. >> >> >> >> On Thu, Jun 25, 2015 at 5:52 PM, Martin Eppel (meppel) <[email protected]> >> wrote: >> >> There is only one application in my test scenario – not sure why you >> think it is incorrect ? >> >> >> >> *From:* Imesh Gunaratne [mailto:[email protected]] >> *Sent:* Thursday, June 25, 2015 4:49 AM >> >> >> *To:* dev >> *Cc:* Reka Thirunavukkarasu; Ryan Du Plessis (rdupless); Shaheedur Haque >> (shahhaqu) >> *Subject:* Re: Testing Stratos 4.1 - application removal still fails in >> certain cases >> >> >> >> Hi Martin, >> >> >> >> Do we know whether this error is correct in this scenario? >> >> >> >> org.apache.stratos.rest.endpoint.exception.RestAPIException: Cannot >> remove cartridge group: [group-name] sub-G1-G2-G3-1 since it is used in >> another cartridge group or an application >> >> >> >> BTW it would be better if we can list the groups/applications which are >> referring this cartridge group in the error message. >> >> >> >> Thanks >> >> >> >> On Thu, Jun 25, 2015 at 5:10 PM, Martin Eppel (meppel) <[email protected]> >> wrote: >> >> Before an application is deployed, our “wrapper code” tries to remove any >> cartridge group within the application which causes the following exception: >> >> >> >> TID: [0] [STRATOS] [2015-06-25 09:55:30,791] DEBUG >> {org.apache.stratos.autoscaler.registry.RegistryManager} - >> org.apache.stratos.autoscaler.pojo.ServiceGroup@6aa447a0 >> >> TID: [0] [STRATOS] [2015-06-25 09:55:30,810] ERROR >> {org.apache.stratos.rest.endpoint.api.StratosApiV41Utils} - Cannot remove >> cartridge group: [group-name] sub-G1-G2-G3-1 since it is used in another >> cartridge group or an application >> >> TID: [0] [STRATOS] [2015-06-25 09:55:30,811] ERROR >> {org.apache.stratos.rest.endpoint.handlers.CustomExceptionMapper} - Cannot >> remove cartridge group: [group-name] sub-G1-G2-G3-1 since it is used in >> another cartridge group or an application >> >> org.apache.stratos.rest.endpoint.exception.RestAPIException: Cannot >> remove cartridge group: [group-name] sub-G1-G2-G3-1 since it is used in >> another cartridge group or an application >> >> at >> org.apache.stratos.rest.endpoint.api.StratosApiV41Utils.removeServiceGroup(StratosApiV41Utils.java:1252) >> >> at >> org.apache.stratos.rest.endpoint.api.StratosApiV41.removeServiceGroup(StratosApiV41.java:587) >> >> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native >> Method) >> >> at >> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) >> >> at >> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) >> >> at java.lang.reflect.Method.invoke(Method.java:606) >> >> at >> org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:180) >> >> at >> org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96) >> >> at >> org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:194) >> >> at >> org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:100) >> >> at >> org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:57) >> >> at >> org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:93) >> >> at >> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:271) >> >> at >> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121) >> >> at >> org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:239) >> >> at >> org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:223) >> >> at >> org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:203) >> >> at >> org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:137) >> >> at >> org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:159) >> >> at >> org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:286) >> >> at >> org.apache.cxf.transport.servlet.AbstractHTTPServlet.doDelete(AbstractHTTPServlet.java:217) >> >> at >> javax.servlet.http.HttpServlet.service(HttpServlet.java:761) >> >> at >> org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:262) >> >> at >> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) >> >> at >> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) >> >> at >> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222) >> >> at >> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123) >> >> at >> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) >> >> at >> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) >> >> at >> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99) >> >> at >> org.wso2.carbon.tomcat.ext.valves.CompositeValve.continueInvocation(CompositeValve.java:178) >> >> >> >> *From:* Imesh Gunaratne [mailto:[email protected]] >> *Sent:* Thursday, June 25, 2015 4:29 AM >> *To:* dev >> *Cc:* Reka Thirunavukkarasu; Ryan Du Plessis (rdupless); Shaheedur Haque >> (shahhaqu) >> >> >> *Subject:* Re: Testing Stratos 4.1 - application removal still fails in >> certain cases >> >> >> >> Hi Martin, >> >> >> >> On Thu, Jun 25, 2015 at 4:38 PM, Martin Eppel (meppel) <[email protected] >> > wrote: >> >> >> >> What happens if I want to restart / redeploy the application - >> currently, when I try to re-deploy the application it throws an exception >> that the cartridge group is still referenced by another application ? >> >> >> >> Will you be able to send the log file related to this error? >> >> >> >> On Thu, Jun 25, 2015 at 4:38 PM, Martin Eppel (meppel) <[email protected]> >> wrote: >> >> >> >> What happens if I want to restart / redeploy the application - >> currently, when I try to re-deploy the application it throws an exception >> that the cartridge group is still referenced by another application ? Even >> if the group would not exist, wouldn’t stratos throw an exception that the >> application already exists ? What is the proper way to restart / redeploy >> an application ? >> >> >> >> Thanks >> >> >> >> Martin >> >> >> >> Adding Shaheed >> >> >> >> *From:* Reka Thirunavukkarasu [mailto:[email protected]] >> *Sent:* Thursday, June 25, 2015 3:45 AM >> *To:* Martin Eppel (meppel) >> *Cc:* [email protected]; Ryan Du Plessis (rdupless) >> *Subject:* Re: Testing Stratos 4.1 - application removal still fails in >> certain cases >> >> >> >> Hi Martin, >> >> >> >> On Thu, Jun 25, 2015 at 3:58 PM, Martin Eppel (meppel) <[email protected]> >> wrote: >> >> Hi Reka, >> >> >> >> I pulled the latest code today and tested the following application >> [1a., 1b.] for removal and, after all the instances were terminated the >> application still shows in the “Created” state [1c.] and maintains a >> reference to the cartridge groups, my expectation would be that it had been >> removed completely ! >> >> >> >> This is the expected behaviour. This is the status of the application >> definition. I just verified it in the CLI. After the successful >> undeployment, it shows as below for me. >> >> Applications found: >> +----------------+------------+---------+ >> | Application ID | Alias | Status | >> +----------------+------------+---------+ >> | g-sc-G12-1 | g-sc-G12-1 | Created | >> +----------------+------------+---------+ >> >> In order to check the runtime, you will have to invoke below command: >> >> stratos> describe-application-runtime g-sc-G12-1 >> Application not found: g-sc-G12-1 >> stratos> >> >> However there seems to be a small issue with this message as it says >> applicaiton not found instead of application runtime. We will fix this ASAP >> in the cli. >> >> If you invoke rest endpoint, you will get the following message: >> >> curl -X GET -H "Content-Type: application/json" -k -v -u admin:admin >> https://127.0.0.1:9443/api/applications/g-sc-G12-1/runtime >> >> {"status":"error","message":"Application runtime not found"} >> >> Please let me know if you still have any issues.. >> >> Thanks, >> >> Reka >> >> >> >> >> >> The logs actually state that the application was successfully un-deployed >> !? Logs are attached as usual, application json, group json are below >> >> >> >> TID: [0] [STRATOS] [2015-06-25 09:48:23,302] INFO >> {org.apache.stratos.autoscaler.applications.topic.ApplicationBuilder} - >> Application un-deployed successfully: [application-id] sub-G1-G2-G3-1 >> >> >> >> Please note that the screenshot was taken after the request to remove the >> application was done. >> >> >> >> >> >> [1a.] >> >> >> >> [1b] >> >> >> >> Cartridge-group: >> >> >> >> {"name": "sub-G1-G2-G3-1", "dependencies": {"terminationBehaviour": >> "terminate-none", "startupOrders": []}, "cartridges": [], "groups": >> [{"name": "multiple-groups-no-startup-G1-1", "dependencies": >> {"terminationBehaviour": "terminate-none", "startupOrders": []}, >> "cartridges": ["c1", "c2"], "groups": []}, {"name": >> "multiple-groups-no-startup-G2-1", "dependencies": {"terminationBehaviour": >> "terminate-none", "startupOrders": []}, "cartridges": ["c3", "c4"], >> "groups": []}]} >> >> >> >> >> >> Application: >> >> >> >> {"alias": "sub-G1-G2-G3-1", "applicationId": "sub-G1-G2-G3-1", >> "components": {"cartridges": [], "groups": [{"name": "sub-G1-G2-G3-1", >> "groupMaxInstances": 1, "groupMinInstances": 1, "alias": >> "sub-G1-G2-G3-1-x0x", "cartridges": [], "groups": [{"name": >> "multiple-groups-no-startup-G1-1", "groupMaxInstances": 1, >> "groupMinInstances": 1, "alias": "multiple-groups-no-startup-G1-1-0x0", >> "cartridges": [{"cartridgeMin": 1, "cartridgeMax": 1, "type": "c1", >> "subscribableInfo": {"alias": "c1-1x0", "deploymentPolicy": "static-1", >> "artifactRepository": {"repoUsername": "user", "repoUrl": " >> http://octl.qmog.cisco.com:10080/git/default.git", "privateRepo": true, >> "repoPassword": "c-policy"}, "autoscalingPolicy": "economyPolicy"}}, >> {"cartridgeMin": 1, "cartridgeMax": 1, "type": "c2", "subscribableInfo": >> {"alias": "c2-1x0", "deploymentPolicy": "static-1", "artifactRepository": >> {"repoUsername": "user", "repoUrl": " >> http://octl.qmog.cisco.com:10080/git/default.git", "privateRepo": true, >> "repoPassword": "c-policy"}, "autoscalingPolicy": "economyPolicy"}}], >> "groups": []}, {"name": "multiple-groups-no-startup-G2-1", >> "groupMaxInstances": 1, "groupMinInstances": 1, "alias": >> "multiple-groups-no-startup-G2-1-0x0", "cartridges": [{"cartridgeMin": 1, >> "cartridgeMax": 1, "type": "c3", "subscribableInfo": {"alias": "c3-1x1", >> "deploymentPolicy": "static-1", "artifactRepository": {"repoUsername": >> "user", "repoUrl": "http://octl.qmog.cisco.com:10080/git/default.git", >> "privateRepo": true, "repoPassword": "c-policy"}, "autoscalingPolicy": >> "economyPolicy"}}, {"cartridgeMin": 1, "cartridgeMax": 1, "type": "c4", >> "subscribableInfo": {"alias": "c4-1x1", "deploymentPolicy": "static-1", >> "artifactRepository": {"repoUsername": "user", "repoUrl": " >> http://octl.qmog.cisco.com:10080/git/default.git", "privateRepo": true, >> "repoPassword": "c-policy"}, "autoscalingPolicy": "economyPolicy"}}], >> "groups": []}]}]}} >> >> >> >> >> >> [1c.] >> >> >> >> stratos> list-applications >> >> Applications found: >> >> +----------------+----------------+---------+ >> >> | Application ID | Alias | Status | >> >> +----------------+----------------+---------+ >> >> | sub-G1-G2-G3-1 | sub-G1-G2-G3-1 | Created | >> >> +----------------+----------------+---------+ >> >> stratos> >> >> >> >> >> >> >> -- >> >> Reka Thirunavukkarasu >> Senior Software Engineer, >> WSO2, Inc.:http://wso2.com, >> >> Mobile: +94776442007 >> >> >> >> >> >> >> >> -- >> >> Imesh Gunaratne >> >> >> >> Senior Technical Lead, WSO2 >> >> Committer & PMC Member, Apache Stratos >> >> >> >> >> >> -- >> >> Imesh Gunaratne >> >> >> >> Senior Technical Lead, WSO2 >> >> Committer & PMC Member, Apache Stratos >> >> >> >> >> >> -- >> >> Imesh Gunaratne >> >> >> >> Senior Technical Lead, WSO2 >> >> Committer & PMC Member, Apache Stratos >> > > > > -- > Reka Thirunavukkarasu > Senior Software Engineer, > WSO2, Inc.:http://wso2.com, > Mobile: +94776442007 > > >
