如何在极狐GitLab 自定义 Pages 域名、SSL/TLS 证书

news2024/9/22 11:39:28

本文作者:徐晓伟

GitLab 是一个全球知名的一体化 DevOps 平台,很多人都通过私有化部署 GitLab 来进行源代码托管。极狐GitLab 是 GitLab 在中国的发行版,专门为中国程序员服务。可以一键式部署极狐GitLab。

本文主要讲述了在极狐GitLab 用户自定义 Pages 域名、SSL/TLS 域名证书。

描述

默认情况下,pages 域名和证书 是被禁用的

file

自定义域名配置

导出 helm gitlab 配置

# 将已配置的值导出到文件中
helm -n gitlab-test get values my-gitlab > my-gitlab.yaml

查看 GitLab Pages Custom Domains Service 的 EXTERNAL-IP

[root@anolis-7-9 ~]# kubectl -n gitlab-test get service
NAME                                         TYPE           CLUSTER-IP       EXTERNAL-IP                 PORT(S)                                   AGE
cm-acme-http-solver-jpzhd                    NodePort       10.105.18.121    <none>                      8089:32764/TCP                            39h
cm-acme-http-solver-kvj5q                    NodePort       10.99.177.114    <none>                      8089:30973/TCP                            39h
cm-acme-http-solver-q82j2                    NodePort       10.103.217.244   <none>                      8089:32188/TCP                            39h
my-gitlab-certmanager                        ClusterIP      10.101.131.129   <none>                      9402/TCP                                  39h
my-gitlab-certmanager-webhook                ClusterIP      10.104.249.65    <none>                      443/TCP                                   39h
my-gitlab-gitaly                             ClusterIP      None             <none>                      8075/TCP,9236/TCP                         39h
my-gitlab-gitlab-exporter                    ClusterIP      10.104.47.204    <none>                      9168/TCP                                  39h
my-gitlab-gitlab-pages-custom-domains        LoadBalancer   10.97.49.247     172.25.25.32,10.97.49.247   80:32713/TCP                              87m
my-gitlab-gitlab-pages-metrics               ClusterIP      10.109.40.15     <none>                      9235/TCP                                  3h3m
my-gitlab-gitlab-shell                       ClusterIP      10.107.227.187   <none>                      22/TCP                                    39h
my-gitlab-kas                                ClusterIP      10.108.130.73    <none>                      8150/TCP,8153/TCP,8154/TCP,8151/TCP       39h
my-gitlab-minio-svc                          ClusterIP      10.109.30.226    <none>                      9000/TCP                                  39h
my-gitlab-nginx-ingress-controller           LoadBalancer   10.102.62.140    <pending>                   80:30875/TCP,443:31768/TCP,22:30561/TCP   39h
my-gitlab-nginx-ingress-controller-metrics   ClusterIP      10.96.243.11     <none>                      10254/TCP                                 39h
my-gitlab-postgresql                         ClusterIP      10.104.225.8     <none>                      5432/TCP                                  39h
my-gitlab-postgresql-hl                      ClusterIP      None             <none>                      5432/TCP                                  39h
my-gitlab-postgresql-metrics                 ClusterIP      10.107.233.118   <none>                      9187/TCP                                  39h
my-gitlab-prometheus-server                  ClusterIP      10.101.151.224   <none>                      80/TCP                                    39h
my-gitlab-redis-headless                     ClusterIP      None             <none>                      6379/TCP                                  39h
my-gitlab-redis-master                       ClusterIP      10.103.127.195   <none>                      6379/TCP                                  39h
my-gitlab-redis-metrics                      ClusterIP      10.104.184.133   <none>                      9121/TCP                                  39h
my-gitlab-registry                           ClusterIP      10.107.98.111    <none>                      5000/TCP                                  39h
my-gitlab-webservice-default                 ClusterIP      10.110.211.99    <none>                      8080/TCP,8181/TCP,8083/TCP                39h
[root@anolis-7-9 ~]# kubectl -n gitlab-test get svc | grep gitlab-pages-custom-domains
my-gitlab-gitlab-pages-custom-domains        LoadBalancer   10.97.49.247     172.25.25.32,10.97.49.247   80:32713/TCP                              87m
[root@anolis-7-9 ~]#

