Ruby on rails 尝试在EC2上使用橡皮部署时出错

Ruby on rails 尝试在EC2上使用橡皮部署时出错,ruby-on-rails,amazon-ec2,capistrano,rubber,Ruby On Rails,Amazon Ec2,Capistrano,Rubber,我遵循RailsCast#347()在Amazon EC2上部署我的应用程序。 按照所有步骤,当我尝试执行命令时,在创建实例之前,/Users/juampi/.rvm/gems/ruby-2.2.1/gems/ruber-3.2.0/lib/ruber/cloud/aws/base.rb:75:in中:为#(NoMethodError)创建实例:未定义的方法实例别名 这是整个输出 cap rubber:create_staging triggering load callbacks

我遵循RailsCast#347()在Amazon EC2上部署我的应用程序。 按照所有步骤,当我尝试执行命令时,在创建实例之前,
/Users/juampi/.rvm/gems/ruby-2.2.1/gems/ruber-3.2.0/lib/ruber/cloud/aws/base.rb:75:in
中:为#(NoMethodError)创建实例:未定义的方法
实例别名

这是整个输出

cap rubber:create_staging
    triggering load callbacks
  * 2016-01-16 18:24:12 executing `rubber:init'
  * 2016-01-16 18:24:13 executing `rubber:create_staging'
Hostname to use for staging instance [production]: 
Roles to use for staging instance [apache,app,collectd,common,db:primary=true,elasticsearch,examples,graphite_server,graphite_web,graylog_elasticsearch,graylog_mongodb,graylog_server,graylog_web,haproxy,mongodb,monit,passenger,postgresql,postgresql_master,web,web_tools]: 
  * 2016-01-16 18:24:15 executing `rubber:create'
/Users/juampi/.rvm/gems/ruby-2.2.1/gems/rubber-3.2.0/lib/rubber/cloud/aws/base.rb:75:in `before_create_instance': undefined method `instance_alias' for #<Rubber::Configuration::InstanceItem:0x007f9fce9704f8> (NoMethodError)
    from /Users/juampi/.rvm/gems/ruby-2.2.1/gems/rubber-3.2.0/lib/rubber/thread_safe_proxy.rb:13:in `method_missing'
    from /Users/juampi/.rvm/gems/ruby-2.2.1/gems/rubber-3.2.0/lib/rubber/recipes/rubber/instances.rb:281:in `block in create_instance'
    from /Users/juampi/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
    from /Users/juampi/.rvm/gems/ruby-2.2.1/gems/rubber-3.2.0/lib/rubber/recipes/rubber/instances.rb:280:in `create_instance'
    from /Users/juampi/.rvm/gems/ruby-2.2.1/gems/rubber-3.2.0/lib/rubber/recipes/rubber/instances.rb:230:in `block (2 levels) in create_instances'
还有
ruber.yml

# REQUIRED: The name of your application
app_name: iaw2015

# REQUIRED: The system user to run your app servers as
app_user: app

# REQUIRED: Notification emails (e.g. monit) get sent to this address
#
admin_email: "root@#{full_host}"

# OPTIONAL: If not set, you won't be able to access web_tools
# server (graphite, graylog, monit status, haproxy status, etc)
# web_tools_user: admin
# web_tools_password: sekret

# REQUIRED: The timezone the server should be in
timezone: US/Eastern

# REQUIRED: the domain all the instances should be associated with
#
domain: foo.com

# OPTIONAL: See rubber-dns.yml for dns configuration
# This lets rubber update a dynamic dns service with the instance alias
# and ip when they are created.  It also allows setting up arbitrary
# dns records (CNAME, MX, Round Robin DNS, etc)

# OPTIONAL: Additional rubber file to pull config from if it exists.  This file will
# also be pushed to remote host at Rubber.root/config/rubber/rubber-secret.yml
#
# rubber_secret: "#{File.expand_path('~') + '/.ec2' + (Rubber.env == 'production' ? '' : '_dev') + '/rubber-secret.yml' rescue 'rubber-secret.yml'}"

# OPTIONAL: Encryption key that was used to obfuscate the contents of rubber-secret.yml with "rubber util:obfuscation" 
# Not that much better when stored in here, but you could use a ruby snippet in here to fetch it from a key server or something
#
# rubber_secret_key: "XXXyyy=="

# REQUIRED All known cloud providers with the settings needed to configure them
# There's only one working cloud provider right now - Amazon Web Services
# To implement another, clone lib/rubber/cloud/aws.rb or make the fog provider 
# work in a generic fashion
#
cloud_providers:
  aws:
    # REQUIRED The AWS region that you want to use.
    #
    # Options include
    # ap-northeast-1 # Asia Pacific (Tokyo) Region
    # ap-southeast-1 # Asia Pacific (Singapore) Region
    # ap-southeast-2 # Asia Pacific (Sydney) Region
    # eu-west-1      # EU (Ireland) Region
    # sa-east-1      # South America (Sao Paulo) Region
    # us-east-1      # US East (Northern Virginia) Region
    # us-west-1      # US West (Northern California) Region
    # us-west-2      # US West (Oregon) Region
    #
    region: us-east-1

    # REQUIRED The amazon keys and account ID (digits only, no dashes) used to access the AWS API
    #
    access_key: #myaccesskey
    secret_access_key: #Mysecretaccesskey
    account: #myaccount

    # REQUIRED:  The name of the amazon keypair and location of its private key
    #
    # NOTE: for some reason Capistrano requires you to have both the public and
    # the private key in the same folder, the public key should have the
    # extension ".pub".  The easiest way to get your hand on this is to create the
    # public key from the private key: ssh-keygen -y -f gsg-keypair > gsg-keypair.pub
    #
    key_name: gsg-keypair
    key_file: "#{Dir[(File.expand_path('~') rescue '/root') + '/.ec2/*' + cloud_providers.aws.key_name].first}"

    # OPTIONAL: Needed for bundling a running instance using rubber:bundle
    #
    # pk_file: "#{Dir[(File.expand_path('~') rescue '/root') + '/.ec2/pk-*'].first}"
    # cert_file: "#{Dir[(File.expand_path('~') rescue '/root') + '/.ec2/cert-*'].first}"
    # image_bucket: "#{app_name}-images"

    # OPTIONAL: Needed for backing up database to s3
    # backup_bucket: "#{app_name}-backups"

    # OPTIONAL: Define a VPC to deploy to. The alias can be thought of as a
    # unique Rubber-specific Id.  If vpc_alias and vpc_addr are absent, Rubber
    # will instead assume we're deploying to EC2 Classic
    # vpc_alias: "#{app_name}_#{Rubber.env == 'production' ? 'production' : 'development'}"
    # vpc_cidr: 10.0.0.0/16

    # VPCs will typically have two subnets - one for instances that need a
    # direct internet connection (load balancers, etc.), and one for instances
    # that don't (database servers, app servers, etc.).  At the very least,
    # we'll need a public subnet.  Rubber will detect the instance's private_nic
    # configuration, and auto-create a subnet if appropriate.  Any instances on
    # the public subnet will need the following configuration.  It is also
    # important to note that AWS VPC Subnets are availability zone-specific,
    # meaning you probably want to specify an availability zone for your
    # instance.  You will also have to specify a different subnet_cidr for each
    # availability zone, since subnets cannot overlap.
    # private_nic:
    #   subnet_cidr: '10.0.0.0/24'
    #   gateway: public

    # For a private subnet, you will need to configure a nat_gateway instance in
    # the public subnet so that machines can still reach the outside world for
    # things like software updates.  After configuring a NAT gateway, you can
    # set up a separate private subnet.  You will also need to set your :gateway
    # Capistrano configuration value to the full hostname of the nat gateway in
    # order to communicate with instances on private subnets.  Instances which
    # are on a private subnet will need the following configuration
    #  private_nic:
    #    subnet_cidr: '10.0.1.0/24'
    #    gateway: "#{rubber_instances.for_role('nat_gateway').first.instance_id}"

    # REQUIRED: the ami and instance type for creating instances
    # The Ubuntu images at http://old.alestic.com/ work well
    # Ubuntu 14.04.1 Trusty instance-store 64-bit: ami-92f569fa
    #
    # m1.small or m1.large or m1.xlarge
    image_type: t2.micro
    image_id: ami-60b6c60a

    # OPTIONAL: Provide fog-specific options directly.  This should only be used if you need a special setting that
    # Rubber does not directly expose.  Since these settings will be passed directly through to fog, we can't make any
    # guarantee about how they work (if fog renames an attribute, e.g., your config will break).  Please see the fog
    # source code for the option names.
    # fog_options:
      # EBS I/O optimized instance
      # EBS-optimized instances deliver dedicated throughput between Amazon EC2 and Amazon EBS, with options
      # between 500 Mbps and 1000 Mbps depending on the instance type used.
      # Read more and make sure that your image_type supports ebs_optimized function at: http://aws.amazon.com/ec2/instance-types/
      # ebs_optimized: false

    # OPTIONAL: EC2 spot instance request support.
    #
    # Enables the creation of spot instance requests.  Rubber will wait synchronously until the request is fulfilled,
    # at which point it will begin initializing the instance, unless spot_instance_request_timeout is set.
    # spot_instance: true
    #
    # The maximum price you would like to pay for your spot instance.
    # spot_price: "0.085"
    #
    # If a spot instance request can't be fulfilled in 3 minutes, fallback to on-demand instance creation.  If not set,
    # the default is infinite.
    # spot_instance_request_timeout: 180

  digital_ocean:
    # REQUIRED: The Digital Ocean region that you want to use.
    #
    # Options include
    # New York 1
    # Amsterdam 1
    # San Francisco 1
    # New York 2
    # Amsterdam 2
    # Singapore 1
    #
    # These change often.  Check https://www.digitalocean.com/droplets/new for the most up to date options.
    # Default to New York 2 since this is the only region that currently supports private networking
    region: New York 2

    # REQUIRED: The image name and type for creating instances.
    image_id: 14.04 x64
    image_type: 512MB

    # Optionally enable private networking for your instances.
    # This is currently only supported in New York 2.
    private_networking: true

  # Use an alternate cloud provider supported by fog.  This doesn't fully work
  # yet due to differences in providers within fog, but gives you a starting
  # point for contributing a new provider to rubber.  See rubber/lib/rubber/cloud(.rb)
  fog:
    credentials:
      provider: rackspace
      rackspace_api_key: 'XXX'
      rackspace_username: 'YYY'
    image_type: 123
    image_id: 123

# REQUIRED the cloud provider to use
#
cloud_provider: aws

# OPTIONAL: Where to store instance data.
#
# Allowed forms are:
# filesystem: "file:#{Rubber.root}/config/rubber/instance-#{Rubber.env}.yml"
# cloud storage (s3): "storage:#{cloud_providers.aws.backup_bucket}/RubberInstances_#{app_name}/instance-#{Rubber.env}.yml"
# cloud table (simpledb): "table:RubberInstances_#{app_name}_#{Rubber.env}"
#
# If you need to port between forms, load the rails console then:
# Rubber.instances.save(location)
# where location is one of the allowed forms for this variable
#
# instance_storage: "file:#{Rubber.root}/config/rubber/instance-#{Rubber.env}.yml"

# OPTIONAL: Where to store a backup of the instance data
#
# This is most useful when using a remote store in case you end up
# wiping the single copy of your instance data.  When using the file
# store, the instance file is typically under version control with
# your project code, so that provides some safety.
#
# instance_storage_backup: "storage:#{cloud_providers.aws.backup_bucket}/RubberInstances_#{app_name}/instance-#{Rubber.env}-#{Time.now.strftime('%Y%m%d-%H%M%S')}.yml"

# OPTIONAL: Default ports for security groups
web_port: 80
web_ssl_port: 443
web_tools_port: 8080
web_tools_ssl_port: 8443

