在这篇博客文章中,我将介绍如何部署CloudEE封装在杜克大学应用自由尤伯杯罐子Oracle应用集装箱云端 。
在Oracle Application Container Cloud中进行部署所需的部署工件是一个ZIP归档文件,其中包含应用程序über-jar和清单文件(manifest.json)。 下面列出了CloudEE Duke的manifest.json的Liberty版本。
manifest.json
{"runtime": {"majorVersion": "8"},"command": "java -jar cloudee-duke.jar","release": {"version": "1.0","build": "1","commit": "123"},"notes": "Dukes says hello from Liberty"
}
您需要指定供Liberty使用的端口。 这可以通过使用环境变量$ {env.PORT}在server.xml中进行配置来完成,如下所示:
<server description="Sample Liberty server"><featureManager><feature>microprofile-1.2</feature></featureManager><httpEndpoint httpPort="${env.PORT}" httpsPort="9443"id="defaultHttpEndpoint" host="*" /><quickStartSecurity userName="duke" userPassword="duke"/><keyStore id="defaultKeyStore" password="Liberty"/>
</server>
über-jar是通过结合使用Maven资源插件和Liberty Maven插件来生产的:
<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-resources-plugin</artifactId><version>3.0.2</version><executions><execution><id>copy-app</id><phase>package</phase><goals><goal>copy-resources</goal></goals><configuration><outputDirectory>${project.build.directory}/liberty/wlp/usr/servers/defaultServer/dropins</outputDirectory><resources><resource><directory>${project.build.directory}</directory><includes><include>${project.build.finalName}.war</include></includes></resource></resources></configuration></execution></executions>
</plugin>
<plugin><groupId>net.wasdev.wlp.maven.plugins</groupId><artifactId>liberty-maven-plugin</artifactId><version>2.2</version><extensions>true</extensions><configuration><install><type>webProfile7</type><version>2018.+</version></install><configFile>${basedir}/src/main/liberty/config/server.xml</configFile><serverEnv>${basedir}/src/main/liberty/config/server.env</serverEnv><jvmOptionsFile>${basedir}/src/main/liberty/config/jvm.options</jvmOptionsFile><packageFile>${project.build.directory}/${project.build.finalName}.jar</packageFile><include>runnable</include></configuration> <executions><execution><id>install-liberty</id><phase>prepare-package</phase><goals><goal>install-server</goal></goals></execution><execution><id>package-app</id><phase>package</phase><goals><goal>package-server</goal></goals></execution></executions>
</plugin>
有关如何使用maven命令生成可部署的ZIP归档的示例,请参见完整的pom.xml :
mvn clean package assembly:single -Pliberty
这将在目标文件夹中生成一个名为cloudee-duke-oracle-liberty.zip的文件。 这是您将部署到Oracle Application Container Cloud的ZIP存档,如下面的屏幕快照所示。
部署应用程序后,您应该可以访问hello端点
https://<dependsonyouraccount>.oraclecloud.com/helloZ
公爵说你好!
您还将拥有MicroProfile实施提供的运行状况和指标终结点
https://<dependsonyouraccount>.oraclecloud.com/health
{
结果:“ UP”,
检查:[]}
https://<dependsonyouraccount>.oraclecloud.com/metrics
#TYPE base:classloader_total_loaded_class_count计数器
#HELP base:classloader_total_loaded_class_count显示自Java虚拟机开始执行以来已加载的类的总数。
基数:classloader_total_loaded_class_count 9430 #TYPE base:cpu_system_load_average量规 …
翻译自: https://www.javacodegeeks.com/2018/03/liberty-on-oracle-application-container-cloud.html