IDEA 提示: servlet should have a mapping

已经配置了 servlet 的 mapping, 但 IDEA 提示 servlet should have a mapping, 如何解决? 打开 IDEA 的 Project Structure 并添加 web.xml 的位置: {% img /images/idea-web-xml.png %}

August 6, 2019 · 1 min · K8sCat

Docker: net/http: TLS handshake timeout

使用 Drone 做 CICD 时提示 net/http: TLS handshake timeout, 如何解决? 配置镜像加速器即可 # ubuntu/centos sudo mkdir -p /etc/docker sudo tee /etc/docker/daemon.json <<-'EOF' { "registry-mirrors": ["http://f1361db2.m.daocloud.io"] } EOF sudo systemctl daemon-reload sudo systemctl restart docker Refer: DaoCloud 镜像站 阿里云容器镜像服务

August 1, 2019 · 1 min · K8sCat

允许远程调用 Docker API

使用 Portainer 管理容器时, 需要设置 Endpoint URL, 也就是远程调用 Docker API 的 host, 但默认 Docker 实例是不允许的, 如何解决? # 创建目录 mkdir /etc/systemd/system/docker.service.d # 创建文件 *.conf vi /etc/systemd/system/docker.service.d/tcp.conf # 添加以下内容 [Service] ExecStart= ExecStart=/usr/bin/dockerd -H fd:// -H tcp://0.0.0.0:2376 # 重新加载配置文件 sudo systemctl daemon-reload # 重启 docker 实例 systemctl restart docker.service # 以下两种方式可以检查是否配置成功 ps aux | grep docker > root 3695 0.0 1.8 724008 74616 ? Ssl 16:12 0:04 /usr/bin/dockerd -H fd:// -H tcp://0.0.0.0:2376 netstat -lnp | grep 2376 > tcp6 0 0 :::2376 :::* LISTEN 3695/dockerd 则 Endpoint URL: $ip:2376...

July 30, 2019 · 1 min · K8sCat

SpringBoot + Maven 多环境配置

一般来说, 一个项目会有多个环境, 比如生产环境(prod), 开发环境(dev), 测试环境(test), 这些环境的配置肯定会有所不同, 那么如何使用 Maven + SpringBoot 进行多环境配置? 在 resources 下有以下四个文件, 其中 application.yml 是基础配置文件, 其他配置文件的格式必须是 application-*.xml: application.yml spring: profiles: active: dev, prod, test application-dev.yml server: port: 8000 application-prod.yml server: port: 9000 application-test.yml server: port: 9996 在 pom.xml 文件添加以下内容: <profiles> <profile> <id>dev</id> <properties> <active>dev</active> </properties> <activation> <!-- 默认启用的环境 --> <activeByDefault>true</activeByDefault> </activation> </profile> <profile> <id>prod</id> <properties> <active>prod</active> </properties> </profile> <profile> <id>test</id> <properties> <active>test</active> </properties> </profile> </profiles> <build> <!-- 管理资源文件 --> <resources> <resource> <directory>${basedir}/src/main/resources</directory> <excludes> <!...

July 28, 2019 · 1 min · K8sCat

正向代理与反向代理

{% img /images/forward-reverse-proxy.jpg %} Refer: 反向代理为何叫反向代理? - 阿笠硕士的回答 - 知乎

July 27, 2019 · 1 min · K8sCat

Servlet Lifecycle

{% img /images/servlet-lifecycle.png %}

July 26, 2019 · 1 min · K8sCat

Jenkins SSH Reset

Jenkins连接节点的时候一直报ssh reset, 如何解决? # 去掉相应的ip即可 vi sshd.deny.hosteye

July 26, 2019 · 1 min · K8sCat

Git 小技巧 - 如何优雅地合并分支

如何合并分支并只保留一个 commit ? # 从主分支切换到新的分支 $ git checkout -b new-branch # 上面的命令等同于下面两条命令 $ git branch new-branch $ git checkout new-branch # 在新分支上提交了n个commit # 准备合并到主分支 # 先切回主分支 $ git checkout master # 然后进行合并 # 这种情况下的合并操作没有需要解决的分歧 - 这种合并就叫 'Fast-forward' $ git merge new-branch # 但如果再从主分支切出一个新分支 $ git checkout -b new-branch-1 # 然后在第一个分支已经合并到主分支的情况下 # 把第二个新的分支合并到主分支 # 这里就可能会产生冲突 # 需要手动解决冲突, 然后再做提交即可 $ git merge new-branch-1 # 上面的都不是重点 # 这里要讲的是合并的时候如果新分支提交了多个commit, 如何只保留一个commit到主分支上 # --squash create a single commit instead of doing a merge $ git merge --squash new-branch $ git commit -m "your commit" Refer: 3....

July 21, 2019 · 1 min · K8sCat