修改配置

注意:此处填写的 externalHttp 不能和 gitlab 实例的 IP 相同

  1. 作者 gitlab 实例域名 gitlab.test.helm.xuxiaowei.cn 解析到 172.25.25.32
  2. 作者 gitlab pages 域名 *.pages.test.helm.xuxiaowei.cn*.test.helm.xuxiaowei.io 解析到 172.25.25.31
  3. 文档
global:
  pages:
    # 用于支持自定义域名:仅支持 HTTP 请求
    externalHttp:
    # HTTP 请求到达 Pages daemon 的 IP 地址列表。用于支持自定义域名。
    # 使用上述 GitLab Pages Custom Domains Service 的部分 EXTERNAL-IP
    - 172.25.25.31
    - 10.97.49.247

更新配置

helm upgrade -n gitlab-test --install my-gitlab gitlab/gitlab --timeout 600s -f my-gitlab.yaml --version 7.7.0

等待所有 pod 更新完成

[root@anolis-7-9 ~]# kubectl -n gitlab-test get pod -o wide
NAME                                                 READY   STATUS      RESTARTS         AGE     IP                NODE         NOMINATED NODE   READINESS GATES
cm-acme-http-solver-2ldtp                            1/1     Running     14 (10m ago)     37h     192.168.210.234   anolis-7-9   <none>           <none>
cm-acme-http-solver-94dv5                            1/1     Running     14 (10m ago)     37h     192.168.210.247   anolis-7-9   <none>           <none>
cm-acme-http-solver-klkpz                            1/1     Running     14 (10m ago)     37h     192.168.210.230   anolis-7-9   <none>           <none>
my-gitlab-certmanager-8457bfdc8-w858k                1/1     Running     14 (10m ago)     37h     192.168.240.118   anolis-7-7   <none>           <none>
my-gitlab-certmanager-cainjector-74df787cf4-j7cfc    1/1     Running     14 (10m ago)     37h     192.168.240.66    anolis-7-7   <none>           <none>
my-gitlab-certmanager-webhook-7b86db4c96-dhcxl       1/1     Running     14 (10m ago)     37h     192.168.240.95    anolis-7-7   <none>           <none>
my-gitlab-gitaly-0                                   1/1     Running     14 (10m ago)     37h     192.168.210.228   anolis-7-9   <none>           <none>
my-gitlab-gitlab-exporter-55dcfcb595-gl6nm           1/1     Running     14 (10m ago)     37h     192.168.210.242   anolis-7-9   <none>           <none>
my-gitlab-gitlab-pages-848b78cbbb-7x6nt              1/1     Running     0                7m14s   192.168.240.115   anolis-7-7   <none>           <none>
my-gitlab-gitlab-runner-5f6ff5994c-wdw5l             1/1     Running     3 (10m ago)      4h13m   192.168.210.222   anolis-7-9   <none>           <none>
my-gitlab-gitlab-shell-55fdc9cb9f-52gnr              1/1     Running     14 (12m ago)     37h     192.168.240.76    anolis-7-7   <none>           <none>
my-gitlab-gitlab-shell-55fdc9cb9f-cfhsh              1/1     Running     14 (10m ago)     37h     192.168.210.223   anolis-7-9   <none>           <none>
my-gitlab-issuer-37-gqljk                            0/1     Completed   0                7m14s   192.168.240.82    anolis-7-7   <none>           <none>
my-gitlab-kas-688dc97ddd-28gr7                       1/1     Running     40 (9m39s ago)   37h     192.168.240.96    anolis-7-7   <none>           <none>
my-gitlab-kas-688dc97ddd-tvkvd                       1/1     Running     46 (9m34s ago)   37h     192.168.210.245   anolis-7-9   <none>           <none>
my-gitlab-migrations-37-t69sl                        0/1     Completed   0                7m14s   192.168.240.75    anolis-7-7   <none>           <none>
my-gitlab-minio-66f584f746-t6qwb                     1/1     Running     6 (10m ago)      29h     192.168.210.251   anolis-7-9   <none>           <none>
my-gitlab-minio-create-buckets-37-6lsd8              0/1     Completed   0                7m14s   192.168.240.97    anolis-7-7   <none>           <none>
my-gitlab-nginx-ingress-controller-6bdd56c45-ch57n   1/1     Running     14 (10m ago)     37h     192.168.240.67    anolis-7-7   <none>           <none>
my-gitlab-nginx-ingress-controller-6bdd56c45-cm2lz   1/1     Running     14 (10m ago)     37h     192.168.210.246   anolis-7-9   <none>           <none>
my-gitlab-postgresql-0                               2/2     Running     28 (10m ago)     37h     192.168.210.244   anolis-7-9   <none>           <none>
my-gitlab-prometheus-server-646489c599-8mgc9         2/2     Running     28 (10m ago)     37h     192.168.210.208   anolis-7-9   <none>           <none>
my-gitlab-redis-master-0                             2/2     Running     28 (10m ago)     37h     192.168.210.239   anolis-7-9   <none>           <none>
my-gitlab-registry-78fc549f8d-d2zjv                  1/1     Running     14 (10m ago)     37h     192.168.240.98    anolis-7-7   <none>           <none>
my-gitlab-registry-78fc549f8d-xbkvh                  1/1     Running     14 (10m ago)     37h     192.168.210.240   anolis-7-9   <none>           <none>
my-gitlab-sidekiq-all-in-1-v2-7ff55f699b-phhjt       1/1     Running     0                7m14s   192.168.210.235   anolis-7-9   <none>           <none>
my-gitlab-toolbox-7f79f69d96-xvl47                   1/1     Running     0                6m44s   192.168.240.101   anolis-7-7   <none>           <none>
my-gitlab-webservice-default-6f5d96f89c-c779l        2/2     Running     0                7m14s   192.168.240.81    anolis-7-7   <none>           <none>
my-gitlab-webservice-default-6f5d96f89c-m2svw        2/2     Running     0                5m7s    192.168.240.78    anolis-7-7   <none>           <none>
[root@anolis-7-9 ~]# 

查看项目 Pages 配置

默认 webservice-default Deployment 只有两个副本,请等待 webservice-default Deployment 恢复正常副本数后再查看, 否则页面数据在每次刷新可能结果不同

file

自定义域名

file

添加完成后,需要验证 DNS,如果你有域名 DNS 权限,可以选择添加 DNS 后刷新验证。 !

filefile

如果你没有 DNS 权限,或者你不想验证 DNS 权限,可以在管理页面取消验证。

file

取消验证后,需要重新添加域名才生效

file

访问效果

注意:由于此项目存在项目名问题,所以此效果是使用 https://framagit.org/xuxiaowei-com-cn/my-maven-app 的 domain 分支(无项目名)部署的,并且只能使用 http 方式访问 !
file

由于只配置了 externalHttp,所以只能通过 http 方式访问,https 将无法访问

file

自定义域名 SSL/TLS 证书 配置

导出 helm gitlab 配置

# 将已配置的值导出到文件中
helm -n gitlab-test get values my-gitlab > my-gitlab.yaml

查看 GitLab Pages Custom Domains Service 的 EXTERNAL-IP

[root@anolis-7-9 ~]# kubectl -n gitlab-test get service
NAME                                         TYPE           CLUSTER-IP       EXTERNAL-IP                 PORT(S)                                   AGE
cm-acme-http-solver-jpzhd                    NodePort       10.105.18.121    <none>                      8089:32764/TCP                            39h
cm-acme-http-solver-kvj5q                    NodePort       10.99.177.114    <none>                      8089:30973/TCP                            39h
cm-acme-http-solver-q82j2                    NodePort       10.103.217.244   <none>                      8089:32188/TCP                            39h
my-gitlab-certmanager                        ClusterIP      10.101.131.129   <none>                      9402/TCP                                  39h
my-gitlab-certmanager-webhook                ClusterIP      10.104.249.65    <none>                      443/TCP                                   39h
my-gitlab-gitaly                             ClusterIP      None             <none>                      8075/TCP,9236/TCP                         39h
my-gitlab-gitlab-exporter                    ClusterIP      10.104.47.204    <none>                      9168/TCP                                  39h
my-gitlab-gitlab-pages-custom-domains        LoadBalancer   10.97.49.247     172.25.25.32,10.97.49.247   80:32713/TCP                              87m
my-gitlab-gitlab-pages-metrics               ClusterIP      10.109.40.15     <none>                      9235/TCP                                  3h3m
my-gitlab-gitlab-shell                       ClusterIP      10.107.227.187   <none>                      22/TCP                                    39h
my-gitlab-kas                                ClusterIP      10.108.130.73    <none>                      8150/TCP,8153/TCP,8154/TCP,8151/TCP       39h
my-gitlab-minio-svc                          ClusterIP      10.109.30.226    <none>                      9000/TCP                                  39h
my-gitlab-nginx-ingress-controller           LoadBalancer   10.102.62.140    <pending>                   80:30875/TCP,443:31768/TCP,22:30561/TCP   39h
my-gitlab-nginx-ingress-controller-metrics   ClusterIP      10.96.243.11     <none>                      10254/TCP                                 39h
my-gitlab-postgresql                         ClusterIP      10.104.225.8     <none>                      5432/TCP                                  39h
my-gitlab-postgresql-hl                      ClusterIP      None             <none>                      5432/TCP                                  39h
my-gitlab-postgresql-metrics                 ClusterIP      10.107.233.118   <none>                      9187/TCP                                  39h
my-gitlab-prometheus-server                  ClusterIP      10.101.151.224   <none>                      80/TCP                                    39h
my-gitlab-redis-headless                     ClusterIP      None             <none>                      6379/TCP                                  39h
my-gitlab-redis-master                       ClusterIP      10.103.127.195   <none>                      6379/TCP                                  39h
my-gitlab-redis-metrics                      ClusterIP      10.104.184.133   <none>                      9121/TCP                                  39h
my-gitlab-registry                           ClusterIP      10.107.98.111    <none>                      5000/TCP                                  39h
my-gitlab-webservice-default                 ClusterIP      10.110.211.99    <none>                      8080/TCP,8181/TCP,8083/TCP                39h
[root@anolis-7-9 ~]# kubectl -n gitlab-test get svc | grep gitlab-pages-custom-domains
my-gitlab-gitlab-pages-custom-domains        LoadBalancer   10.97.49.247     172.25.25.32,10.97.49.247   80:32713/TCP                              87m
[root@anolis-7-9 ~]#

