Skip to content

Instantly share code, notes, and snippets.

@chtz
Last active October 4, 2016 12:16
Show Gist options
  • Save chtz/7301111 to your computer and use it in GitHub Desktop.
Save chtz/7301111 to your computer and use it in GitHub Desktop.
Sample: JBoss EC2 Dev Env Cloud-init Script for Amazon Linux 2013.09 (replace "chtzee6templatewardeploy" with your deployment bucket)
#!/bin/bash
#
# 2013-11-04: Cloud-init setup of JBoss Development Environment on EC2-Instance/Amazon Linux AMI release 2013.09
#
python -c "import boto.ec2; import boto.utils; boto.ec2.connect_to_region(boto.utils.get_instance_metadata()['placement']['availability-zone'][:-1]).create_tags([boto.utils.get_instance_metadata()['instance-id']], {'environment': 'jbosstemplateenv1'})"
mkdir /home/ec2-user/install
cd /home/ec2-user/install/
wget http://download.jboss.org/jbossas/7.1/jboss-as-7.1.1.Final/jboss-as-7.1.1.Final.zip
cd /home/ec2-user/
unzip /home/ec2-user/install/jboss-as-7.1.1.Final.zip
sed -i.bak s/enable-welcome-root=\"true\"/enable-welcome-root=\"false\"/g /home/ec2-user/jboss-as-7.1.1.Final/standalone/configuration/standalone.xml
aws --region us-west-1 s3 cp s3://chtzee6templatewardeploy/ROOT.war /home/ec2-user/jboss-as-7.1.1.Final/standalone/deployments/
chown -R ec2-user:ec2-user /home/ec2-user/jboss-as-7.1.1.Final
rm -fR /home/ec2-user/install
curl -s https://gist.github.com/chtz/7300692/raw/2476ee8031005860ffa1b04c06bb2fabe21153ac/jboss_ec2_init.sh | tee /etc/init.d/jboss-as-standalone > /dev/null
chmod +x /etc/init.d/jboss-as-standalone
chkconfig --add jboss-as-standalone
chkconfig --level 3 jboss-as-standalone on
service jboss-as-standalone start
yum -y install httpd
curl -s https://gist.github.com/chtz/7300908/raw/e5732181154d91a2efb1868fa45414b319e1825a/jboss_proxy.conf | tee /etc/httpd/conf.d/welcome.conf > /dev/null
chkconfig --level 3 httpd on
service httpd start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment