Bläddra i källkod

Update vagrant files to use core

Hamilton Turner 11 år sedan
förälder
incheckning
07b35fc0ff

+ 4 - 3
toolset/deployment/vagrant-aws/README.md

@@ -99,7 +99,7 @@ provider is used.
 | <sup>2</sup>`TFB_AWS_SEC_GROUP`  | `<security_group_id>` (e.g. `sg-871240e2`) | The default security group instances use
 | `TFB_AWS_EBS_TYPE`               | `gp2,standard,io1`  | The EBS [type](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/block-device-mapping-concepts.html#block-device-mapping-def). `gp2` is a general-purpose SSD, `standard` is a magnetic drive, `io1` is a guaranteed I/O SSD drive. Our benchmark mode defaults to `gp2`
 | `TFB_AWS_EBS_IO`                 | `<number>`          | Only used if `TFB_AWS_EBS_TYPE=io1`. The number of IO operations per second
-| `TFB_AWS_EBS_DELETE`             | `true,false`        | Should the EBS volume be deleted when `vagrant destroy` happens? 
+| `TFB_AWS_EBS_DELETE`             | `true,false`        | Should the EBS volume be deleted when `vagrant destroy` happens? Note: We cannot currently tag EBS with `Project=FrameworkBenchmarks`, so you'll need to remember which volumes were from this project, and which of those was the application server volume
 | `TFB_AWS_APP_IP`                 | `<ip address>`      | IP address used inside Amazon for the application server. Default is `172.16.0.16`
 | `TFB_AWS_LOAD_IP`                | `<ip address>`      | IP address used inside Amazon for the application server. Default is `172.16.0.17`
 | `TFB_AWS_DB_IP`                  | `<ip address>`      | IP address used inside Amazon for the database server. Default is `172.16.0.18`
@@ -189,6 +189,7 @@ simultaneous benchmarks, so the better approach is to just increase all
 the IP addresses by 3 and run the additional benchmarks in the same VPC. 
 
 
+**I'm getting an AuthFailure but my Credientials are Correct!**:
 
-
-Use SSD on benchmark server
+This normally means the AMI has been moved from public to private. Ubuntu's 
+Cloud image team occasionally does this. Navigate [here](http://cloud-images.ubuntu.com/trusty/current/) and find a more current AMI. 

+ 18 - 15
toolset/deployment/vagrant-common/core.rb

@@ -25,7 +25,7 @@ def provision_bootstrap(config, role)
   end
 end
 
-def provider_aws(config, role, ip_address)
+def provider_aws(config, role, ip_address='172.16.0.16')
   config.vm.provider :aws do |aws, override|
     aws.access_key_id = ENV['TFB_AWS_ACCESS_KEY'] 
     aws.secret_access_key = ENV['TFB_AWS_SECRET_KEY']
@@ -40,34 +40,42 @@ def provider_aws(config, role, ip_address)
     # This is 64-bit Ubuntu 14.04 US east EBS
     # See http://cloud-images.ubuntu.com/vagrant/trusty/current/ 
     # for comparison to the Ubuntu Vagrant VirtualBox boxes 
-    aws.ami = "ami-62c8160a"
+    aws.ami = "ami-f6bf659e"
     override.ssh.username = "ubuntu"
-
-
-    aws.region = ENV.fetch('TFB_AWS_REGION', 'us-east-1')
     
     aws.private_ip_address = ip_address
     aws.associate_public_ip = true
+    aws.region = ENV.fetch('TFB_AWS_REGION', 'us-east-1')
     aws.subnet_id = ENV['TFB_AWS_SUBNET']  # subnet-2737230f for me
     aws.security_groups = [ENV['TFB_AWS_SEC_GROUP']] # sg-871240e2 
+    aws.instance_type = ENV.fetch('TFB_AWS_EC2_TYPE', 'm1.large')
 
     aws.tags = {
       'Project' => 'FrameworkBenchmarks',
       'TFB_role' => role
      }
     
+    # Setup disk. Defauly is 15GB General Purpose SSD
     # Double the default volume size, as we download and 
     # install a *lot* of stuff
+    # Documentation is at http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-blockdev-template.html
+    aws.block_device_mapping = [{ 'DeviceName' => '/dev/sda1', 
+      'Ebs.VolumeSize' => 15 ,
+      'Ebs.DeleteOnTermination' => ENV.fetch('TFB_AWS_EBS_DELETE', true),
+      'Ebs.VolumeType' => ENV.fetch('TFB_AWS_EBS_TYPE', 'gp2')
+      }]
+    if ENV.fetch('TFB_AWS_EBS_TYPE', 'standard') == 'io1'
+      aws.block_device_mapping[0]['Ebs.Iops'] = ENV.fetch('TFB_AWS_EBS_IO', '1000')
+    end
 
-    # TODO use http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-blockdev-template.html
-    # and read the type from the environment
-    aws.block_device_mapping = [{ 'DeviceName' => '/dev/sda1', 'Ebs.VolumeSize' => 15 }]
+    if ENV.fetch('TFB_FORCE_SYNC', "false") == "true"
+      override.vm.synced_folder "../../..", "/FrameworkBenchmarks"
+    end
 
-    aws.instance_type = "m1.small"
   end
 end
 
-def provider_virtualbox(config, role, ip_address)
+def provider_virtualbox(config, role)
   config.vm.provider :virtualbox do |vb, override|
     override.vm.hostname = "TFB-#{role}"
 
@@ -75,11 +83,6 @@ def provider_virtualbox(config, role, ip_address)
     if ENV.fetch('TFB_VM_ARCH','64') == "32"
       override.vm.box = "ubuntu/trusty32"
     end
-
-    # Use a non-standard value here as most home networks are 
-    # 192.168.X.X or 10.X.X.X and we cannot have a collision 
-    # with the host network
-    override.vm.network "private_network", ip: ip_address
     
     if ENV.fetch('TFB_SHOW_VM', false)
       vb.gui = true

+ 9 - 79
toolset/deployment/vagrant-development/Vagrantfile

@@ -1,93 +1,23 @@
 # -*- mode: ruby -*-
 # vi: set ft=ruby :
 
-require_relative 'common'
+require_relative '../vagrant-common/checks'
+require_relative '../vagrant-common/core'
 
 provider = get_provider
 check_provider_needs(provider)
 
 Vagrant.configure("2") do |config|
-  
-  config.vm.provision :shell do |sh|
-    sh.path = "bootstrap.sh"
-    
-    # We run the bootstrap as the normal vagrant user, not as root
-    sh.privileged = false
-    
-    # If you need arguments, you must pass them in, becuase Vagrant 
-    # cleans the environment before running the provision script
-    # sh.args = ""
-  end
-
-  config.vm.provider :virtualbox do |vb, override|
-    override.vm.hostname = "TFB"
-    override.vm.box = "ubuntu/trusty64"
-
-    vb.customize ["modifyvm", :id, "--memory", "2048"]
-    if ENV['TFB_SHOW_VM'] and ENV['TFB_SHOW_VM'] == "true"
-      vb.gui = true
-    end
 
-    if ENV['TFB_VM_ARCH'] and ENV['TFB_SHOW_VM'] == "32"
-      override.vm.box = "ubuntu/trusty32"
-    end
-
-    # Use a non-standard value here as most home networks are 
-    # 192.168.X.X or 10.X.X.X and we cannot have a collision 
-    # with the host network
-    override.vm.network "private_network", ip: "172.16.16.16"
-
-    # Add settings for development
-    override.vm.synced_folder "../../..", "/FrameworkBenchmarks"
-    override.vm.network :forwarded_port, guest: 8080, host: 28080
+  config.vm.provision :file do |file|
+      file.source = "../vagrant-common/custom_motd.sh"
+      file.destination = "~/.custom_motd.sh"
   end
+  
+  provision_bootstrap(config, 'all')
 
-  config.vm.provider :aws do |aws, override|
-    aws.access_key_id = ENV['TFB_AWS_ACCESS_KEY'] 
-    aws.secret_access_key = ENV['TFB_AWS_SECRET_KEY']
-    aws.keypair_name = ENV['TFB_AWS_KEY_NAME']
-    override.ssh.private_key_path = ENV['TFB_AWS_KEY_PATH']
-
-    # Use a boilerplate box - this will be replaced by the AMI
-    override.vm.box = "dummy"
-    override.vm.box_url = "https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box"
-
-    # From http://cloud-images.ubuntu.com/trusty/current/
-    # This is 64-bit Ubuntu 14.04 US east EBS
-    # See http://cloud-images.ubuntu.com/vagrant/trusty/current/ 
-    # for comparison to the Ubuntu Vagrant VirtualBox boxes 
-    aws.ami = "ami-62c8160a"
-    override.ssh.username = "ubuntu"
-    
-    # If you would like to override
-    # aws.region = "us-east-1"
-    # aws.security_groups = ["default"]
-
-    aws.private_ip_address = "10.0.0.12"
-    aws.associate_public_ip = true
-    aws.subnet_id = "subnet-53a9bc7b"
-
-    aws.tags = {
-      'Project' => 'FrameworkBenchmarks',
-      'TFB_role' => 'integrated'
-     }
-
-    # Manually set the hostname (not supported by vagrant-aws)
-    override.vm.provision :shell do |sh|
-      sh.inline = "
-        echo '127.0.0.1 TFB-server' >> /etc/hosts
-        echo 'TFB-server' > /etc/hostname
-        hostname `cat /etc/hostname`"
-    end
-    
-    # Currently this uses 'previous generation' instance names
-    # See: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html
-    aws.instance_type = "m1.small"
+  provider_virtualbox(config, 'all')
 
-    # Disable support for synced folders
-    if !(ENV['TFB_FORCE_SYNC'] and ENV['TFB_FORCE_SYNC'] == "true")
-      override.vm.synced_folder "../../..", "/FrameworkBenchmarks", disabled: true
-    end
-  end
+  provider_aws(config, 'integrated')
   
 end

+ 10 - 7
toolset/deployment/vagrant-production/Vagrantfile

@@ -1,12 +1,11 @@
 # -*- mode: ruby -*-
 # vi: set ft=ruby :
 
-require_relative '../vagrant/common'
+require_relative '../vagrant-common/checks'
+require_relative '../vagrant-common/core'
 provider = get_provider
 check_provider_needs(provider)
 
-require_relative 'production-env'
-
 Vagrant.configure("2") do |config|
 
   server_ip = ENV.fetch('TFB_LOAD_IP', '172.16.0.16')
@@ -21,24 +20,28 @@ Vagrant.configure("2") do |config|
     end
   end
 
+  config.vm.provision :file do |file|
+      file.source = "../vagrant-common/custom_motd.sh"
+      file.destination = "~/.custom_motd.sh"
+  end
+
   config.vm.define "client" do |client|
     provision_bootstrap(client, "client")
     provider_aws(client, "loadgen", client_ip)
-    provider_virtualbox(client, "client", client_ip)
+    provider_virtualbox(client, "client")
   end
 
   config.vm.define "db" do |db|
     provision_bootstrap(db, "database")
     provider_aws(db, "database", databa_ip)
-    provider_virtualbox(db, "database", databa_ip)
+    provider_virtualbox(db, "database")
   end
 
   # Define the app server as the primary VM
   config.vm.define "app", primary: true do |app|
     provision_bootstrap(app, "server")
-    ENV.fetch
     provider_aws(app, "appserver", server_ip)
-    provider_virtualbox(app, "server", server_ip)
+    provider_virtualbox(app, "server")
   end
 
 end