# OPTIONAL: Define security groups
# Each security group is a name associated with a sequence of maps where the
# keys are the parameters to the ec2 AuthorizeSecurityGroupIngress API
# source_security_group_name, source_security_group_owner_id
# ip_protocol, from_port, to_port, cidr_ip
# If you want to use a source_group outside of this project, add "external_group: true"
# to prevent group_isolation from mangling its name, e.g.  to give access to graphite
# server to other projects
#
# security_groups:
#   graphite_server:
#     description: The graphite_server security group to allow projects to send graphite data
#     rules:
#       - source_group_name: yourappname_production_collectd
#         source_group_account: 123456
#         external_group: true
#         protocol: tcp
#         from_port: "#{graphite_server_port}"
#         to_port: "#{graphite_server_port}"
#
security_groups:
  default:
    description: The default security group
    rules:
      - source_group_name: default
        source_group_account: "#{cloud_providers.aws.account}"
      - protocol: tcp
        from_port: 22
        to_port: 22
        source_ips: [0.0.0.0/0]
  web:
    description: "To open up port #{web_port}/#{web_ssl_port} for http server on web role"
    rules:
      - protocol: tcp
        from_port: "#{web_port}"
        to_port: "#{web_port}"
        source_ips: [0.0.0.0/0]
      - protocol: tcp
        from_port: "#{web_ssl_port}"
        to_port: "#{web_ssl_port}"
        source_ips: [0.0.0.0/0]
  web_tools:
    description: "To open up port #{web_tools_port}/#{web_tools_ssl_port} for internal/tools http server"
    rules:
      - protocol: tcp
        from_port: "#{web_tools_port}"
        to_port: "#{web_tools_port}"
        source_ips: [0.0.0.0/0]
      - protocol: tcp
        from_port: "#{web_tools_ssl_port}"
        to_port: "#{web_tools_ssl_port}"
        source_ips: [0.0.0.0/0]

# OPTIONAL: The default security groups to create instances with
assigned_security_groups: [default]
roles:
  web:
    assigned_security_groups: [web]
  web_tools:
    assigned_security_groups: [web_tools]

# OPTIONAL: Automatically create security groups for each host and role
# EC2 Classic doesn't allow one to change what groups an instance belongs to after
# creation, so it's good to have some empty ones predefined.  EC2 with VPC, however,
# does allow changing security groups after instance creation and allows far fewer
# security groups per instance, so you shouldn't enable this setting if using VPC.
auto_security_groups: false

# OPTIONAL: Automatically isolate security groups for each appname/environment
# by mangling their names to be appname_env_groupname
# This makes it safer to have staging and production coexist on the same EC2
# account, or even multiple apps.  NB: due to the security group limits per instance
# in EC2 with VPCs, this option should only be enabled if you're using EC2 Classic.
isolate_security_groups: false

# OPTIONAL: Prompts one to sync security group rules when the ones in amazon
# differ from those in rubber
prompt_for_security_group_sync: true

# OPTIONAL: A list of CIDR address blocks that represent private networks for your cluster.
# Set this to open up wide access to hosts in your network.  Consequently, setting the CIDR block
# to anything other than a private, unroutable block would be a massive security hole.
private_networks: [10.0.0.0/8]

# OPTIONAL: The packages to install on all instances
# You can install a specific version of a package by using a sub-array of pkg, version
# For example, packages: [[rake, 0.7.1], irb]
packages: [postfix, build-essential, git-core, libxslt-dev, ntp]

# OPTIONAL: The package manager mirror to use for installation of primary packages (i.e., those not explicitly
# sourced from a different repository).  If not specified, whatever mirror configured by your server image
# will be used.
#
# Note that Ubuntu has a special URL that can be used to auto-select the mirror based upon geoip.  To use
# it, specify 'mirror://mirrors.ubuntu.com/mirrors.txt' as the value.
# package_manager_mirror: 'mirror://mirrors.ubuntu.com/mirrors.txt'

# OPTIONAL: The command used to identify your particular OS version.  This will be used for configurations
# in Rubber templates that are parameterized by OS version (e.g., package lists).  If not specified, Ubuntu
# will be assumed.
os_version_cmd: 'lsb_release -sr'

# OPTIONAL: gem sources to setup for rubygems
# gemsources: ["https://rubygems.org"]

# OPTIONAL: The gems to install on all instances
# You can install a specific version of a gem by using a sub-array of gem, version
# For example, gem: [[rails, 4.2.1], bundler]
gems: [bundler, [rubber, "#{Rubber.version}"]]

# OPTIONAL: A string prepended to shell command strings that cause multi
# statement shell commands to fail fast.  You may need to comment this out
# on some platforms, but it works for me on linux/osx with a bash shell
#
stop_on_error_cmd: "function error_exit { exit 99; }; trap error_exit ERR"

# OPTIONAL: The default set of roles to use when creating a staging instance
# with "cap rubber:create_staging".  By default this uses all the known roles,
# excluding slave roles, but this is not always desired for staging, so you can
# specify a different set here
#
# staging_roles: "web,app,db:primary=true"
# Auto detect staging roles
staging_roles: "#{known_roles.reject {|r| r =~ /slave/ || r =~ /^db$/ }.join(',')}"

# OPTIONAL: Lets one assign amazon elastic IPs (static IPs) to your instances
#           You should typically set this on the role/host level rather than
#           globally , unless you really do want all instances to have a
#           static IP
#
# use_static_ip: true

# OPTIONAL: Specifies an instance to be created in the given availability zone
#           Availability zones are sepcified by amazon to be somewhat isolated
#           from each other so that hardware failures in one zone shouldn't
#           affect instances in another.  As such, it is good to specify these
#           for instances that need to be redundant to reduce your chance of
#           downtime. You should typically set this on the role/host level
#           rather than globally.  Use cap rubber:describe_zones to see the list
#           of zones
# availability_zone: us-east-1a

