lbr38 / repomanager

A web UI to mirror rpm or deb packages repositories.
GNU General Public License v3.0
57 stars 11 forks source link

FQDN using host value #128

Closed Cloud-Kid closed 10 months ago

Cloud-Kid commented 10 months ago

Hi, Using podman-compose and the repomanager container as such :

  # Repomanager - Gestion des repos linux
  repomanager:
    restart: always
    container_name: repomanager
    hostname: repomanager
    environment:
      - FQDN=repomanager.my.fqdn.fr
      - MAX_UPLOAD_SIZE=32M
    ports:
      - '8080:8080'
    volumes:
      - '/etc/localtime:/etc/localtime:ro'
      - './repomanager/repomanager-data:/var/lib/repomanager'
      - './shared/repomanager-repo:/home/repo'
    image: 'lbr38/repomanager:latest'

My FQDN in container is set to my docker host hostname in the GUI : Capture d’écran 2023-11-08 113614

So my clients can't reach the repository URL, but maybe it's only a podman issue.

Edit #1 : If I check the FQDN ENV in container it's correct so it may be a bug : Capture d’écran 2023-11-08 113614

lbr38 commented 10 months ago

Hi

I've never used podman-compose so I can't say for sure, but it does seem like the issue may be related to that.

I've installed Repomanager on multiple servers using the Docker image or docker-compose and I've never encountered this problem.

Can you print the content of /var/www/repomanager/.fqdn inside the container please? This file must exist and contain the desired fqdn.

Cloud-Kid commented 10 months ago

That's strange, if I check the file : Capture d’écran 2023-11-08 143240

Everything looks fine, is there any other file required by it ?

Podman may have some trouble to communicate things from outside the container to the inside but when they are inside the container should run fine. In this case it seems okay but if you never had any problem I may need to reproduce on a docker host to check.

lbr38 commented 10 months ago

Ok wait I found something in the code.

In fact the value of /var/www/repomanager/.fqdn is taken into account during the very first start of the container and is added in the database. But if the content of the file changes, the value is never modified in the database.

I will correct the code to rely only on the value written in the file.

Cloud-Kid commented 10 months ago

Thanks for the heads up ! I though I missed something in the config. Looking forward to the update :D

lbr38 commented 10 months ago

Hi

Just released the new version, can you check if this is all good now?

Cloud-Kid commented 10 months ago

Hey again :D I tried it as soon as you released it ! After a quick docker pull, the URL seems to be updated but not everywhere. For context I'm still trying the software and my goal for now is to setup a repo for debian 9 and update an old testing company server using this tool.

Status for now : The URL seems to have been changed in the internal database and it's updated on the web GUI : Capture d’écran 2023-11-09 142354

I can now click next to the repo URL (Copy button) and paste it in my browser to see the repo is that correct ? If I do this exact operation :

Capture d’écran 2023-11-09 142354

Do you have any idea what can cause that ? it may be a reverse proxy issue but I think that's it more linked to the way the app is handling routing inside.

lbr38 commented 10 months ago

Yes this is because I did not enabled the autoindex directive in the nginx vhost inside the container. The Repos URL is just an information, I should have add a note to indicate it or removed that line maybe..

For security reasons I'm not a big fan of enabling file browsing and with Repomanager you have no reasons to do do so. If you want to browse the repository content, just click on the desired snapshot date you wish to explore:

Untitled

If you want to access the repository from a client and install packages, you can do so by using the installation commands: https://github.com/lbr38/repomanager/wiki/02.-Operations-on-repositories#install-a-repository-on-a-client

Anyway if you really want to enable the files browsing through nginx:

Enter the container:

docker exec -it repomanager-dev /bin/bash

Edit the nginx vhost:

vim /etc/nginx/sites-enabled/repomanager.conf

Go to the very bottom and add the autoindex directive:

location /repo {
    alias $REPOS_DIR;
    autoindex on;
}

Reload nginx

Browse through https://FQDN/repo/ (the final slash is important).

If this is really something you need maybe I could think of adding a new env var that could enable autoindex at the container startup.

Cloud-Kid commented 10 months ago

Wow that's really impressive ! I just tried it on an client host, it works :D I don't need the indexing but I blindly assumed that I could have accessed it, I saw that you put some toughts in the way this app works, I like it ^^ The last issue I have is repo not downloading completely but I will reopen the correct issue.