Vagrant is a tool that allows you to create a complete development environment with a single command - saving loads of time and getting you productive sooner.
The Brightbox plugin allows you to create that environment on Brightbox Cloud as easily as you can locally.
Vagrant is available for Mac OS X, Windows, Debian, Ubuntu, Centos, Redhat and Fedora. The installers and packages are available from the vagrant download page.
If you’re running Ubuntu 14.04 Trusty, it’s as easy as installing the official Ubuntu package, like this:
$ sudo apt-get install vagrant
To install the brightbox plugin, you may need the libxml and libxslt dependencies. On Ubuntu and Debian, you can get those like this:
$ sudo apt-get install libxml2-dev libxslt-dev
Then install the plugin:
$ vagrant plugin install vagrant-brightbox Installing the 'vagrant-brightbox' plugin. This can take a few minutes... Installed the plugin 'vagrant-brightbox (0.2.0)'!
Create a new directory for your project, change to it and initialise Vagrant:
$ vagrant init A `Vagrantfile` has been placed in this directory. You are now ready to `vagrant up` your first virtual environment! Please read the comments in the Vagrantfile as well as documentation on `vagrantup.com` for more information on using Vagrant.
Then, create a new API client on your Brightbox account and add the credentials to the
config.vm.provider :brightbox do |brightbox| brightbox.client_id = "cli-abcde" brightbox.secret = "yoursecret" end
You’ll need to have
setup a public ssh key with
Brightbox Cloud so that you can access newly built servers. Then, tell Vagrant to use your private key, by adding this to the
config.ssh.private_key_path = "~/.ssh/yourprivate.key"
Use the Brightbox Vagrant box index to find a box definition. For this example we’ll select an Ubuntu 12.04 Precise image, and add it as the base box:
$ vagrant box add base https://www.brightbox.com/vagrant/img-py9ti.box Downloading box from URL: https://www.brightbox.com/vagrant/img-py9ti.box Extracting box...e: 0/s, Estimated time remaining: --:--:--) Successfully added box 'base' with provider 'brightbox'!
vagrant up to launch a server. The plugin will automatically create a new Cloud IP and map it to the new machine for you, so you can access it over IPv4 straight away (your default firewall policy will need to allow SSH of course, which is the case unless you’ve changed the defaults):
$ vagrant up --provider=brightbox Bringing machine 'default' up with 'brightbox' provider... [default] Launching a server with the following settings [default] -- Image: img-py9ti [default] -- Region: gb1 [default] Waiting for the server to be built... [default] Mapped IPv4 Cloud IP '109.107.xx.xx' to server 'srv-abcde' [default] Waiting for SSH to become available... Enter passphrase for ~/.ssh/yourprivate.key: [default] The server is ready! [default] Rsyncing folder: ~/vagrant/ => /vagrant
For reference, a minimal
Vagrantfile for use with Brightbox looks like this:
Vagrant.configure("2") do |config| config.vm.box = "base" config.vm.box_url = "https://www.brightbox.com/vagrant/img-py9ti.box" config.ssh.private_key_path = "~/.ssh/yourprivate.key" config.vm.provider :brightbox do |brightbox| brightbox.client_id = "cli-abcde" brightbox.secret = "yourclisecret" end end
The vagrant-brightbox plugin code is on Github, feel free contribute!
Last updated: 26 May 2018 at 10:51 UTC