Juan Hernandez has uploaded a new change for review. Change subject: restapi: Deploy as independent .war ......................................................................
restapi: Deploy as independent .war This change moves the RESTAPI .war deployment out of the .ear, so it is deployed as an independent .war file. This will simplify in the future the deployment of the RESTAPI as an independent application talking locally or through the network with the backend beans. Change-Id: I11558b95f3c99cad2edc2d42170fce7eb88c005b Signed-off-by: Juan Hernandez <juan.hernan...@redhat.com> --- M Makefile M backend/manager/conf/engine.conf.defaults.in M backend/manager/modules/restapi/webapp/pom.xml D backend/manager/modules/restapi/webapp/src/main/resources/META-INF/MANIFEST.MF A backend/manager/modules/restapi/webapp/src/main/webapp/WEB-INF/jboss-deployment-structure.xml A backend/manager/modules/restapi/webapp/src/main/webapp/WEB-INF/jboss-web.xml M ear/pom.xml M packaging/fedora/spec/ovirt-engine.spec.in 8 files changed, 89 insertions(+), 55 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/18/13718/1 diff --git a/Makefile b/Makefile index 4a8ac16..597749c 100644 --- a/Makefile +++ b/Makefile @@ -49,6 +49,7 @@ PKG_SYSCONF_DIR=$(SYSCONF_DIR)/$(ENGINE_NAME) PKG_PKI_DIR=$(SYSCONF_DIR)/pki/$(ENGINE_NAME) PKG_EAR_DIR=$(DATA_DIR)/engine.ear +PKG_RESTAPI_DIR=$(DATA_DIR)/restapi.war PKG_JBOSS_MODULES=$(DATA_DIR)/modules PKG_CACHE_DIR=$(LOCALSTATE_DIR)/cache/$(ENGINE_NAME) PKG_LOG_DIR=$(LOCALSTATE_DIR)/log/$(ENGINE_NAME) @@ -247,9 +248,11 @@ install_artifacts: @echo "*** Deploying EAR to $(DESTDIR)" install -dm 755 $(DESTDIR)$(PKG_EAR_DIR) + install -dm 755 $(DESTDIR)$(PKG_RESTAPI_DIR) install -dm 755 $(DESTDIR)$(MAVENPOM_DIR) X=`find "$(MAVEN_OUTPUT_DIR)" -name 'engine-server-ear-$(POM_VERSION)*'.ear` && unzip -o "$$X" -d "$(DESTDIR)$(PKG_EAR_DIR)" + X=`find "$(MAVEN_OUTPUT_DIR)" -name 'restapi-webapp-$(POM_VERSION)*'.war` && unzip -o "$$X" -d "$(DESTDIR)$(PKG_RESTAPI_DIR)" for artifact_id in $(ARTIFACTS); do \ POM=`find "$(MAVEN_OUTPUT_DIR)" -name "$${artifact_id}-$(POM_VERSION)*.pom"`; \ diff --git a/backend/manager/conf/engine.conf.defaults.in b/backend/manager/conf/engine.conf.defaults.in index 7e88117..275c59d 100644 --- a/backend/manager/conf/engine.conf.defaults.in +++ b/backend/manager/conf/engine.conf.defaults.in @@ -94,7 +94,7 @@ # separated files or directories that should exist under # /usr/share/ovirt-engine: # -ENGINE_APPS=engine.ear +ENGINE_APPS="engine.ear restapi.war" # # Flags to enable or disable the web server (the proxy) and the diff --git a/backend/manager/modules/restapi/webapp/pom.xml b/backend/manager/modules/restapi/webapp/pom.xml index 384ce2b..bb5c578 100644 --- a/backend/manager/modules/restapi/webapp/pom.xml +++ b/backend/manager/modules/restapi/webapp/pom.xml @@ -11,9 +11,6 @@ <packaging>war</packaging> <name>oVirt RESTful API Backend Integration Webapp</name> - <properties> - <webapp.name>restapi</webapp.name> - </properties> <dependencies> <dependency> <groupId>org.ovirt.engine.api</groupId> @@ -28,23 +25,18 @@ <scope>provided</scope> </dependency> </dependencies> + <build> + <plugins> <plugin> <artifactId>maven-war-plugin</artifactId> <configuration> - <!-- Add a the manifest that contains the required - dependencies for JBoss modules: --> - <archive> - <addMavenDescriptor>false</addMavenDescriptor> - <manifestFile>src/main/resources/META-INF/MANIFEST.MF</manifestFile> - </archive> - <!-- Don't include any of the external dependencies, as they are - already included as references in the manifest (note that the - web.xml file is included regardless of this configuration): --> + already included as references in the deployment structure: --> <packagingIncludes> + WEB-INF/*.xml, WEB-INF/lib/interface-common-jaxrs.jar, WEB-INF/lib/restapi-definition.jar, WEB-INF/lib/restapi-jaxrs.jar, @@ -53,6 +45,7 @@ </configuration> </plugin> + </plugins> </build> diff --git a/backend/manager/modules/restapi/webapp/src/main/resources/META-INF/MANIFEST.MF b/backend/manager/modules/restapi/webapp/src/main/resources/META-INF/MANIFEST.MF deleted file mode 100644 index 24d1ddb..0000000 --- a/backend/manager/modules/restapi/webapp/src/main/resources/META-INF/MANIFEST.MF +++ /dev/null @@ -1,2 +0,0 @@ -Manifest-Version: 1.0 -Dependencies: org.yaml.snakeyaml diff --git a/backend/manager/modules/restapi/webapp/src/main/webapp/WEB-INF/jboss-deployment-structure.xml b/backend/manager/modules/restapi/webapp/src/main/webapp/WEB-INF/jboss-deployment-structure.xml new file mode 100644 index 0000000..3d3eafd --- /dev/null +++ b/backend/manager/modules/restapi/webapp/src/main/webapp/WEB-INF/jboss-deployment-structure.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.1"> + + <deployment> + <dependencies> + <module name="org.apache.commons.codec"/> + <module name="org.ovirt.engine.core.bll"/> + <module name="org.ovirt.engine.core.common"/> + <module name="org.ovirt.engine.core.compat"/> + <module name="org.ovirt.engine.core.utils"/> + <module name="org.yaml.snakeyaml"/> + </dependencies> + </deployment> + +</jboss-deployment-structure> diff --git a/backend/manager/modules/restapi/webapp/src/main/webapp/WEB-INF/jboss-web.xml b/backend/manager/modules/restapi/webapp/src/main/webapp/WEB-INF/jboss-web.xml new file mode 100644 index 0000000..8add9a1 --- /dev/null +++ b/backend/manager/modules/restapi/webapp/src/main/webapp/WEB-INF/jboss-web.xml @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<jboss-web + xmlns="http://www.jboss.com/xml/ns/javaee" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee http://www.jboss.org/j2ee/schema/jboss-web_7_1.xsd" + version="7.0"> + + <context-root>/api</context-root> + +</jboss-web> diff --git a/ear/pom.xml b/ear/pom.xml index bef2ccb..d9a3c68 100644 --- a/ear/pom.xml +++ b/ear/pom.xml @@ -48,6 +48,7 @@ <artifactId>restapi-webapp</artifactId> <version>${engine.version}</version> <type>war</type> + <scope>provided</scope> </dependency> <dependency> @@ -171,13 +172,6 @@ </webModule> <webModule> - <groupId>org.ovirt.engine.api</groupId> - <artifactId>restapi-webapp</artifactId> - <bundleFileName>restapi.war</bundleFileName> - <contextRoot>/api</contextRoot> - </webModule> - - <webModule> <groupId>org.ovirt.engine.ui</groupId> <artifactId>userportal</artifactId> <bundleFileName>userportal.war</bundleFileName> @@ -212,8 +206,10 @@ as they are already included as references in the manifest: --> <packagingIncludes> - *.jar/**, - *.war/**, + beans.jar/**, + root.war/**, + userportal.war/**, + webadmin.war/**, META-INF/**, </packagingIncludes> @@ -229,10 +225,9 @@ <id>dep</id> <properties> - <engine.rootDir>..</engine.rootDir> - <engine.deploymentName>${project.build.finalName}.ear</engine.deploymentName> - <engine.deploymentsDir>${jbossServer}/deployments</engine.deploymentsDir> - <engine.deploymentDir>${engine.deploymentsDir}/${engine.deploymentName}</engine.deploymentDir> + <deploymentsDir>${jbossServer}/deployments</deploymentsDir> + <earDir>${deploymentsDir}/engine.ear</earDir> + <restapiDir>${deploymentsDir}/restapi.war</restapiDir> </properties> <build> @@ -329,50 +324,64 @@ </executions> </plugin> - <!-- Deploy the contents of the ear: --> <plugin> <artifactId>maven-antrun-plugin</artifactId> <executions> + + <!-- Deploy all the applications: --> <execution> - <id>deploy-ear</id> + <id>deploy-applications</id> <phase>package</phase> - <configuration> <tasks> - <property name="deployment.dir" location="${engine.deploymentDir}"/> - <echo>*** Copying updated files to ${deployment.dir}${file.separator}...</echo> - <unjar src="${project.build.directory}/${project.build.finalName}.ear" dest="${engine.deploymentDir}"/> - <property name="deployment.descriptor.file" location="${deployment.dir}/META-INF/application.xml"/> - <echo>*** Touching ${deployment.descriptor.file} to force redeployment of ${engine.deploymentName}...</echo> - <touch file="${deployment.descriptor.file}"/> - <echo>*** Touching ${engine.deploymentName}.dodeploy to force deployment of ${engine.deploymentName}...</echo> - <touch file="${jbossServer}/deployments/${engine.deploymentName}.dodeploy"/> + + <!-- Create a fileset that contains all the + dependencies of the project: --> + <dependencyfilesets/> + + <!-- Deploy the .ear: --> + <mkdir dir="${earDir}"/> + <unzip dest="${earDir}"> + <fileset dir="${project.build.directory}"> + <include name="${project.build.finalName}.ear"/> + </fileset> + </unzip> + <touch file="${earDir}/META-INF/application.xml"/> + <touch file="${earDir}.dodeploy"/> + + <!-- Deploy the RESTAPI .war: --> + <mkdir dir="${restapiDir}"/> + <unzip dest="${restapiDir}"> + <fileset refid="org.ovirt.engine.api:restapi-webapp:war"/> + </unzip> + <touch file="${restapiDir}/WEB-INF/web.xml"/> + <touch file="${restapiDir}.dodeploy"/> + </tasks> </configuration> - <goals> <goal>run</goal> </goals> </execution> + <!-- Undeploy all the applications: --> <execution> - <id>undeploy-ear</id> + <id>undeploy-applications</id> <phase>clean</phase> - <configuration> <tasks> - <property name="deployment.dir" location="${engine.deploymentDir}"/> - <echo>*** Deleting ${deployment.dir}${file.separator}...</echo> - <delete dir="${deployment.dir}"/> + <delete dir="${earDir}"/> + <delete dir="${restapiDir}"/> </tasks> </configuration> - <goals> <goal>run</goal> </goals> </execution> + </executions> </plugin> + </plugins> </build> </profile> diff --git a/packaging/fedora/spec/ovirt-engine.spec.in b/packaging/fedora/spec/ovirt-engine.spec.in index fedfa0c..2b70d1b 100644 --- a/packaging/fedora/spec/ovirt-engine.spec.in +++ b/packaging/fedora/spec/ovirt-engine.spec.in @@ -33,7 +33,7 @@ %global engine_cache %{_localstatedir}/cache/%{engine_name} %global engine_tmp %{_localstatedir}/tmp/%{engine_name} -%global restapi_war %{engine_ear}/restapi.war +%global restapi_war %{engine_data}/restapi.war %global root_war %{engine_ear}/root.war # The name and ids of the engine user and group: @@ -91,6 +91,7 @@ MAVENPOM_DIR=%{_mavenpomdir} \\\ PKG_SYSCONF_DIR=%{engine_etc} \\\ PKG_EAR_DIR=%{engine_ear} \\\ + PKG_RESTAPI_DIR=%{restapi_war} \\\ PKG_PKI_DIR=%{engine_pki} \\\ PKG_JBOSS_MODULES=%{engine_jboss_modules} \\\ PKG_CACHE_DIR=%{engine_cache} \\\ @@ -296,14 +297,17 @@ install -dm 755 %{buildroot}/%{engine_cache} install -dm 755 %{buildroot}/%{engine_run}/notifier -# -# Force TLS/SSL for selected applications. -# -for war in restapi userportal webadmin; do - sed -i \ - 's#<transport-guarantee>NONE</transport-guarantee>#<transport-guarantee>CONFIDENTIAL</transport-guarantee>#' \ - "%{buildroot}%{engine_ear}/${war}.war/WEB-INF/web.xml" -done +# Force TLS/SSL for selected applications: +while read war_path +do + sed -i \ + 's#<transport-guarantee>NONE</transport-guarantee>#<transport-guarantee>CONFIDENTIAL</transport-guarantee>#' \ + "%{buildroot}${war_path}/WEB-INF/web.xml" +done <<'.' +%{restapi_war} +%{engine_ear}/userportal.war +%{engine_ear}/webadmin.war +. # Move the jar files to the right directory and replace them with links: install -dm 755 %{buildroot}%{engine_java} -- To view, visit http://gerrit.ovirt.org/13718 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I11558b95f3c99cad2edc2d42170fce7eb88c005b Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Juan Hernandez <juan.hernan...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches