25.2.2.2.2. 在非群集 JBoss EAP 6 实例上部署应用程序

概述

本节涵盖在 Red Hat AMI 上的非群集 JBoss EAP 6 实例上部署应用程序。

    • 部署示例应用程序

      User Data 字段添加下列行:
      # Deploy the sample application from the local filesystem
      deploy --force /usr/share/java/jboss-ec2-eap-samples/hello.war
      

      例 25.2. 例程的『User Data』字段示例

      这个例子使用了 Red Hat AMI 提供的例程。它也包含了非群集 JBoss EAP 6 实例的基本配置。用户 admin 的密码已被设置为 adminpwd
      JBOSSAS_ADMIN_PASSWORD=adminpwd
      JBOSS_IP=0.0.0.0 #listen on all IPs and interfaces
      
      # In production, access to these ports needs to be restricted for security reasons
      PORTS_ALLOWED="9990 9443"
      
      cat> $USER_SCRIPT << "EOF"
      
      # Create a file of CLI commands to be executed after starting the server
      cat> $USER_CLI_COMMANDS << "EOC" 
      
      # Deploy the sample application from the local filesystem
      deploy --force /usr/share/java/jboss-ec2-eap-samples/hello.war
      EOC
      
      EOF
      
      
    • 部署自定义的应用程序

      User Data 字段添加下列行,配置应用程序名称和 URL:
      # Get the application to be deployed from an Internet URL
      mkdir -p /usr/share/java/jboss-ec2-eap-applications
      wget https://<your secure storage hostname>/<path>/<app name>.war -O /usr/share/java/jboss-ec2-eap-applications/<app name>.war
      
      

      例 25.3. 自定义应用程序的『User Data』字段示例

      这个例子使用了名为 MyApp 的应用程序,它也包含了非群集 JBoss EAP 6 实例的基本配置。用户 admin 的密码已被设置为 adminpwd
      JBOSSAS_ADMIN_PASSWORD=adminpwd
      JBOSS_IP=0.0.0.0 #listen on all IPs and interfaces
      
      # In production, access to these ports needs to be restricted for security reasons
      PORTS_ALLOWED="9990 9443"
      
      cat> $USER_SCRIPT << "EOF"
      
      # Get the application to be deployed from an Internet URL
      mkdir -p /usr/share/java/jboss-ec2-eap-applications
      wget https://PATH_TO_MYAPP/MyApp.war -O /usr/share/java/jboss-ec2-eap-applications/MyApp.war 
      
      # Create a file of CLI commands to be executed after starting the server
      cat> $USER_CLI_COMMANDS << "EOC" 
      deploy /usr/share/java/jboss-ec2-eap-applications/MyApp.war
      EOC
      
      EOF
      
      
  1. 启动 Red Hat AMI 实例。
结果

应用程序已成功部署到 JBoss EAP 6 里。