修改配置

注意:此处填写的 externalHttp 不能和 gitlab 实例的 IP 相同

  1. 作者 gitlab 实例域名 gitlab.test.helm.xuxiaowei.cn 解析到 172.25.25.32
  2. 作者 gitlab pages 域名 *.pages.test.helm.xuxiaowei.cn*.test.helm.xuxiaowei.io 解析到 172.25.25.31
  3. 文档
global:
  pages:
    # 用于支持自定义域名、SSL/TLS 证书:仅支持 HTTPS 请求
    externalHttps:
    # HTTPS 请求到达 Pages daemon 的 IP 地址列表。用于支持自定义域名。
    # 使用上述 GitLab Pages Custom Domains Service 的部分 EXTERNAL-IP
    - 172.25.25.31
    - 10.97.49.247

更新配置

helm upgrade -n gitlab-test --install my-gitlab gitlab/gitlab --timeout 600s -f my-gitlab.yaml --version 7.7.0

可以观察到 GitLab Pages 无法部署

[root@anolis-7-9 ~]# kubectl -n gitlab-test get pod -o wide | grep gitlab-pages
my-gitlab-gitlab-pages-6b5f557b5c-pp6ww              0/1     Init:0/2    0               102s    <none>            anolis-7-9   <none>           <none>
my-gitlab-gitlab-pages-848b78cbbb-7x6nt              1/1     Running     0               94m     192.168.240.115   anolis-7-7   <none>           <none>
[root@anolis-7-9 ~]#

查看无法部署的原因

无法找到 my-gitlab-pages-tls secret,原因是开启了自定义 域名 SSL/TLS 证书后,需要创建一个 TLS secret

[root@anolis-7-9 ~]# kubectl -n gitlab-test describe pod my-gitlab-gitlab-pages-6b5f557b5c-pp6ww
# 节选
Events:
Type     Reason       Age                  From               Message
  ----     ------       ----                 ----               -------
Normal   Scheduled    2m42s                default-scheduler  Successfully assigned gitlab-test/my-gitlab-gitlab-pages-6b5f557b5c-pp6ww to anolis-7-9
Warning  FailedMount  34s (x9 over 2m42s)  kubelet            MountVolume.SetUp failed for volume "init-pages-secrets" : secret "my-gitlab-pages-tls" not found
[root@anolis-7-9 ~]#

创建 my-gitlab-pages-tls TLS secret

openssl genrsa -out ca.key 2048
openssl req -new -x509 -days 3650 -key ca.key -subj "/C=CN/ST=山东/L=青岛/O=徐晓伟工作室/OU=徐晓伟工作室/CN=*.pages.test.helm.xuxiaowei.cn/CN=*.test.helm.xuxiaowei.io/emailAddress=xuxiaowei@xuxiaowei.com.cn" -out ca.crt -utf8
KEY_FILE=ca.key
CERT_FILE=ca.crt
CERT_NAME=my-gitlab-pages-tls
kubectl -n gitlab-test create secret tls ${CERT_NAME} --key ${KEY_FILE} --cert ${CERT_FILE}

重启 pages Deployment

[root@anolis-7-9 ~]# kubectl -n gitlab-test rollout restart deployment my-gitlab-gitlab-pages
deployment.apps/my-gitlab-gitlab-pages restarted
[root@anolis-7-9 ~]#

等待所有 pod 更新完成

[root@anolis-7-9 ~]# kubectl -n gitlab-test get pod -o wide
NAME                                                 READY   STATUS      RESTARTS        AGE     IP                NODE         NOMINATED NODE   READINESS GATES
cm-acme-http-solver-2ldtp                            1/1     Running     14 (121m ago)   39h     192.168.210.234   anolis-7-9   <none>           <none>
cm-acme-http-solver-94dv5                            1/1     Running     14 (121m ago)   39h     192.168.210.247   anolis-7-9   <none>           <none>
cm-acme-http-solver-klkpz                            1/1     Running     14 (121m ago)   39h     192.168.210.230   anolis-7-9   <none>           <none>
my-gitlab-certmanager-8457bfdc8-w858k                1/1     Running     14 (121m ago)   39h     192.168.240.118   anolis-7-7   <none>           <none>
my-gitlab-certmanager-cainjector-74df787cf4-j7cfc    1/1     Running     14 (121m ago)   39h     192.168.240.66    anolis-7-7   <none>           <none>
my-gitlab-certmanager-webhook-7b86db4c96-dhcxl       1/1     Running     14 (121m ago)   39h     192.168.240.95    anolis-7-7   <none>           <none>
my-gitlab-gitaly-0                                   1/1     Running     14 (121m ago)   39h     192.168.210.228   anolis-7-9   <none>           <none>
my-gitlab-gitlab-exporter-55dcfcb595-gl6nm           1/1     Running     14 (121m ago)   39h     192.168.210.242   anolis-7-9   <none>           <none>
my-gitlab-gitlab-pages-6bd898c7d5-tvspn              1/1     Running     0               4m36s   192.168.240.104   anolis-7-7   <none>           <none>
my-gitlab-gitlab-runner-5f6ff5994c-lbbjt             0/1     Running     0               21s     192.168.240.121   anolis-7-7   <none>           <none>
my-gitlab-gitlab-shell-55fdc9cb9f-52gnr              1/1     Running     14 (123m ago)   39h     192.168.240.76    anolis-7-7   <none>           <none>
my-gitlab-gitlab-shell-55fdc9cb9f-cfhsh              1/1     Running     14 (121m ago)   39h     192.168.210.223   anolis-7-9   <none>           <none>
my-gitlab-issuer-38-742q6                            0/1     Completed   0               91m     192.168.240.73    anolis-7-7   <none>           <none>
my-gitlab-issuer-55-fp5rb                            0/1     Completed   0               24m     192.168.240.105   anolis-7-7   <none>           <none>
my-gitlab-kas-688dc97ddd-28gr7                       1/1     Running     40 (120m ago)   39h     192.168.240.96    anolis-7-7   <none>           <none>
my-gitlab-kas-688dc97ddd-tvkvd                       1/1     Running     46 (120m ago)   39h     192.168.210.245   anolis-7-9   <none>           <none>
my-gitlab-migrations-38-9mz5h                        0/1     Completed   0               91m     192.168.210.252   anolis-7-9   <none>           <none>
my-gitlab-migrations-55-tbpvq                        0/1     Completed   0               24m     192.168.240.90    anolis-7-7   <none>           <none>
my-gitlab-minio-66f584f746-t6qwb                     1/1     Running     6 (121m ago)    31h     192.168.210.251   anolis-7-9   <none>           <none>
my-gitlab-minio-create-buckets-38-lzrsj              0/1     Completed   0               91m     192.168.240.79    anolis-7-7   <none>           <none>
my-gitlab-minio-create-buckets-55-g2gvz              0/1     Completed   0               24m     192.168.240.107   anolis-7-7   <none>           <none>
my-gitlab-nginx-ingress-controller-6bdd56c45-ch57n   1/1     Running     14 (121m ago)   39h     192.168.240.67    anolis-7-7   <none>           <none>
my-gitlab-nginx-ingress-controller-6bdd56c45-cm2lz   1/1     Running     14 (121m ago)   39h     192.168.210.246   anolis-7-9   <none>           <none>
my-gitlab-postgresql-0                               2/2     Running     28 (121m ago)   39h     192.168.210.244   anolis-7-9   <none>           <none>
my-gitlab-prometheus-server-646489c599-8mgc9         2/2     Running     28 (121m ago)   39h     192.168.210.208   anolis-7-9   <none>           <none>
my-gitlab-redis-master-0                             2/2     Running     28 (121m ago)   38h     192.168.210.239   anolis-7-9   <none>           <none>
my-gitlab-registry-78fc549f8d-d2zjv                  1/1     Running     14 (121m ago)   39h     192.168.240.98    anolis-7-7   <none>           <none>
my-gitlab-registry-78fc549f8d-xbkvh                  1/1     Running     14 (121m ago)   39h     192.168.210.240   anolis-7-9   <none>           <none>
my-gitlab-sidekiq-all-in-1-v2-84f99f6776-78g2z       1/1     Running     0               24m     192.168.210.197   anolis-7-9   <none>           <none>
my-gitlab-toolbox-6cbbbdcbdf-v6mf2                   1/1     Running     0               24m     192.168.210.202   anolis-7-9   <none>           <none>
my-gitlab-webservice-default-79f7757847-2mw8g        2/2     Running     0               24m     192.168.210.215   anolis-7-9   <none>           <none>
my-gitlab-webservice-default-79f7757847-gz9lm        2/2     Running     0               2m27s   192.168.240.117   anolis-7-7   <none>           <none>
[root@anolis-7-9 ~]# 

创建一个自定义域名 abc123.xuxiaowei.cn 证书

openssl genrsa -out ca.key 2048
openssl req -new -x509 -days 3650 -key ca.key -subj "/C=CN/ST=ShanDong/L=QingDao/O=xuxiaowei/OU=xuxiaowei/CN=abc123.xuxiaowei.cn/emailAddress=xuxiaowei@xuxiaowei.com.cn" -out ca.crt -utf8

新增/编辑域名,填写域名 SSL/TLS 证书

filefile

体验 域名 SSL/TLS 证书

file

号外号外!
极狐GitLab 正在推出DevSecOps 成熟度测评!链接:https://gitlab.cn/devsecops-assessment/ 测评非常全面并提供了可靠建议,即使不付费买产品,对自己想要落地 DevSecOps 的用户具有很高的参考意义!快来动手试试吧!
file

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1552736.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

深圳区块链交易所app系统开发,撮合交易系统开发

随着区块链技术的迅速发展和数字资产市场的蓬勃发展&#xff0c;区块链交易所成为了数字资产交易的核心场所之一。在这个快速发展的领域中&#xff0c;区块链交易所App系统的开发和撮合交易系统的建设至关重要。本文将探讨区块链交易所App系统开发及撮合交易系统的重要性&#…