# OPTIONAL: If you want to use Elastic Block Store (EBS) persistent
# volumes, add them to host specific overrides and they will get created
# and assigned to the instance.  On initial creation, the volume will get
# attached _and_ formatted, but if your host disappears and you recreate
# it, the volume will only get remounted thereby preserving your data
#
# hosts:
#   my_host:
#     availability_zone: us-east-1a
#     volumes:
#       - size: 100 # size of vol in GBs
#         zone: us-east-1a # zone to create volume in, needs to match host's zone
#         device: /dev/sdh # OS device to attach volume to
#         mount: /mnt/mysql # The directory to mount this volume to
#         filesystem: ext4 # the filesystem to create on volume
#
#         # OPTIONAL: Provide fog-specific options directly.  This should only be used if you need a special setting that
#         # Rubber does not directly expose.  Since these settings will be passed directly through to fog, we can't make any
#         # guarantee about how they work (if fog renames an attribute, e.g., your config will break).  Please see the fog
#         # source code for the option names.
#         fog_options:
#           type: gp2 # type of volume, standard (EBS magnetic), io1 (provisioned IOPS - SSD), or gp2 (general purpose - SSD).
#           iops: 500 # The number of I/O operations per second (IOPS) that the volume supports.
#                     # Required when the volume type is io1; not used with non-provisioned IOPS volumes.
#       - size: 10
#         zone: us-east-1a
#         device: /dev/sdi
#         mount: /mnt/logs
#         filesystem: ext4
#         fog_options:
#           type: io1
#           iops: 500
#
#       # volumes without mount/filesystem can be used in raid arrays
#
#       - size: 50
#         zone: us-east-1a
#         device: /dev/sdx
#         fog_options:
#           type: gp2
#           iops: 500
#       - size: 50
#         zone: us-east-1a
#         device: /dev/sdy
#         fog_options:
#           type: gp2
#           iops: 500
#
#    # Use some ephemeral volumes for raid array
#    local_volumes:
#      - partition_device: /dev/sdb
#        zero: false # zeros out disk for improved performance
#      - partition_device: /dev/sdc
#        zero: false # zeros out disk for improved performance
#
#     # for raid array, you'll need to add mdadm to packages.  Likewise,
#     # xfsprogs is needed for xfs filesystem support
#     #
#     packages: [xfsprogs, mdadm]
#     raid_volumes:
#       - device: /dev/md0 # OS device to to create raid array on
#         mount: /mnt/fast # The directory to mount this array to
#         mount_opts: 'nobootwait' # Recent Ubuntu versions require this flag or SSH will not start on reboot
#         filesystem: xfs # the filesystem to create on array
#         filesystem_opts: -f # the filesystem opts in mkfs
#         raid_level: 0 # the raid level to use for the array
#         # if you're using Ubuntu 11.x or later (Natty, Oneiric, Precise, etc)
#         # you will want to specify the source devices in their /dev/xvd format
#         # see https://bugs.launchpad.net/ubuntu/+source/linux/+bug/684875 for
#         # more information.
#         # NOTE: Only make this change for raid source_devices, NOT generic
#         # volume commands above.
#         source_devices: [/dev/sdx, /dev/sdy] # the source EBS devices we are creating raid array from (Ubuntu Lucid or older)
#         source_devices: [/dev/xvdx, /dev/xvdy] # the source EBS devices we are creating raid array from (Ubuntu Natty or newer)
#
#     # for LVM volumes, you'll need to add lvm2 to packages.  Likewise,
#     # xfsprogs is needed for xfs filesystem support
#     packages: [xfsprogs, lvm2]
#     lvm_volume_groups:
#       - name: vg # The volume group name
#         physical_volumes: [/dev/sdx, /dev/sdy] # Devices used for LVM group (you can use just one, but you can't stripe then)
#         extent_size: 32 # Size of the volume extent in MB
#         volumes:
#           - name: lv # Name of the logical volume
#             size: 999.9 # Size of volume in GB (slightly less than sum of all physical volumes because LVM reserves some space)
#             stripes: 2 # Count of stripes for volume
#             filesystem: xfs # The filesystem to create on the logical volume
#             filesystem_opts: -f # the filesystem opts in mkfs
#             mount: /mnt/large_work_dir # The directory to mount this LVM volume to

# OPTIONAL: You can also define your own variables here for use when
# transforming config files, and they will be available in your config
# templates as  <%%= rubber_env.var_name %>
#
# var_name: var_value

# All variables can also be overridden on the role, environment and/or host level by creating
# a sub level to the config under roles, environments and hosts.  The precedence is host, environment, role
# e.g. to install mysql only on db role, and awstats only on web01:

# OPTIONAL: Role specific overrides
# roles:
#   somerole:
#     packages: []
#   somerole2:
#     myconfig: someval

# OPTIONAL: Environment specific overrides
# environments:
#   staging:
#     myconfig: otherval
#   production:
#     myconfig: val

# OPTIONAL: Host specific overrides
# hosts:
#   somehost:
#     packages: []
#必填项:应用程序的名称
应用程序名称:iaw2015
#必需:系统用户,以其身份运行应用程序服务器
app\u用户:app
#必需:通知电子邮件(如monit)发送到此地址
#
管理员电子邮件:“root@{full_host}”
#可选:如果未设置,您将无法访问web\u工具
#服务器(graphite、graylog、monit状态、haproxy状态等)
#网络工具用户:管理员
#网络工具密码:sekret
#必需:服务器应位于的时区
时区:美国/东部
#必需:所有实例都应关联的域
#
域名:foo.com
#可选:有关dns配置,请参阅ruber-dns.yml
#这使rubber可以使用实例别名更新动态dns服务
#和创建时的ip。它还允许设置任意
#dns记录(CNAME、MX、循环dns等)
#可选:如果存在,则从中提取配置的附加橡胶文件。此文件将
#也可以推送到位于Rubber.root/config/Rubber/Rubber-secret.yml的远程主机
#
#rubber_secret:“#{File.expand_path('~'+'/.ec2'+(rubber.env=='production'?'':''u dev')+'/rubber secret.yml'rescue'rubber secret.yml'}”
#可选:用于将ruber-secret.yml的内容与“ruber-util:obfuscation”混淆的加密密钥
#如果存储在这里,效果并没有那么好,但是您可以在这里使用ruby代码片段从密钥服务器或其他地方获取它
#
#橡皮密匙:“xxxyy=”
#需要所有已知的云提供商以及配置它们所需的设置
#目前只有一个可用的云提供商——Amazon Web服务
#要实现另一个,请克隆lib/rubber/cloud/aws.rb或创建fog提供程序
#以一般的方式工作
#
云计算提供商:
美国焊接学会:
#需要您要使用的AWS区域。
#
#选择包括
#亚太(东京)地区
#亚太(新加坡)地区
#亚太(悉尼)地区
#欧盟-西部-1#欧盟(爱尔兰)地区
#南美洲(圣保罗)地区
#美国东部-1#美国东部(北弗吉尼亚)地区
#美国西部-1#美国西部(北加利福尼亚)地区
#美国西部-2#美国西部(俄勒冈州)地区
#
地区:美国东部1
#需要用于访问AWS API的amazon密钥和帐户ID(仅数字,无破折号)
#
访问密钥:#myaccesskey
秘密访问密钥:#我的秘密访问密钥
账户:#我的账户
#必需:amazon密钥对的名称及其私钥的位置
#
#注意:由于某些原因,Capistrano要求您同时拥有公共和
#同一文件夹中的私钥,公钥应具有
#扩展名“.pub”。最简单的方法就是创建
#私钥中的公钥:ssh-keygen-y-f gsg-keypair>gsg-keypair.pub
#
密钥名称:gsg密钥对
key_file:“#{Dir[(file.expand_path('~')rescue'/root')+'/.ec2/*'+cloud_providers.aws.key_name].first}”
#可选:需要使用ruber:bundle绑定正在运行的实例
#
#pk_文件:“#{Dir[(file.expand_path('~')rescue'/root')+'/.ec2/pk-*'].first}”
#证书文件:“{Dir[(file.expand_path('~')rescue'/root')+'/.ec2/cert-*'].first}”
#image_bucket:“#{app_name}-images”
#可选:需要将数据库备份到s3
#备份桶:“#{app_name}-备份”
#可选:定义要部署到的VPC。别名可以看作是一个
#唯一的橡胶专用Id。如果缺少vpc_别名和vpc_地址,则橡胶
#而是假设我们正在部署到EC2 Classic
#vpc_别名:“{app_name}{ruber.env=='production'?'production':'development'}”
#vpc_cidr:10.0.0.0/16
#VPC通常有两个子网-一个子网用于需要
#直接internet连接(负载平衡器等),一个用于实例
#但事实并非如此(数据库服务器、应用程序服务器等)。至少,
#我们需要一个公共子网。Rubber将检测实例的私有nic
#配置,并根据需要自动创建子网。上面有任何实例吗
#公用子网将需要以下配置。也是
#需要注意的是,AWS VPC子网是特定于可用性区域的,
#这意味着您可能需要为您的应用程序指定一个可用区域
#例如。您还必须为每个子网指定不同的子网cidr
#可用性区域,因为子网不能重叠。
#私人电话:
#子网cidr:'10.0.0.0/24'
#网关:公共
#对于专用子网,您需要在中配置nat_网关实例
#公共子网,以便机器仍然可以访问外部世界进行访问
#比如软件更新。配置NAT网关后,您可以
#设置一个单独的专用子网。您还需要设置:网关
#中nat网关的完整主机名的Capistrano配置值
#以与专用子网上的实例通信。实例
#位于专用子网上的将需要以下配置
#私人电话:
#子网cidr:'10.0.1.0/24'
#网关:“#{ruber_instances.for_role('nat_gateway')。first.instance_id}”
#必需:用于创建实例的ami和实例类型
#Ubuntu图片在http://old.alestic.com/ 工作顺利
#Ubuntu 14.04.1可靠实例存储64位:ami-92f569fa
#
#m1.small或m1.large或m1.xlarge
图像类型:t2.micro
# REQUIRED: The name of your application
app_name: iaw2015

# REQUIRED: The system user to run your app servers as
app_user: app

# REQUIRED: Notification emails (e.g. monit) get sent to this address
#
admin_email: "root@#{full_host}"

# OPTIONAL: If not set, you won't be able to access web_tools
# server (graphite, graylog, monit status, haproxy status, etc)
# web_tools_user: admin
# web_tools_password: sekret

# REQUIRED: The timezone the server should be in
timezone: US/Eastern

# REQUIRED: the domain all the instances should be associated with
#
domain: foo.com

# OPTIONAL: See rubber-dns.yml for dns configuration
# This lets rubber update a dynamic dns service with the instance alias
# and ip when they are created.  It also allows setting up arbitrary
# dns records (CNAME, MX, Round Robin DNS, etc)

# OPTIONAL: Additional rubber file to pull config from if it exists.  This file will
# also be pushed to remote host at Rubber.root/config/rubber/rubber-secret.yml
#
# rubber_secret: "#{File.expand_path('~') + '/.ec2' + (Rubber.env == 'production' ? '' : '_dev') + '/rubber-secret.yml' rescue 'rubber-secret.yml'}"

# OPTIONAL: Encryption key that was used to obfuscate the contents of rubber-secret.yml with "rubber util:obfuscation" 
# Not that much better when stored in here, but you could use a ruby snippet in here to fetch it from a key server or something
#
# rubber_secret_key: "XXXyyy=="

# REQUIRED All known cloud providers with the settings needed to configure them
# There's only one working cloud provider right now - Amazon Web Services
# To implement another, clone lib/rubber/cloud/aws.rb or make the fog provider 
# work in a generic fashion
#
cloud_providers:
  aws:
    # REQUIRED The AWS region that you want to use.
    #
    # Options include
    # ap-northeast-1 # Asia Pacific (Tokyo) Region
    # ap-southeast-1 # Asia Pacific (Singapore) Region
    # ap-southeast-2 # Asia Pacific (Sydney) Region
    # eu-west-1      # EU (Ireland) Region
    # sa-east-1      # South America (Sao Paulo) Region
    # us-east-1      # US East (Northern Virginia) Region
    # us-west-1      # US West (Northern California) Region
    # us-west-2      # US West (Oregon) Region
    #
    region: us-east-1

    # REQUIRED The amazon keys and account ID (digits only, no dashes) used to access the AWS API
    #
    access_key: #myaccesskey
    secret_access_key: #Mysecretaccesskey
    account: #myaccount

    # REQUIRED:  The name of the amazon keypair and location of its private key
    #
    # NOTE: for some reason Capistrano requires you to have both the public and
    # the private key in the same folder, the public key should have the
    # extension ".pub".  The easiest way to get your hand on this is to create the
    # public key from the private key: ssh-keygen -y -f gsg-keypair > gsg-keypair.pub
    #
    key_name: gsg-keypair
    key_file: "#{Dir[(File.expand_path('~') rescue '/root') + '/.ec2/*' + cloud_providers.aws.key_name].first}"

    # OPTIONAL: Needed for bundling a running instance using rubber:bundle
    #
    # pk_file: "#{Dir[(File.expand_path('~') rescue '/root') + '/.ec2/pk-*'].first}"
    # cert_file: "#{Dir[(File.expand_path('~') rescue '/root') + '/.ec2/cert-*'].first}"
    # image_bucket: "#{app_name}-images"

    # OPTIONAL: Needed for backing up database to s3
    # backup_bucket: "#{app_name}-backups"

    # OPTIONAL: Define a VPC to deploy to. The alias can be thought of as a
    # unique Rubber-specific Id.  If vpc_alias and vpc_addr are absent, Rubber
    # will instead assume we're deploying to EC2 Classic
    # vpc_alias: "#{app_name}_#{Rubber.env == 'production' ? 'production' : 'development'}"
    # vpc_cidr: 10.0.0.0/16

    # VPCs will typically have two subnets - one for instances that need a
    # direct internet connection (load balancers, etc.), and one for instances
    # that don't (database servers, app servers, etc.).  At the very least,
    # we'll need a public subnet.  Rubber will detect the instance's private_nic
    # configuration, and auto-create a subnet if appropriate.  Any instances on
    # the public subnet will need the following configuration.  It is also
    # important to note that AWS VPC Subnets are availability zone-specific,
    # meaning you probably want to specify an availability zone for your
    # instance.  You will also have to specify a different subnet_cidr for each
    # availability zone, since subnets cannot overlap.
    # private_nic:
    #   subnet_cidr: '10.0.0.0/24'
    #   gateway: public

    # For a private subnet, you will need to configure a nat_gateway instance in
    # the public subnet so that machines can still reach the outside world for
    # things like software updates.  After configuring a NAT gateway, you can
    # set up a separate private subnet.  You will also need to set your :gateway
    # Capistrano configuration value to the full hostname of the nat gateway in
    # order to communicate with instances on private subnets.  Instances which
    # are on a private subnet will need the following configuration
    #  private_nic:
    #    subnet_cidr: '10.0.1.0/24'
    #    gateway: "#{rubber_instances.for_role('nat_gateway').first.instance_id}"

    # REQUIRED: the ami and instance type for creating instances
    # The Ubuntu images at http://old.alestic.com/ work well
    # Ubuntu 14.04.1 Trusty instance-store 64-bit: ami-92f569fa
    #
    # m1.small or m1.large or m1.xlarge
    image_type: t2.micro
    image_id: ami-60b6c60a

    # OPTIONAL: Provide fog-specific options directly.  This should only be used if you need a special setting that
    # Rubber does not directly expose.  Since these settings will be passed directly through to fog, we can't make any
    # guarantee about how they work (if fog renames an attribute, e.g., your config will break).  Please see the fog
    # source code for the option names.
    # fog_options:
      # EBS I/O optimized instance
      # EBS-optimized instances deliver dedicated throughput between Amazon EC2 and Amazon EBS, with options
      # between 500 Mbps and 1000 Mbps depending on the instance type used.
      # Read more and make sure that your image_type supports ebs_optimized function at: http://aws.amazon.com/ec2/instance-types/
      # ebs_optimized: false

    # OPTIONAL: EC2 spot instance request support.
    #
    # Enables the creation of spot instance requests.  Rubber will wait synchronously until the request is fulfilled,
    # at which point it will begin initializing the instance, unless spot_instance_request_timeout is set.
    # spot_instance: true
    #
    # The maximum price you would like to pay for your spot instance.
    # spot_price: "0.085"
    #
    # If a spot instance request can't be fulfilled in 3 minutes, fallback to on-demand instance creation.  If not set,
    # the default is infinite.
    # spot_instance_request_timeout: 180

  digital_ocean:
    # REQUIRED: The Digital Ocean region that you want to use.
    #
    # Options include
    # New York 1
    # Amsterdam 1
    # San Francisco 1
    # New York 2
    # Amsterdam 2
    # Singapore 1
    #
    # These change often.  Check https://www.digitalocean.com/droplets/new for the most up to date options.
    # Default to New York 2 since this is the only region that currently supports private networking
    region: New York 2

    # REQUIRED: The image name and type for creating instances.
    image_id: 14.04 x64
    image_type: 512MB

    # Optionally enable private networking for your instances.
    # This is currently only supported in New York 2.
    private_networking: true

  # Use an alternate cloud provider supported by fog.  This doesn't fully work
  # yet due to differences in providers within fog, but gives you a starting
  # point for contributing a new provider to rubber.  See rubber/lib/rubber/cloud(.rb)
  fog:
    credentials:
      provider: rackspace
      rackspace_api_key: 'XXX'
      rackspace_username: 'YYY'
    image_type: 123
    image_id: 123

# REQUIRED the cloud provider to use
#
cloud_provider: aws

# OPTIONAL: Where to store instance data.
#
# Allowed forms are:
# filesystem: "file:#{Rubber.root}/config/rubber/instance-#{Rubber.env}.yml"
# cloud storage (s3): "storage:#{cloud_providers.aws.backup_bucket}/RubberInstances_#{app_name}/instance-#{Rubber.env}.yml"
# cloud table (simpledb): "table:RubberInstances_#{app_name}_#{Rubber.env}"
#
# If you need to port between forms, load the rails console then:
# Rubber.instances.save(location)
# where location is one of the allowed forms for this variable
#
# instance_storage: "file:#{Rubber.root}/config/rubber/instance-#{Rubber.env}.yml"

# OPTIONAL: Where to store a backup of the instance data
#
# This is most useful when using a remote store in case you end up
# wiping the single copy of your instance data.  When using the file
# store, the instance file is typically under version control with
# your project code, so that provides some safety.
#
# instance_storage_backup: "storage:#{cloud_providers.aws.backup_bucket}/RubberInstances_#{app_name}/instance-#{Rubber.env}-#{Time.now.strftime('%Y%m%d-%H%M%S')}.yml"

# OPTIONAL: Default ports for security groups
web_port: 80
web_ssl_port: 443
web_tools_port: 8080
web_tools_ssl_port: 8443

# OPTIONAL: Define security groups
# Each security group is a name associated with a sequence of maps where the
# keys are the parameters to the ec2 AuthorizeSecurityGroupIngress API
# source_security_group_name, source_security_group_owner_id
# ip_protocol, from_port, to_port, cidr_ip
# If you want to use a source_group outside of this project, add "external_group: true"
# to prevent group_isolation from mangling its name, e.g.  to give access to graphite
# server to other projects
#
# security_groups:
#   graphite_server:
#     description: The graphite_server security group to allow projects to send graphite data
#     rules:
#       - source_group_name: yourappname_production_collectd
#         source_group_account: 123456
#         external_group: true
#         protocol: tcp
#         from_port: "#{graphite_server_port}"
#         to_port: "#{graphite_server_port}"
#
security_groups:
  default:
    description: The default security group
    rules:
      - source_group_name: default
        source_group_account: "#{cloud_providers.aws.account}"
      - protocol: tcp
        from_port: 22
        to_port: 22
        source_ips: [0.0.0.0/0]
  web:
    description: "To open up port #{web_port}/#{web_ssl_port} for http server on web role"
    rules:
      - protocol: tcp
        from_port: "#{web_port}"
        to_port: "#{web_port}"
        source_ips: [0.0.0.0/0]
      - protocol: tcp
        from_port: "#{web_ssl_port}"
        to_port: "#{web_ssl_port}"
        source_ips: [0.0.0.0/0]
  web_tools:
    description: "To open up port #{web_tools_port}/#{web_tools_ssl_port} for internal/tools http server"
    rules:
      - protocol: tcp
        from_port: "#{web_tools_port}"
        to_port: "#{web_tools_port}"
        source_ips: [0.0.0.0/0]
      - protocol: tcp
        from_port: "#{web_tools_ssl_port}"
        to_port: "#{web_tools_ssl_port}"
        source_ips: [0.0.0.0/0]

# OPTIONAL: The default security groups to create instances with
assigned_security_groups: [default]
roles:
  web:
    assigned_security_groups: [web]
  web_tools:
    assigned_security_groups: [web_tools]

# OPTIONAL: Automatically create security groups for each host and role
# EC2 Classic doesn't allow one to change what groups an instance belongs to after
# creation, so it's good to have some empty ones predefined.  EC2 with VPC, however,
# does allow changing security groups after instance creation and allows far fewer
# security groups per instance, so you shouldn't enable this setting if using VPC.
auto_security_groups: false

# OPTIONAL: Automatically isolate security groups for each appname/environment
# by mangling their names to be appname_env_groupname
# This makes it safer to have staging and production coexist on the same EC2
# account, or even multiple apps.  NB: due to the security group limits per instance
# in EC2 with VPCs, this option should only be enabled if you're using EC2 Classic.
isolate_security_groups: false

# OPTIONAL: Prompts one to sync security group rules when the ones in amazon
# differ from those in rubber
prompt_for_security_group_sync: true

# OPTIONAL: A list of CIDR address blocks that represent private networks for your cluster.
# Set this to open up wide access to hosts in your network.  Consequently, setting the CIDR block
# to anything other than a private, unroutable block would be a massive security hole.
private_networks: [10.0.0.0/8]

# OPTIONAL: The packages to install on all instances
# You can install a specific version of a package by using a sub-array of pkg, version
# For example, packages: [[rake, 0.7.1], irb]
packages: [postfix, build-essential, git-core, libxslt-dev, ntp]

# OPTIONAL: The package manager mirror to use for installation of primary packages (i.e., those not explicitly
# sourced from a different repository).  If not specified, whatever mirror configured by your server image
# will be used.
#
# Note that Ubuntu has a special URL that can be used to auto-select the mirror based upon geoip.  To use
# it, specify 'mirror://mirrors.ubuntu.com/mirrors.txt' as the value.
# package_manager_mirror: 'mirror://mirrors.ubuntu.com/mirrors.txt'

# OPTIONAL: The command used to identify your particular OS version.  This will be used for configurations
# in Rubber templates that are parameterized by OS version (e.g., package lists).  If not specified, Ubuntu
# will be assumed.
os_version_cmd: 'lsb_release -sr'

# OPTIONAL: gem sources to setup for rubygems
# gemsources: ["https://rubygems.org"]

# OPTIONAL: The gems to install on all instances
# You can install a specific version of a gem by using a sub-array of gem, version
# For example, gem: [[rails, 4.2.1], bundler]
gems: [bundler, [rubber, "#{Rubber.version}"]]

# OPTIONAL: A string prepended to shell command strings that cause multi
# statement shell commands to fail fast.  You may need to comment this out
# on some platforms, but it works for me on linux/osx with a bash shell
#
stop_on_error_cmd: "function error_exit { exit 99; }; trap error_exit ERR"

