Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Use Vagrant to manage your instances on the Brightbox Cloud

License

NotificationsYou must be signed in to change notification settings

NeilW/vagrant-brightbox

Repository files navigation

This is aVagrant 1.2+ plugin that adds aBrightboxprovider to Vagrant, allowing Vagrant to control and provision servers inthe Brightbox Cloud.

Note: This plugin requires Vagrant 1.2+,

Features

  • Boot Brightbox Cloud servers.
  • SSH into the servers.
  • Provision the servers with any built-in Vagrant provisioner.
  • Minimal synced folder support viarsync.
  • Define region-specific configurations so Vagrant can manage serversin multiple regions.

Usage

Install using standard Vagrant 1.1+ plugin installation methods. Afterinstalling,vagrant up and specify thebrightbox provider. An example isshown below.

$ vagrant plugin install vagrant-brightbox...$ vagrant up --provider=brightbox...

Of course prior to doing this, you'll need to obtain a Brightbox-compatiblebox file for Vagrant.

Quick Start

After installing the plugin (instructions above), select the BrightboxCloud image you want to use and note the id. You can find these usingthe Brightbox CLI or the Cloud GUI in the normal way, or you can view theVagrant image page.

Then add your chosen box to your vagrant installation using theconfig.vm.box tag from your Vagrantfile, e.g.

$ vagrant box add precise32 http://docs.brightbox.com/vagrant/img-mvunm.box

If you have your~/.fog setup to access Brightbox then you can nowbring up your configuration on Brightbox Cloud with:

$ vagrant up --provider=brightbox

Generic Setup

If you don't want to be adding new box files for every type of image onBrightbox Cloud you can shift the configuration into the Vagrantfile byusing thedummy.box Vagrant box file which has no preconfigured defaults.

First add the dummy box to your vagrant installation.

$ vagrant box add dummy http://docs.brightbox.com/vagrant/dummy.box

Then make a Vagrantfile that looks like the following, filling inyour information where necessary along with your choice of image id

Vagrant.configure("2")do |config|config.vm.box="dummy"config.vm.provider:brightboxdo |brightbox,override|brightbox.client_id="YOUR API CLIENT ID"brightbox.secret="YOUR API SECRET"brightbox.image_id="img-q6gc8"override.ssh.username="ubuntu"override.ssh.private_key_path="PATH TO YOUR PRIVATE KEY"endend

Finally runvagrant up --provider=brightbox to build your setup on Brightbox Cloud.

This will start an Ubuntu 12.04 server in the gb1 region withinyour account. And assuming your SSH information was filled in properlywithin your Vagrantfile, SSH and provisioning will work as well.

Instead of having to add your client credentials to each Vagrantfilewe can put them in the Fog configuration file. Create a newfile at~/.fog and add the following:

:default:  :brightbox_client_id: "your_api_client_id"  :brightbox_secret: "your_secret"

Box Format

Every provider in Vagrant must introduce a custom box format. Thisprovider introducesbrightbox boxes. You can view an example box intheexample_box/ directory.

That directory also contains instructions on how to build a box.

The box format is the requiredmetadata.json filealong with aVagrantfile that does default settings for theprovider-specific configuration for this provider.

Box Format Dowloadable Images

You can view thelist of current Vagrant boxfiles on the Brightbox documentationsite.

Configuration

This provider exposes quite a few provider-specific configuration options:

  • client_id - The api access key for accessing Brightbox in the form'cli-xxxxx'
  • secret - The api secret access code for accessing Brightbox
  • image_id - The image id to boot, in the form 'img-xxxxx'
  • zone - The zone within the region to launchthe server. If nil, it will use the default for this account.
  • server_type - The type of server, such as "nano"
  • region - The region to start the server in, such as "gb1"
  • security_groups - An array of security groups for the server.
  • server_build_timeout - The number of seconds to wait for the instanceto become ready on Brightbox Cloud. Defaults to 120 seconds.

If you are the collaborator on a number of accounts you can specifywhich one you want by setting the following options:

  • username - User id in the form 'usr-xxxxx'
  • password - The password for the user id
  • account - Create servers in the context of this account - in the form'acc-xxxxx'

These can be set like typical provider-specific configuration:

Vagrant.configure("2")do |config|# ... other stuffconfig.vm.provider:brightboxdo |brightbox|brightbox.client_id="cli-fooxx"brightbox.secret="barfoobarfoobar"endend

In addition to the above top-level configs, you can use theregion_configmethod to specify region-specific overrides within your Vagrantfile. Notethat the top-levelregion config must always be specified to choose whichregion you want to actually use, however. This looks like this:

Vagrant.configure("2")do |config|# ... other stuffconfig.vm.provider:brightboxdo |brightbox|brightbox.client_id="foo"brightbox.secret="bar"brightbox.region="gb1"# Simply region configbrightbox.region_config"gb1",:image_id=>"img-mvunm"# More comprehensive region configbrightbox.region_config"gb1"do |region|region.image_id="img-mvunm"endendend

The region-specific configurations will override the top-levelconfigurations when that region is used. They otherwise inheritthe top-level configurations, as you would probably expect.

Networks

By default each brightbox is created and mapped to a cloud ip so thatyou can access it over the public network.

However this can exhaust your allocation of cloud ips if you have several servers. Therefore a couple of networking options are supported.

# Switch off cloud ip mapping and access servers over the IPv4 private# network - useful if you are running Vagrant from another cloud server.config.vm.network:private_network# Switch off cloud ip mapping and access servers over IPv6.config.vm.network:public_network,ipv6:true

Synced Folders

There is minimal support for synced folders. Uponvagrant up,vagrant reload, andvagrant provision, the Brightbox provider will usersync (if available) to uni-directionally sync the folder tothe remote machine over SSH.

This is good enough for all built-in Vagrant provisioners (shell,chef, and puppet) to work!

Other Examples

User data

You can specify user data for the server being booted.

Vagrant.configure("2")do |config|# ... other stuffconfig.vm.provider"brightbox"do |brightbox|# Option 1: a single stringbrightbox.user_data="#!/bin/bash\necho 'got user data' > /tmp/user_data.log\necho"# Option 2: use a filebrightbox.user_data=File.read("user_data.txt")endend

Development

To work on thevagrant-brightbox plugin, clone this repository out, and useBundler to get the dependencies:

$ bundle

Once you have the dependencies, verify the unit tests pass withrake:

$ bundle exec rake

If those pass, you're ready to start developing the plugin. You can testthe plugin without installing it into your Vagrant environment by justcreating aVagrantfile in the top level of this directory (it is gitignored)that uses it:

Vagrant.require_plugin"vagrant-brightbox"Vagrant.configure("2")do |config|#Config hereend

and then use bundler to execute Vagrant:

$ bundle exec vagrant up --provider=brightbox

About

Use Vagrant to manage your instances on the Brightbox Cloud

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp