project-zot / zot

zot - A scale-out production-ready vendor-neutral OCI-native container image/artifact registry (purely based on OCI Distribution Specification)
https://zotregistry.dev
Apache License 2.0
913 stars 96 forks source link

[Bug]: zot binary builds respond with "404 page not found" #1652

Closed RipperSK closed 1 year ago

RipperSK commented 1 year ago

zot version

v1.4.3-0-g69f0cf6

Describe the bug

steps to reproduce:

1) have clean install of Debian 11:

root@test2:~# cat /etc/os-release 
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"

2) download zot and make it executable

root@test2:~# wget https://github.com/project-zot/zot/releases/download/v1.4.3/zot-linux-amd64 -O /usr/bin/zot
root@test2:~# chmod +x /usr/bin/zot 

3) create most simple config possible and verify it:

root@luna-lite-test2:~# cat /root/zot2-config.json
{
  "distSpecVersion": "1.0.1-dev",
  "storage": {
    "rootDirectory": "/tmp/zot"
  },
  "http": {
    "address": "0.0.0.0",
    "port": "8080"
  },
  "log": {
    "level": "debug"
  }
}
root@luna-lite-test2:~# zot verify /root/zot2-config.json
HTTP port 8080
{"level":"info","time":"2023-07-25T14:46:36+02:00","message":"Config file /root/zot2-config.json is valid"}

3) start zot and try to access the web interface:

root@test2:~# zot serve /root/zot2-config.json
HTTP port 8080
{"level":"info","params":{"distSpecVersion":"1.0.1-dev","GoVersion":"go1.19.3","Commit":"v1.4.3-0-g69f0cf6","ReleaseTag":"v1.4.3","BinaryType":"-sync-search-scrub-metrics-lint","AccessControl":null,"Storage":{"RootDirectory":"/tmp/zot","Dedupe":true,"RemoteCache":false,"GC":true,"Commit":false,"GCDelay":3600000000000,"GCInterval":0,"StorageDriver":null,"CacheDriver":null,"SubPaths":null},"HTTP":{"Address":"0.0.0.0","Port":"8080","AllowOrigin":"","TLS":null,"Auth":{"FailDelay":0,"HTPasswd":{"Path":""},"LDAP":null,"Bearer":null},"RawAccessControl":null,"Realm":"","Ratelimit":null},"Log":{"Level":"debug","Output":"","Audit":""},"Extensions":null},"goroutine":1,"caller":"zotregistry.io/zot/pkg/api/controller.go:119","time":"2023-07-25T14:47:36.005669147+02:00","message":"configuration settings"}
{"level":"info","cpus":16,"max. open files":1048576,"listen backlog":"4096","max. inotify watches":"524288","goroutine":1,"caller":"zotregistry.io/zot/pkg/api/controller.go:110","time":"2023-07-25T14:47:36.006086748+02:00","message":"runtime params"}
{"level":"warn","goroutine":1,"caller":"zotregistry.io/zot/pkg/debug/swagger/swagger_disabled.go:22","time":"2023-07-25T14:47:36.009020226+02:00","message":"skipping enabling swagger because given zot binary doesn't include this feature, please build a binary that does so"}

root@test2:~# curl http://localhost:8080/
404 page not found

same is true for v2.0.0-rc5

To reproduce

steps to reproduce:

1) have clean install of Debian 11:

root@test2:~# cat /etc/os-release 
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"

2) download zot and make it executable

root@test2:~# wget https://github.com/project-zot/zot/releases/download/v1.4.3/zot-linux-amd64 -O /usr/bin/zot
root@test2:~# chmod +x /usr/bin/zot 

3) create most simple config possible and verify it:

root@luna-lite-test2:~# cat /root/zot2-config.json
{
  "distSpecVersion": "1.0.1-dev",
  "storage": {
    "rootDirectory": "/tmp/zot"
  },
  "http": {
    "address": "0.0.0.0",
    "port": "8080"
  },
  "log": {
    "level": "debug"
  }
}
root@luna-lite-test2:~# zot verify /root/zot2-config.json
HTTP port 8080
{"level":"info","time":"2023-07-25T14:46:36+02:00","message":"Config file /root/zot2-config.json is valid"}