# OPTIONAL: The default set of roles to use when creating a staging instance
# with "cap rubber:create_staging".  By default this uses all the known roles,
# excluding slave roles, but this is not always desired for staging, so you can
# specify a different set here
#
# staging_roles: "web,app,db:primary=true"
# Auto detect staging roles
staging_roles: "#{known_roles.reject {|r| r =~ /slave/ || r =~ /^db$/ }.join(',')}"

# OPTIONAL: Lets one assign amazon elastic IPs (static IPs) to your instances
#           You should typically set this on the role/host level rather than
#           globally , unless you really do want all instances to have a
#           static IP
#
# use_static_ip: true

# OPTIONAL: Specifies an instance to be created in the given availability zone
#           Availability zones are sepcified by amazon to be somewhat isolated
#           from each other so that hardware failures in one zone shouldn't
#           affect instances in another.  As such, it is good to specify these
#           for instances that need to be redundant to reduce your chance of
#           downtime. You should typically set this on the role/host level
#           rather than globally.  Use cap rubber:describe_zones to see the list
#           of zones
# availability_zone: us-east-1a

# OPTIONAL: If you want to use Elastic Block Store (EBS) persistent
# volumes, add them to host specific overrides and they will get created
# and assigned to the instance.  On initial creation, the volume will get
# attached _and_ formatted, but if your host disappears and you recreate
# it, the volume will only get remounted thereby preserving your data
#
# hosts:
#   my_host:
#     availability_zone: us-east-1a
#     volumes:
#       - size: 100 # size of vol in GBs
#         zone: us-east-1a # zone to create volume in, needs to match host's zone
#         device: /dev/sdh # OS device to attach volume to
#         mount: /mnt/mysql # The directory to mount this volume to
#         filesystem: ext4 # the filesystem to create on volume
#
#         # OPTIONAL: Provide fog-specific options directly.  This should only be used if you need a special setting that
#         # Rubber does not directly expose.  Since these settings will be passed directly through to fog, we can't make any
#         # guarantee about how they work (if fog renames an attribute, e.g., your config will break).  Please see the fog
#         # source code for the option names.
#         fog_options:
#           type: gp2 # type of volume, standard (EBS magnetic), io1 (provisioned IOPS - SSD), or gp2 (general purpose - SSD).
#           iops: 500 # The number of I/O operations per second (IOPS) that the volume supports.
#                     # Required when the volume type is io1; not used with non-provisioned IOPS volumes.
#       - size: 10
#         zone: us-east-1a
#         device: /dev/sdi
#         mount: /mnt/logs
#         filesystem: ext4
#         fog_options:
#           type: io1
#           iops: 500
#
#       # volumes without mount/filesystem can be used in raid arrays
#
#       - size: 50
#         zone: us-east-1a
#         device: /dev/sdx
#         fog_options:
#           type: gp2
#           iops: 500
#       - size: 50
#         zone: us-east-1a
#         device: /dev/sdy
#         fog_options:
#           type: gp2
#           iops: 500
#
#    # Use some ephemeral volumes for raid array
#    local_volumes:
#      - partition_device: /dev/sdb
#        zero: false # zeros out disk for improved performance
#      - partition_device: /dev/sdc
#        zero: false # zeros out disk for improved performance
#
#     # for raid array, you'll need to add mdadm to packages.  Likewise,
#     # xfsprogs is needed for xfs filesystem support
#     #
#     packages: [xfsprogs, mdadm]
#     raid_volumes:
#       - device: /dev/md0 # OS device to to create raid array on
#         mount: /mnt/fast # The directory to mount this array to
#         mount_opts: 'nobootwait' # Recent Ubuntu versions require this flag or SSH will not start on reboot
#         filesystem: xfs # the filesystem to create on array
#         filesystem_opts: -f # the filesystem opts in mkfs
#         raid_level: 0 # the raid level to use for the array
#         # if you're using Ubuntu 11.x or later (Natty, Oneiric, Precise, etc)
#         # you will want to specify the source devices in their /dev/xvd format
#         # see https://bugs.launchpad.net/ubuntu/+source/linux/+bug/684875 for
#         # more information.
#         # NOTE: Only make this change for raid source_devices, NOT generic
#         # volume commands above.
#         source_devices: [/dev/sdx, /dev/sdy] # the source EBS devices we are creating raid array from (Ubuntu Lucid or older)
#         source_devices: [/dev/xvdx, /dev/xvdy] # the source EBS devices we are creating raid array from (Ubuntu Natty or newer)
#
#     # for LVM volumes, you'll need to add lvm2 to packages.  Likewise,
#     # xfsprogs is needed for xfs filesystem support
#     packages: [xfsprogs, lvm2]
#     lvm_volume_groups:
#       - name: vg # The volume group name
#         physical_volumes: [/dev/sdx, /dev/sdy] # Devices used for LVM group (you can use just one, but you can't stripe then)
#         extent_size: 32 # Size of the volume extent in MB
#         volumes:
#           - name: lv # Name of the logical volume
#             size: 999.9 # Size of volume in GB (slightly less than sum of all physical volumes because LVM reserves some space)
#             stripes: 2 # Count of stripes for volume
#             filesystem: xfs # The filesystem to create on the logical volume
#             filesystem_opts: -f # the filesystem opts in mkfs
#             mount: /mnt/large_work_dir # The directory to mount this LVM volume to

# OPTIONAL: You can also define your own variables here for use when
# transforming config files, and they will be available in your config
# templates as  <%%= rubber_env.var_name %>
#
# var_name: var_value

# All variables can also be overridden on the role, environment and/or host level by creating
# a sub level to the config under roles, environments and hosts.  The precedence is host, environment, role
# e.g. to install mysql only on db role, and awstats only on web01:

# OPTIONAL: Role specific overrides
# roles:
#   somerole:
#     packages: []
#   somerole2:
#     myconfig: someval

# OPTIONAL: Environment specific overrides
# environments:
#   staging:
#     myconfig: otherval
#   production:
#     myconfig: val

# OPTIONAL: Host specific overrides
# hosts:
#   somehost:
#     packages: []