isaaceindhoven / composer-velocita

Project was moved!

Home Page:https://github.com/gmta/composer-velocita

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

access velocita via http localhost

MartinKuhl opened this issue · comments

Hi,
I am trying to access my local velocita (localhost) via http.
To do so I am setting composer config -g secure-http false

When I now try to download the first repo I get the following error:
Failed to retrieve remote config: The "http://localhost/mirrors.json" file could not be downloaded (HTTP/1.1 404 Not Found)

If try to open the file via my browser, the mirrors.json is reachable without any problems.

docker-compose:
velocita:
image: isaaceindhoven/velocita-proxy
volumes:
- './velocita:/var/cache/velocita'
environment:
- MIRROR_PACKAGIST_TYPE=composer
- MIRROR_PACKAGIST_URL=https://repo.packagist.org
ports:
- '80:8080'
container_name: velocita

Hi @MartinKuhl,

Are you executing composer install inside a container or on your local machine?

Hi @gmta I try it inside a container

Your localhost on your machine is probably not the same as localhost in your container. First try composer locally to verify that it's working. Then, find out what you need to connect to from inside the container.

For example, if you use Docker Desktop, you may want to check out this:
https://docs.docker.com/desktop/networking/#i-want-to-connect-from-a-container-to-a-service-on-the-host

You'd connect with host.docker.internal instead of localhost, for example.

I try it as soon as possible, but should 127.0.0.1 address this issue?

No, 127.0.0.1 is the same as localhost after DNS resolution. Please follow the instructions from my previous comment first.

thanks a lot!
Local I have to use composer velocita:enable http://localhost
Within docker I have to use composer velocita:enable http://host.docker.internal
Maybe you can add this to the project documentation.

Hi @MartinKuhl ,

Awesome that you got it to work!

I do not have any documentation for Docker Desktop, that why I always refer to "the URL to your Velocita instance" - you need to figure this out yourself based on the containerization solution you use. Maybe if we add a section about Docker Desktop I could have an example outlining this.