包子凑数(蓝桥杯,闫氏DP分析法)

题目描述&#xff1a; 小明几乎每天早晨都会在一家包子铺吃早餐。 他发现这家包子铺有 N 种蒸笼&#xff0c;其中第 i 种蒸笼恰好能放 Ai 个包子。 每种蒸笼都有非常多笼&#xff0c;可以认为是无限笼。 每当有顾客想买 X 个包子&#xff0c;卖包子的大叔就会迅速选出若干笼…

解决:PytorchStreamWriter failed writing file data

文章目录 问题内容问题分析解决思路 问题内容 今天在炼丹的时候&#xff0c;我发现模型跑到140步的时候保存权重突然报了个问题&#xff0c;详细内容如下&#xff1a; Traceback (most recent call last):File "/public/home/dyedd/.conda/envs/diffusers/lib/python3.8…

uniapp输入框事件(防抖)

一、描述 在输入框输入内容或者说输入关键词的时候&#xff0c;往往都要进行做防抖处理。如果不做防抖&#xff0c;你输入什么&#xff0c;动态绑定的数据就会保持一致。这样不好吗&#xff0c;同步获取。有个业务场景&#xff0c;如果是搜索框&#xff0c;你每次一个字符&…

2024年第十届国际虚拟现实大会(ICVR 2024)即将召开!

会议面向虚拟现实、增强现实、人工智能等互联网新技术领域的专家及学者&#xff0c; 致力于共同促进国内外虚拟现实的发展与应用。 2014年至今&#xff0c;ICVR在全球新加坡&#xff0c;美国洛杉矶&#xff0c;中国成都&#xff0c;香港等国家及地区召开&#xff0c;面向虚拟现…

力扣面试150 二叉搜索树的最小绝对差 中序遍历

Problem: 530. 二叉搜索树的最小绝对差 文章目录 思路复杂度Code 思路 &#x1f468;‍&#x1f3eb; 录哥题解 复杂度 时间复杂度: O ( n ) O(n) O(n) 空间复杂度: O ( 1 ) O(1) O(1) Code // 递归 class Solution {int ans Integer.MAX_VALUE;TreeNode pre;//一开…

C++的非类型模板参数与模板分离编译(模板显式实例化)

非类型模板参数与模板分离编译&#xff08;模板显式实例化&#xff09; 文章目录 非类型模板参数与模板分离编译&#xff08;模板显式实例化&#xff09;前言一、非类型模板参数二、模版分离编译1. 分离编译概念2. 模版的分离编译问题案例解决方法 总结 前言 ​ 本篇博客文章介…

vue2源码解析——Vue.set/$set方法如何给响应式对象添加属性

在Vue 2中需要向响应式对象添加新属性时&#xff0c;可以使用Vue.set或$set方法来实现。这两个方法的作用是向响应式对象添加属性并确保这个新属性也是响应式的。 为什么会有vue.set方法 Vue提供了Vue.set方法主要是为了解决在Vue 2.x 中动态添加属性时可能遇到的响应性问题。 …

八大技术趋势案例(区块链量子计算)

科技巨变,未来已来,八大技术趋势引领数字化时代。信息技术的迅猛发展,深刻改变了我们的生活、工作和生产方式。人工智能、物联网、云计算、大数据、虚拟现实、增强现实、区块链、量子计算等新兴技术在各行各业得到广泛应用,为各个领域带来了新的活力和变革。 为了更好地了解…

钡铼技术R40路由器助力智能船舶航行数据实时传输与分析

钡铼技术R40路由器在智能船舶领域的应用&#xff0c;对于航行数据的实时传输与分析具有重要意义。随着航运业的不断发展和智能化水平的提升&#xff0c;船舶航行数据的及时传输和有效分析对船舶的安全、运营效率等方面至关重要。而引入钡铼技术R40路由器&#xff0c;则可以实现…

前后端分离开发【Yapi平台】【Swagger注解自动生成接口文档平台】

前后端分离开发 介绍开发流程Yapi&#xff08;api接口文档编写平台&#xff09;介绍 Swagger使用方式1). 导入knife4j的maven坐标2). 导入knife4j相关配置类3). 设置静态资源映射4). 在LoginCheckFilter中设置不需要处理的请求路径 查看接口文档常用注解注解介绍 当前项目中&am…

Eclipse+Java+Swing实现斗地主游戏

一. 视频演示效果 java斗地主源码演示 ​ 二.项目结构 代码十分简洁&#xff0c;只有简单的7个类&#xff0c;实现了人机对战 素材为若干的gif图片 三.项目实现 启动类为Main类&#xff0c;继承之JFrame&#xff0c;JFrame 是 Java Swing 库中的一个类&#xff0c;用于创建窗…

Cisco Firepower FMCv修改管理Ip方法

FMCv 是部署在VMWARE虚拟平台上的FMC 部署完成后&#xff0c;如何修改管理IP 1 查看当前版本 show version 可以看到是for VMware 2 修改管理IP步骤 2.1 进入expert模式 expert2.2 进入超级用户 sudo su并输入密码 2.3 查看当前网卡Ip 2.4 修改Ip 命令&#xff1a; /…

Scala第十三章节(作为值的函数及匿名函数、柯里化、闭包及控制抽象以及计算器案例)

章节目标 掌握作为值的函数及匿名函数的用法了解柯里化的用法掌握闭包及控制抽象的用法掌握计算器案例 1.高阶函数介绍 Scala 混合了面向对象和函数式的特性&#xff0c;在函数式编程语言中&#xff0c;函数是“头等公民”&#xff0c;它和Int、String、Class等其他 类型处于…

Unity3d使用Jenkins自动化打包(Windows)(二)

文章目录 前言一、Unity工程准备二、Unity调取命令行实战一实战二实战三实战四实战五 总结 前言 自动化打包的价值在于让程序员更轻松地创建和管理构建工具链&#xff0c;提高编程效率&#xff0c;将繁杂的工作碎片化&#xff0c;变成人人&#xff08;游戏行业特指策划&#x…

ChatGPT 商业金矿(上)

原文&#xff1a;ChatGPT Business Goldmines 译者&#xff1a;飞龙 协议&#xff1a;CC BY-NC-SA 4.0 第一章&#xff1a;为什么我写这本书 欢迎阅读《ChatGPT 多源收入&#xff1a;20 个利润丰厚的业务&#xff0c;任何人都可以在一周内使用 ChatGPT 开始》。我很高兴分享我…

C语言例4-32:利用for语句实现循环次数未知的例子

从键盘输入若干个整数&#xff0c;求其中的最大者和最小者&#xff0c;直到输入“0”为止 算法分析&#xff1a; 读取第一个整数i&#xff0c;并假设它是当前最大整数max&#xff0c;也是当前最小整数min当,则重复执行以下操作&#xff0c;若i<min&#xff0c;则mini;从键…

Java中读取html文件转成String,展示在浏览器

这里写目录标题 第一章1.1&#xff09;pom中引入依赖和html文件示例1.2&#xff09;使用hutool工具包读取html文件转为string1.3&#xff09;页面显示 第一章 1.1&#xff09;pom中引入依赖和html文件示例 引入hutool工具包依赖 <dependency><groupId>cn.hutool&…

华为防火墙配置指引超详细(包含安全配置部分)以USG6320为例

华为防火墙USG6320 华为防火墙USG6320是一款高性能、高可靠的下一代防火墙,适用于中小型企业、分支机构等场景。该防火墙支持多种安全功能,可以有效抵御网络攻击,保护网络安全。 目录 华为防火墙USG6320 1. 初始配置 2. 安全策略配置 3. 防火墙功能配置 4. 高可用性配…

iPhone用GPT替代Siri

shigen坚持更新文章的博客写手&#xff0c;擅长Java、python、vue、shell等编程语言和各种应用程序、脚本的开发。记录成长&#xff0c;分享认知&#xff0c;留住感动。 个人IP&#xff1a;shigen 前一段时间&#xff0c;因为iCloud协议的更新&#xff0c;我的云盘空间无法正常…