3) start zot and try to access the web interface:

root@test2:~# zot serve /root/zot2-config.json
HTTP port 8080
{"level":"info","params":{"distSpecVersion":"1.0.1-dev","GoVersion":"go1.19.3","Commit":"v1.4.3-0-g69f0cf6","ReleaseTag":"v1.4.3","BinaryType":"-sync-search-scrub-metrics-lint","AccessControl":null,"Storage":{"RootDirectory":"/tmp/zot","Dedupe":true,"RemoteCache":false,"GC":true,"Commit":false,"GCDelay":3600000000000,"GCInterval":0,"StorageDriver":null,"CacheDriver":null,"SubPaths":null},"HTTP":{"Address":"0.0.0.0","Port":"8080","AllowOrigin":"","TLS":null,"Auth":{"FailDelay":0,"HTPasswd":{"Path":""},"LDAP":null,"Bearer":null},"RawAccessControl":null,"Realm":"","Ratelimit":null},"Log":{"Level":"debug","Output":"","Audit":""},"Extensions":null},"goroutine":1,"caller":"zotregistry.io/zot/pkg/api/controller.go:119","time":"2023-07-25T14:47:36.005669147+02:00","message":"configuration settings"}
{"level":"info","cpus":16,"max. open files":1048576,"listen backlog":"4096","max. inotify watches":"524288","goroutine":1,"caller":"zotregistry.io/zot/pkg/api/controller.go:110","time":"2023-07-25T14:47:36.006086748+02:00","message":"runtime params"}
{"level":"warn","goroutine":1,"caller":"zotregistry.io/zot/pkg/debug/swagger/swagger_disabled.go:22","time":"2023-07-25T14:47:36.009020226+02:00","message":"skipping enabling swagger because given zot binary doesn't include this feature, please build a binary that does so"}

root@test2:~# curl http://localhost:8080/
404 page not found

same is true for v2.0.0-rc5

Expected behavior

working web interface

Screenshots

No response

Additional context

No response

andaaron commented 1 year ago

Hi @RipperSK, are you referring to the OCI dist spec API, or the UI which we intend to include in 2.0? The dist spec API is accessible under /v2. In 2.0 the UI is served on /, but it needs to be enabled in the config first.

For example http://localhost:8080/v2/_catalog to get the list of repos using the API.

RipperSK commented 1 year ago

image There's a web interface for zot registry that displays most popular and recently uploaded images.

I was able to make it work via helm deployment into k3s kubernetes, however I'm unable to access it while running the stand-alone binary. I suppose it's in version v2.0.0-rc5 as this is the version that helm values reference by default.

Furthermore there are many breaking changes between v1.4.3 and v2.0.0-rc5 config.json files making it very difficult to switch between these versions. Also - If zot is "production ready" on version v1.4.3 then why does the helm chart reference v2.0.0-rc5 ?

Is it possible to provide helm values for v1.4.3 and a config.json example for htpasswd auth ?

Thanks.

andaaron commented 1 year ago

Hi @RipperSK, the UI is introduced in v2.0.0, and is not available in v1.4.3. We are still working on fixing some bugs and changing some of the endpoints the UI is currently leveraging. For UI side please use v2.0.0-rc6 for now.

v2.0.0

With regards to UI configuration, right now in RC6 you would need a config similar to this one:

{
    "distSpecVersion": "1.1.0-dev",
    "storage": {
        "rootDirectory": "<path_on_your_disk_to_root_dir>
    },
    "http": {
        "auth": {
          "htpasswd": {
            "path": "<path_on_disk_to_htpasswd_file>"
          }
        },
        "accessControl": {
            "repositories": {
                "**": {
                   "policies": [
                        {
                            "users": [
                                "<user1>","<user2>"
                            ],
                            "actions": [
                                "read",
                                "create",
                                "update",
                                "delete"
                            ]
                        }
                    ]
                }
            }
        },
        "address": "0.0.0.0",
        "port": "8080",
        "realm": "zot"
    },
    "log": {
        "level": "info"
    },
    "extensions": {
        "search": {
            "enable": true,
            "cve": {
                "updateInterval": "2h"
            }
        },
        "metrics": {
            "enable": true
        },
        "ui": {
            "enable": true
        },
        "mgmt": {
            "enable": true
        }
    }
}

