Discussion:
Github private repo for a DIY VagrantCloud -- is it possible?
Tricia Jenkins
2014-09-05 22:09:35 UTC
Permalink
Hi,

I want to be able to add my boxes as releases in my *private* github repo
and for my collegues to be able to use them by publishing a box catalog.json
file at http://username.github.io/project-name/catalog.json. Is there a
way to add the header type and user/password to the box url used by
'vagrant box add'?

I can see how I would get the release asset's binary content:
curl -u username
"https://api.github.com/repos/username/project/releases/assets/229997" -H
"Accept: application/octet-stream" -o test.box

...but if you don't specify the header media type, github will give you a
metadata json file like:
{
"url":
"https://api.github.com/repos/username/project/releases/assets/229997",
"id": 229997,
"name": "test.box",
"label": null,
"uploader": {
"login": "username",
...
},
"content_type": "application/octet-stream",
"state": "uploaded",
"size": 328396052,
"download_count": 10,
"created_at": "2014-09-05T17:11:10Z",
"updated_at": "2014-09-05T17:11:26Z",
"browser_download_url":
"https://github.com/username/project/releases/download/v0.1.0/test.box"
}

I can verify that it is indeed a viable box:
$ vagrant init testcentos test.box
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.

$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'testcentos'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM:
testvagrant_default_1409945305243_99663
==> default: Fixed port collision for 22 => 2222. Now on port 2201.
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
==> default: Forwarding ports...
default: 22 => 2201 (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2201
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Connection timeout. Retrying...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Checking for host entries
==> default: Mounting shared folders...
default: /vagrant => C:/Development/workspace/testvagrant

My box catalog json looks like this:
{
"name": "username/centos6.5",
"description": "This box contains Centos 6.5.",
"versions": [{
"version": "0.1.0",
"providers": [{
"name": "virtualbox",
"url":
"https://api.github.com/repos/username/project/releases/assets/229997"
}]
}]
}

And fails with
vagrant box add catalog.json
==> box: Loading metadata for box 'catalog.json'
...
==> box: Adding box 'username/centos6.5' (v0.1.0) for provider: virtualbox
box: Downloading:
https://api.github.com/repos/username/project/releases/assets/229997
box:
An error occurred while downloading the remote file. The error
message, if any, is reproduced below. Please fix this error and try
again.

The requested URL returned error: 404 Not Found

I can add my username password to the url -- not something I want to do if
I share this with my collegues -- but the type is still wrong:
... #same as before
box:
The box failed to unpackage properly. Please verify that the box
file you're trying to add is not corrupted and try again. The
output from attempting to unpackage (if any):

bsdtar.EXE: Error opening archive: Unrecognized archive format

Any suggestions would be most appreciated! Has anyone else tried to setup
a sort-of private VagrantCloud?

Thanks,
Tricia
--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/d/optout.
Loading...