sigma
sigma copied to clipboard
如何配置自定义域名
我用默认配置拉起,然后通过NGINX代理,添加域名解析。
此时发现web端能够正常访问,但是docker login 的时候,会报错:tls: failed to verify certificate: x509: certificate signed by unknown authority
是不是配置文件里需要指定自定义域名的配置信息,这块儿看了说明,没有太理解:
http:
# endpoint can be a domain or domain with port, eg: http://sigma.test.io, https://sigma.test.io:30080, http://127.0.0.1:3000
# this endpoint will be used to generate the token service url in auth middleware,
# you can leave it blank and it will use http://127.0.0.1:3000 as internal domain by default,
# because the front page need show this endpoint.
endpoint: https://sigma.test.io
# in some cases, daemon may pull image and scan it, but we don't want to pull image from public registry domain,
# so use this internal domain to pull image from registry.
# you can leave it blank and it will use http://127.0.0.1:3000 as internal domain by default.
# in k8s cluster, it will be set to the distribution service which is used to pull image from registry, eg: http://registry.default.svc.cluster.local:3000
# in docker-compose, it will be set to the registry service which is used to pull image from registry, eg: http://registry:3000
# if http.tls.enabled is true, internalEndpoint should start with https://
# eg: http://sigma.test.io, http://sigma.test.io:3000, https://sigma.test.io:30080
internalEndpoint: https://sigma.test.io
# eg: http://sigma-distribution:3000
internalDistributionEndpoint: https://sigma.test.io
tls:
enabled: true
certificate: /etc/sigma/test.io.pem
key: /etc/sigma/test.io.key
我目前这样配置的,这样配置之后,web页面也无法访问了。应该是哪里没有配置对。
你的证书是配置在 nginx 么?如果是的话,可以把 http.endpoint 这里设置为空,tls.enabled 这里设置为 false,http.internalEndpoint 这里设置为空。
我后续给这个配置文件加一下中文说明相关的提示。
我刚刚这样调整了下,目前可用了,但是感觉有点别扭。
现在配置为:
http:
endpoint: https://sigma.test.io
internalEndpoint:
internalDistributionEndpoint:
tls:
enabled: true
certificate: /etc/sigma/test.io.pem
key: /etc/sigma/test.io.key
然后启动时,将3000直接映射给了443:
docker run -itd --name sigma -v /data/sigma/config:/etc/sigma \
-v /data/sigma/storage:/var/lib/sigma \
-v /var/run/docker.sock:/var/run/docker.sock -p 443:3000 \
ghcr.io/go-sigma/sigma
之后直接把域名解析到这台主机,目前实测下来能正常用了。
http.endpoint 设置为空的话,是不是页面中镜像对应tag的pull地址也会变成默认的 http://localhost:3000 了。
我也期望tls设置为false,然后就不用再这里单独维护证书了。
http:
# endpoint 可以是一个域名,也可以携带端口号,例如: http://sigma.test.io, https://sigma.test.io:30080, http://127.0.0.1:3000
# 你可以留空,默认值是:http://127.0.0.1:3000
# 前端会使用这个 endpoint 作为展示如何拉取这个镜像,并且也会使用这个值作为 oauth2 跳转的 endpoint
endpoint: https://sigma.test.io
# 在一些场景中,worker 组件会拉取镜像并且对他做扫描或者组件检查,但是我们并不想这个拉取动作是从公网链路上对这个镜像进行拉取,
# 所以可以用这个作为内置的拉取镜像的域名,你可以留空,默认值是:http://127.0.0.1:3000
# 在 k8s 集群内,这个值将需要设置为 distribution 服务的地址,作为拉取镜像的服务端,例如:http://registry.default.svc.cluster.local:3000
# 在 docker compose 的高可用部署的场景中,这个值需要设置为 distribution 服务的地址,例如:http://distribution:3000
# 在 docker compose 的 all-in-one 部署的场景中,这个值可以设置为 sigma 的服务地址,例如:http://127.0.0.1:3000
# 如果 http.tls.enabled 为 true,代表 sigma 的部署中含有证书,这时候 internalEndpoint 的地址 schema 必须以 https 开头
internalEndpoint: https://sigma.test.io
# 在高可用部署场景中(非 all-in-one),internalDistributionEndpoint 作为 distribution 的服务地址,internalEndpoint 作为 server 的服务地址
internalDistributionEndpoint: https://sigma.test.io
tls:
enabled: true
certificate: /etc/sigma/test.io.pem
key: /etc/sigma/test.io.key
如果我把 auto tls(自动帮你申请证书) 的功能做上去,是不是对你更加友好一些?不用 nginx 了?
如果我把 auto tls(自动帮你申请证书) 的功能做上去,是不是对你更加友好一些?不用 nginx 了?
我在想,这里能不能简单点,就是不做任何配置,然后服务部署的时候,还是监听3000.
docker run -itd --name sigma -v /data/sigma/config:/etc/sigma \
-v /data/sigma/storage:/var/lib/sigma \
-v /var/run/docker.sock:/var/run/docker.sock -p 3000:3000 \
ghcr.io/go-sigma/sigma
然后启动之后,可以在配置那里,指定一下服务的访问URL,这个时候我填写一下 https://sigma.test.io/ 是不是就可以了。市面上不少应用是这样的一个做法。
OK,也是一种方式。相当于是第一次进入系统的时候有一个安装的步骤,填一些关键信息。
OK,也是一种方式。相当于是第一次进入系统的时候有一个安装的步骤,填一些关键信息。
是的。类似gitea,首次访问,是一个自定义配置安装的步骤