You will have to create htpasswd file and reference it in this config. See https://zotregistry.io/v1.4.3/articles/authn-authz/#htpasswd and add your users there. For permissions, see the zot config above.

v1.4.3

@Andreea-Lupu can you please provide the details for the helm chart?

Andreea-Lupu commented 1 year ago

Hi @RipperSK , regarding the helm chart, if you want to install the one which uses zot v1.4.3 you should install it using this command helm install zot project-zot/zot --version 0.1.16(this version uses this default config https://zotregistry.io/v1.4.3/install-guides/install-guide-k8s/#edit-the-zot-configuration-file). Also, if you want to see all helm charts and their zot version you could use this command helm search repo project-zot -l and the output will look like this:

NAME            CHART VERSION   APP VERSION     DESCRIPTION
project-zot/zot 0.1.23          v2.0.0-rc5      A Helm chart for Kubernetes
project-zot/zot 0.1.22          v2.0.0-rc4      A Helm chart for Kubernetes
project-zot/zot 0.1.21          v2.0.0-rc4      A Helm chart for Kubernetes
project-zot/zot 0.1.20          v2.0.0-rc4      A Helm chart for Kubernetes
project-zot/zot 0.1.19          v2.0.0-rc3      A Helm chart for Kubernetes
project-zot/zot 0.1.18          v2.0.0-rc2      A Helm chart for Kubernetes
project-zot/zot 0.1.17          v2.0.0-rc1      A Helm chart for Kubernetes
project-zot/zot 0.1.16          v1.4.3          A Helm chart for Kubernetes
project-zot/zot 0.1.15          v1.4.3-rc9      A Helm chart for Kubernetes
project-zot/zot 0.1.14          v1.4.3-rc8      A Helm chart for Kubernetes
project-zot/zot 0.1.13          v1.4.3-rc7      A Helm chart for Kubernetes
project-zot/zot 0.1.12          v1.4.3-rc6      A Helm chart for Kubernetes
project-zot/zot 0.1.11          v1.4.3-rc5      A Helm chart for Kubernetes
project-zot/zot 0.1.10          v1.4.3-rc4      A Helm chart for Kubernetes
project-zot/zot 0.1.9           v1.4.3-rc3      A Helm chart for Kubernetes
project-zot/zot 0.1.8           v1.4.3-rc2      A Helm chart for Kubernetes
project-zot/zot 0.1.7           v1.4.3-rc1      A Helm chart for Kubernetes
project-zot/zot 0.1.6           v1.4.2          A Helm chart for Kubernetes
project-zot/zot 0.1.5           v1.4.2-rc6      A Helm chart for Kubernetes
project-zot/zot 0.1.4           v1.4.2-rc5      A Helm chart for Kubernetes
project-zot/zot 0.1.3           v1.4.2-rc4      A Helm chart for Kubernetes
project-zot/zot 0.1.2           v1.4.2-rc3      A Helm chart for Kubernetes
project-zot/zot 0.1.1           v1.4.2-rc3      A Helm chart for Kubernetes
project-zot/zot 0.1.0           v1.4.1          A Helm chart for Kubernetes

then you can choose and use the one that you need.

You can find more details about installing zot using helm here https://zotregistry.io/v1.4.3/install-guides/install-guide-k8s/.

If you want to use the latest version of helm chart but another tag of the zot image then you could use something like this: --set image.tag=v1.4.3.

Let me know if you have any other questions.

RipperSK commented 1 year ago

Thank you all for the explanation and provided config / helm examples. Feel free to close this bug. If I encounter any additional issues while deploying the helm chart I will raise another issue.

rchincha commented 1 year ago

Closing this issue per comment above.