Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to upload box to vagrant cloud for distribution

Tags:

vagrant

I've created a custom Vagrant box by installing additional software on a base box. I now want to distribute this box. I've packaged the custom box using vagrant package.

In following the steps for box creation, I am stuck at the "create provider" stage. The step asks me to name a provider and state its URL. After choosing "virtualbox" as the provider, I'm not sure what it is expecting as a URL. The .box file is on my local machine and I simply want to upload it to Vagrant Cloud where it may be downloaded for use by others. (image below)

Please view the image below

So my question is: Does Vagrant Cloud provide hosting space for the files or is it simply redirecting to the actual hosting site? In other words, is the URL step expecting me to provide link to a VM already uploaded to some hosting site (Git, AWS etc)?

If Vagrant Cloud does provide hosting space, can someone point me to the next step in the process? Specifically, what URL is it expecting?

Thanks

like image 323
RDK Avatar asked May 01 '14 01:05

RDK


People also ask

How do you distribute a vagrant box?

To distribute the box to your team, update your Vagrantfile to reference the box on Vagrant Cloud. Now when a team member runs vagrant up , the box will be downloaded from Vagrant Cloud. If the box is private, the team member will be prompted to authorize access.

Where vagrant boxes are stored?

By default, Vagrant stores its boxes after downloading in the directory defined by VAGRANT_HOME environment variable. As a result, On Mac OS X and Linux: ~/. vagrant.

What is the use of vagrant cloud?

A primary use case of Vagrant Cloud by HashiCorp is to be able to easily find boxes you can use with Vagrant that contain the technologies you need for a Vagrant environment. We've made it extremely easy to do that: Go to the Discover page, and search for any box you want.


3 Answers

I just recently run in to this very same issue and asked the same question from the support. At the time of the writing Vagrant Cloud Beta does not offer box file hosting (this is expected to change very soon). Instead you have to save the box-file somewhere in the internet and provide the url to that location. Note the file can't be behind authentication.

Update 28th May 2014

The following note has appeared to Vagrant Cloud Beta Help-section:

A core part of this service will be hosting of actual box files. This is being tested internally at the time of the beta launch, and will likely be a paid feature due to high bandwidth costs.

The privacy issue is still unaddressed in the Private Boxes-documentation.

Update 30th May 2014

HashiCorp has announced yesterday the end of Beta and a bunch of new features including box hosting. See their announcement for the details: Vagrant Cloud: Organizations, Box Hosting and the end of Beta.

like image 58
user272735 Avatar answered Nov 12 '22 17:11

user272735


From Atlas Documentation:

Creating Boxes with the API

This example uses the Boxes API to upload boxes with curl. To get started, you'll need to get an access token.

Then, prepare the upload:

$ curl 'https://atlas.hashicorp.com/api/v1/box/USERNAME/BOX_NAME/version/VERSION/provider/PROVIDER_NAME/upload?access_token=ACCESS_TOKEN'

This should return something like this:

{
  "upload_path": "https://binstore.hashicorp.com/630e42d9-2364-2412-4121-18266770468e",
  "token": "630e42d9-2364-2412-4121-18266770468e"
}

Then, upload your box with the following command, with the filename in this case being foo.box:

$ curl -X PUT --upload-file foo.box https://binstore.hashicorp.com/630e42d9-2364-2412-4121-18266770468e

When the upload finishes, you can verify it worked by making this request and matching the hosted_token it returns to the previously retrieved upload token.

$ curl 'https://atlas.hashicorp.com/api/v1/box/USERNAME/BOX_NAME/version/VERSION_NUMBER/provider/PROVIDER_NAME?access_token=ACCESS_TOKEN'

Your box should then be available for download.

like image 20
Tiago Lopo Avatar answered Nov 12 '22 17:11

Tiago Lopo


Vagrant Cloud does NOT offer box file hosting (at least not at this stage). Even if it will in future, I doubt that hosting will be free.

Now user can only version vagrant boxes and publish them on Vagrant Cloud using and point to self-hosted URLs.

like image 1
Terry Wang Avatar answered Nov 12 '22 18:11

Terry Wang