Skip to content

Mediawiki poc deployment

Steve Huff edited this page Sep 19, 2013 · 11 revisions

Assumptions

This document assumes that the following conditions are satisfied:

  1. You have an Internet-connected Mac running OS X 10.6, 10.7, or 10.8.
  2. You already have an Amazon Web Services account under AWS IAM, and are configured for AWS billing.
  3. You have no other AWS resources deployed under your account.
  4. You can check out git repositories from GitHub (go to GitHub Help if not).

Procedure

  1. Install Nepho.
    1. Launch Terminal.

    2. Follow the directions for manual Nepho installation. Make sure you check out the tag for version 0.1.1, rather than master, to be assured of getting a stable release of the software. Do not proceed beyond this point until you can run the following command in your Terminal session and receive comparable output:

       $ nepho
       usage: nepho [-h] [-E ENVIRONMENT] [-N NAME] [--driver DRIVER] [--aws AWS]
                    [--vagrant VAGRANT]
                    subcommand deployment
       $
      
  2. Configure an AWS security key for SSH access.
    1. Browse to the AWS EC2 dashboard.

    2. Select "Key Pairs".

    3. Select "Create Key Pair".

    4. Enter a distinctive key pair name and select "Create". Once the key is created, your browser will download it under the filename "<key pair name>.pem". Remember this key pair name; you'll need it later in this procedure.

    5. Launch Terminal.

    6. Create ~/.ssh if it doesn't already exist. Its permissions mode should be 600 (chmod 600 ~/.ssh to make sure).

    7. cp /path/to/<key pair name>.pem ~/.ssh/<key pair name> && chmod 700 ~/.ssh/<key pair name>

    8. Make sure ~/.ssh/config contains the following stanza:

       Host *.amazonaws.com
         User ec2-user
         IdentityFile ~/.ssh/<key pair name>
         StrictHostKeyChecking no
         PreferredAuthentications publickey
      
  3. Configure your deployment.
    1. Browse to the AWS EC2 dashboard.
    2. Under the "Availability Zone Status" section, make note of the availability zones to which you have access; they will have names like us-east-1a, us-east-1b etc.
    3. Launch Terminal.
    4. cd ~/nepho (or to wherever you checked out nepho).
    5. Open nepho/data/deployments/mediawiki.yaml in your text editor of choice.
    6. In the production stanza, make sure KeyName is set to the key pair name from earlier in this procedure.
    7. In the production stanza, make sure AZ1 and AZ2 are set to availability zones to which you have access.
    8. Save your changes to mediawiki.yaml.
  4. Deploy the POC.
    1. Launch Terminal.

    2. nepho -E production deploy mediawiki You should see output that looks something like the following:

       {
           "StackId": "arn:aws:cloudformation:us-east-1:437323568624:stack/mediawiki-production/7d539850-1bc3-11e3-97e5-50e241629418"
       }
      
    3. Browse to the AWS CloudFormation dashboard. You should see a CloudFormation stack called mediawiki-production with a status of CREATE_IN_PROGRESS.

    4. Wait for the deployment to complete; it will take 15-20 minutes. To track its progress, select the CloudFormation stack, then select the "Events" tab and watch the components of the deployment as they are created.

    5. In the event that the deployment fails (the CloudFormation stack's status will change to CREATE_FAILED), delete the stack as follows:

      1. Select the CloudFormation stack, then select the "Resources" tab.
      2. Scroll through the "Resources" list until you find the "VPC" entry, then make note of the "Physical ID" value.
      3. Select "Delete Stack".
      4. Browse to the AWS VPC dashboard.
      5. Select "Your VPCs".
      6. Select the VPC whose "VPC ID" is the same as the "Physical ID" you noted earlier.
      7. Select "Delete". If you see a message telling you that the VPC cannot be deleted because it contains running instances, wait a minute for those instances to terminate, and then try again.
      8. Once your VPC is deleted, browse back to the AWS CloudFormation dashboard, select the CloudFormation stack, and select "Delete Stack" again.
      9. Once the stack is deleted, try running the deployment again with nepho -E production deploy mediawiki
    6. Once the deployment succeeds (the CloudFormation stack's status will change to CREATE_COMPLETE), select the CloudFormation stack, then select the "Outputs" tab.

    7. Scroll through the "Stack Outputs" list until you find the "Tier1ElasticLoadBalancerURL" key, then browse to the URL under "Value". You should see the front page of the MediaWiki deployment (albeit with the default MediaWiki theme).

  5. Test the deployment.
    1. Browse through the wiki content. Bear in mind that this web application lives behind two layers of indirection (ELB and Varnish caches), and so the first troubleshooting step in the event of any problem should be to reload the page.
    2. Create a new account for yourself (PIN authentication does not work); there is no need to insert an email address, since outbound mail sending does not currently work either, but other aspects of account creation should work.
    3. Edit wiki content, preview, and save your edits.
    4. Browse to the AWS EC2 dashboard.
    5. Select "Instances".
    6. Select one of the instances and check its "Security Groups" value; you're looking for an instance with a security group whose name contains "Tier1SecurityGroup" or "Tier2SecurityGroup". This value tells you whether you are looking at a frontend Varnish server (Tier1) or a backend MediaWiki server (Tier2).
    7. From the "Actions" menu, select "Reboot". You will see the instance begin to reboot.
    8. Browse through the wiki content, make edits, verify that the edits are preserved. You should encounter no interruption in service.
    9. Select an instance in another tier, then from the "Actions" menu, select "Terminate". You will see the instance begin to terminate.
    10. Browse through the wiki content, make edits, verify that the edits are preserved. You should encounter no interruption in service.
    11. Refresh the list of instances in the EC2 dashboard; you should see the autoscale group spinning up another instance to replace the one you terminated. This will also occur if you are able to generate enough load on the cluster that instances begin to serve requests too slowly.
    12. Stress-test the deployment by spinning up a Bees With Machine Guns deployment, as follows:
      1. Open nepho/data/deployments/bees-with-machine-guns.yaml in your text editor of choice.

      2. In the development stanza, make sure TargetURL is set to the public URL of your MediaWiki deployment (which you found earlier in this procedure by looking up the "Tier1ElasticLoadBalancerURL" key). Make sure that the URL ends with a / character.

      3. In the development stanza, make sure KeyName is set to the same key pair name you used in your MediaWiki deployment.

      4. In the development stanza, make sure AZ1 and AZ2 are set to the same availability zones you used in your MediaWiki deployment.

      5. In the development stanza, increase TotalConnections to 1000000.

      6. In the development stanza, increase ConcurrentConnections to 1000.

      7. In the development stanza, increase BeeCount to 10.

      8. Save your changes to bees-with-machine-guns.yaml.

      9. nepho -E development deploy bees-with-machine-guns You should see output that looks something like the following:

         {
             "StackId": "arn:aws:cloudformation:us-east-1:437323568624:stack/bees-with-machine-guns-development/2f695490-1fc4-11e3-8aca-50e241629418"
         }
        
      10. Browse to the AWS EC2 dashboard and look at your running Instances. You should see a number of instances labeled "a bee!" spinning up; these are the stress testers.

      11. Wait 5-10 minutes. You should see additional EC2 instances spinning up (most likely in Tier 1, the frontend/caching tier) in response to the increased load.