この例は、非クラスター化 JBoss EAP 6 管理対象ドメイン用の User Data フィールドを示しています。ユーザー admin のパスワードは admin に設定されます。
JBOSS_DOMAIN_S3_SECRET_ACCESS_KEY=<your secret key>
JBOSS_DOMAIN_S3_ACCESS_KEY=<your access key>
JBOSS_DOMAIN_S3_BUCKET=<your bucket name>
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
Add the modcluster subsystem to the default profile to set up a proxy
Deploy the sample application from the local filesystem
## password that will be used by slave host controllers to connect to the domain controller
JBOSSAS_ADMIN_PASSWORD=admin
## subnet prefix this machine is connected to
SUBNET=10.0.0.
## S3 domain controller discovery setup
# JBOSS_DOMAIN_S3_SECRET_ACCESS_KEY=<your secret key>
# JBOSS_DOMAIN_S3_ACCESS_KEY=<your access key>
# JBOSS_DOMAIN_S3_BUCKET=<your bucket name>
#### to run the example no modifications below should be needed ####
JBOSS_DOMAIN_CONTROLLER=true
PORTS_ALLOWED="9999 9990 9443"
JBOSS_IP=`hostname | sed -e 's/ip-//' -e 'y/-/./'` #listen on public/private EC2 IP address
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://<your secure storage hostname>/<path>/<app name>.war -O /usr/share/java/jboss-ec2-eap-applications/<app name>.war
## Create a file of CLI commands to be executed after starting the server
cat> $USER_CLI_COMMANDS << "EOC"
# Add the modcluster subsystem to the default profile to set up a proxy
/profile=default/subsystem=web/connector=ajp:add(name=ajp,protocol=AJP/1.3,scheme=http,socket-binding=ajp)
/:composite(steps=[ {"operation" => "add", "address" => [ ("profile" => "default"), ("subsystem" => "modcluster") ] },{ "operation" => "add", "address" => [ ("profile" => "default"), ("subsystem" => "modcluster"), ("mod-cluster-config" => "configuration") ], "advertise" => "false", "proxy-list" => "${jboss.modcluster.proxyList}", "connector" => "ajp"}, { "operation" => "add", "address" => [ ("profile" => "default"), ("subsystem" => "modcluster"), ("mod-cluster-config" => "configuration"), ("dynamic-load-provider" => "configuration") ]}, { "operation" => "add", "address" => [ ("profile" => "default"), ("subsystem" => "modcluster"), ("mod-cluster-config" => "configuration"), ("dynamic-load-provider" => "configuration"), ("load-metric" => "busyness")], "type" => "busyness"} ])
# Deploy the sample application from the local filesystem
deploy /usr/share/java/jboss-ec2-eap-samples/hello.war --server-groups=main-server-group
EOC
## this will workaround the problem that in a VPC, instance hostnames are not resolvable
echo -e "127.0.0.1\tlocalhost.localdomain localhost" > /etc/hosts
echo -e "::1\tlocalhost6.localdomain6 localhost6" >> /etc/hosts
for (( i=1 ; i<255 ; i++ )); do
echo -e "$SUBNET$i\tip-${SUBNET//./-}$i" ;
done >> /etc/hosts
EOF
Copy to ClipboardCopied!Toggle word wrapToggle overflow
本番稼働インスタンスの場合
本番環境インスタンスの場合は、次の行を User Data フィールドの USER_SCRIPT 行の下に追加してセキュリティーアップデートが起動時に適用されるようにします。
yum -y update
yum -y update
Copy to ClipboardCopied!Toggle word wrapToggle overflow
注記
yum -y update を定期的に実行して、セキュリティー修正と拡張を適用する必要があります。
Red Hat AMI インスタンスを起動します。
結果
非クラスター化された JBoss EAP 6 管理対象ドメインが設定され、Red Hat AMI で起動されます。