acntech / vagrant-repository

Vagrant Repository for private hosting of Vagrant boxes
Apache License 2.0
7 stars 1 forks source link

How to change ports away from 80? #87

Open salderma opened 4 years ago

salderma commented 4 years ago

Hi, I just started playing with this today and its really cool.

I was setup my docker-compose.yml to attempt to change the port mapping like so: `ports:

config.vm.box_url = "http://mydocker.local:7080/api/vagrant/boxes/mygroup/mybox" is resulting in: default: Downloading: http://mydocker.local/api/vagrant/boxes/mygroup/mybox/19.10.22/virtualbox/image.box

If I hit that api URL in the browser, (with the port) I get json output which has a url with no port number in it.

Also, can you tell me how to setup persistent volumes to store the boxes, I'm not sure I can unwind the app to figure out where a volume needs to be configured.

Thanks!

onlyteo commented 4 years ago

I will try to reproduce your port mapping problem.

By default uploaded boxes are stored in /tmp/vagrant-repository/uploads. I'll find some time to update the documentation.

onlyteo commented 4 years ago

In order to get the Vagrant Repository to return the correct host and port for the download URL you need to set a property for the API. You can set the property using an environment variable like:

SPRING_APPLICATION_JSON={"acntech":{"proxy":{"host":"mydocker.local","port":"7080"}}}

We will register an enhancement so that the URL is relative to the exposed host and port, but is not straight forward since there is a NAT and a reverse proxy between the client and the API. The reverse proxy need to forward the original request URL, so that the API can use this to construct the download URL.