Skip to content

Installation_Guide_Environment

jdfalko edited this page Mar 27, 2019 · 6 revisions

Contents | Preface | Introduction | Architecture | Environment | Standalone | Deployment | Configuration

Standard Environment

Setting up the environment involves getting an account with Amazon, and creating various resources such as AMIs, Security Keys, Security Zones, and EBS volumes.

Creating an Account

Note

You will need a Credit Card or arrange payment in order to complete the following steps.

  1. Go to http://aws.amazon.com/ and click on the "Sign Up" button
  2. Complete all steps for creating an account

Retrieve Security Credentials

Thera are two methods of setting up access to resources from the controller and agent instances.

  • Use IAM roles to start the instances giving them access to the needed resources. If you use this method, just make sure you start your resources with the appropriate roles.

  • Use access keys.

    1. Log in to the amazon console from http://aws.amazon.com/
    2. In the top right corner where the account name shows up, click it and select Security Credentials from the drop down menu.
    3. Scroll down to the Access Keys section and click Create a new Access Key
    4. Copy the Access Key ID from the newly created key.
    5. Click on Show section and copy the Secret Access Key
    6. Store these values in a file on your computer somewhere, you will need them for configuration later.

Creating a Key Pair

The keypair is used to ssh into the instances that get started. Do not lose these keys as they cannot be retrieved form AWS.

  1. Log in to the amazon console from http://aws.amazon.com/
  2. Go to EC2 tab
  3. Click on Key Pairs link under the Network & Security section in left navigation panel
  4. Create a Key Pair and save the downloaded pem file somewhere safe ssh-keygen -y -f [path/to/pem/file].pem [path/to/key/file].pub
  5. Change the Mod settings on the key file to 600 sudo chmod 600 [path/to/pem/file].pem [path/to/key/file].pub

Tip

Optionally create environment variable for the key. I will use the environment variable, AWS_KEY in the rest of this documentation to refer to the key file. I also put this into my bashrc or profile so you can use this name as well. export AWS_KEY=/Home/aws_keys/tank_key.pem

Create a Security Group

  1. Log in to the amazon console from http://aws.amazon.com/
  2. Go to EC2 tab
  3. Click on Security Groups link under the Network & Security section in left navigation panel
  4. Click the Create Security Group button in the tool bar area
  5. Name the security group something appropriate like tank
  6. Select the new Group and click the Inbound tab in the lower panel
  7. Add appropriate rules. At a minimum, you will need SSH, HTTP (80 and 8080), HTTPS(443 and 8443), and 8090 (agent)

Create an RDS instance

If you wish, you can create your own Mysql instance and point to it instead.

  1. Log in to the amazon console from http://aws.amazon.com/
  2. Go to RDS tab
  3. Click on Instances link in left navigation panel
  4. Click the Launch DB Instance button in the tool panel
  5. Select mysql instance
  6. Set all options appropriately

Create an Base AMI

Agent AMIs must be created in each of the Amazon regions that you wish to run tests from. You can use cloudformation or chef to provision your instances if you wish.

Tip

There is a Cloudformation script and resources in aws-config in the root of this project's directory that will create the controller and the agent instances that can be used as a starting point for creating the AMIs.

  1. Log in to the amazon console from http://aws.amazon.com/

  2. Go to EC2 tab

  3. Click on AMIs link under the Images section in left navigation panel

  4. Find a suitable 64-bit base image backed by EBS and launch an instance. It does not matter which size or zone you start it in as it will only be used to create a base AMI.

  5. After it is started, connect via ssh

  6. Download and install the latest version of Java and add an entry in /etc/profile for a JAVA_HOME variable pointing to the base java directory.

  7. Ensure that java is installed and that the JAVA_HOME environment variable is set in /etc/profile

  8. Set the maximum number of open files limit to at least 50000 echo ulimit -n 50000 >>/etc/profile

  9. Select the instance and choose Create Image (EBS AMI) from the Instance Actions dropdown in the toolbar area.

  10. Give it an appropriate name such as Intuit Tank Base and click OK.

  11. After the instance is ready, terminate the instance you started.

Create Controller Instance and AMI

  1. Log in to the amazon console from http://aws.amazon.com/

  2. Go to EC2 tab

  3. Click on AMIs link under the Images section in left navigation panel

  4. Launch an instance from your Intuit Tank Base AMI. Select m1.xlarge and the zone your EBS volume is installed in.

  5. Click on Elastic IPs link under the Network and Security section in left navigation panel

  6. Click the Allocate New Address button.

  7. Click the new address and click the Associate Address button.

  8. Select the new instance you just launched and select ok.

  9. Connect to the instance ssh -i $AWS_KEY root@[instance]

  10. Download and Install Tomcat 6x from apache wget http://tomcat.apache.org/download-60.cgi

  11. Download mysql connector and install in TOMCAT_HOME/lib wget http://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.30.tar.gz

    or wget http://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.30.zip

  12. Uncompress and move the jar file mysql-connector-java-5.1.30-bin.jar to TOMCAT_HOME/lib

  13. Download Weld support jar and install in TOMCAT_HOME/lib wget -O TOMCAT_HOME/lib http://central.maven.org/maven2/org/jboss/weld/servlet/weld-tomcat-support/1.0.1-Final/weld-tomcat-support-1.0.1-Final.jar

  14. Upload Intuit Tank war file from your build machine upload PROJECT_ROOT/web/web_ui/target/tank.war from your local machine.

  15. Move it to the webapps dir For context of /tankmv tank.war TOMCAT_HOME/webapps/

    For context of /mv tank.war TOMCAT_HOME/webapps/ROOT.war

  16. Create the tank directories. mkdir /mnt/ebs/wats; mkdir /mnt/ebs/wats/conf; mkdir /mnt/ebs/wats/jars

  17. Add Datasource definition to server.xml edit the file TOMCAT_HOME/conf/server.xml. Inside the <GlobalNamingResources> tag add the following replacing values appropriately:

    <Resource name="jdbc/watsDS" auth="Container" type="javax.sql.DataSource" maxActive="100" maxIdle="30" maxWait="10000" username="admin" password="replace_password_here" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://replace_host_name_here:3306/replace_db_name_here?autoReconnect=true" />

  18. Add Datasource definition to context.xml edit the file TOMCAT_HOME/conf/context.xml. Inside the <Context> tag add the following:

    <ResourceLink global='jdbc/watsDS' name='jdbc/watsDS' type="javax.sql.Datasource" />

  19. Start and stop tomcat to initialize the system. Ensure that the settings file is created in $WATS_PROPERTIES and that the database tables are created.

  20. Select the instance and choose Create Image (EBS AMI) from the Instance Actions dropdown in the toolbar area.

  21. Give it an appropriate name such as Intuit Tank Controller and click OK.

  22. After the instance is ready, terminate the instance you started.

Create Agent AMI

  1. Log in to the amazon console from http://aws.amazon.com/
  2. Go to EC2 tab
  3. Click on AMIs link under the Images section in left navigation panel
  4. Launch an instance from your Intuit Tank Base AMI.
  5. Connect to the instance ssh -i AWS_KEY root@[instance]
  6. Upload the agent startup zip file from your build machine PROJECT_ROOT/agent/agent_startup_pkg/target/agent-startup-pkg.zip
  7. unzip the file to /opt cd /opt ; unzip ~/agent-startup-pkg.zip
  8. Move startup script to /etc/init.d mv tank_agent/tank-agent /etc/init.d/
  9. Set it to start on startup chkconfig tank-agent on
  10. Select the instance and choose Create Image (EBS AMI) from the Instance Actions dropdown in the toolbar area.
  11. Give it an appropriate name such as Intuit Tank Agent and click OK.
  12. After the instance is ready, terminate the instance you started.

Contents | Preface | Introduction | Architecture | Environment | Standalone | Deployment | Configuration