<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>DevOps on archive</title><link>https://archive-w.netlify.app/devops/</link><description>Recent content in DevOps on archive</description><generator>Hugo</generator><language>zh-CN</language><atom:link href="https://archive-w.netlify.app/devops/index.xml" rel="self" type="application/rss+xml"/><item><title/><link>https://archive-w.netlify.app/devops/nginx/nginx/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://archive-w.netlify.app/devops/nginx/nginx/</guid><description>&lt;ul>
&lt;li>
&lt;h2 id="简介">
 简介
 &lt;a class="anchor" href="#%e7%ae%80%e4%bb%8b">#&lt;/a>
&lt;/h2>
&lt;ul>
&lt;li>
&lt;h3 id="1介绍">
 1.介绍
 &lt;a class="anchor" href="#1%e4%bb%8b%e7%bb%8d">#&lt;/a>
&lt;/h3>
&lt;p class="warn">Nginx (engine x) 是一个高性能的HTTP和反向代理web服务器，同时也提供了IMAP/POP3/SMTP服务,支持FastCGI,SSL,Virtual Host,URL Rewrite,Gzip等功能。&lt;/p>
&lt;/li>
&lt;li>
&lt;h3 id="2功能">
 2.功能
 &lt;a class="anchor" href="#2%e5%8a%9f%e8%83%bd">#&lt;/a>
&lt;/h3>
&lt;ul>
&lt;li>反向代理&lt;/li>
&lt;li>负载均衡&lt;/li>
&lt;li>静态服务器&lt;/li>
&lt;li>邮箱服务器&lt;/li>
&lt;/ul>
&lt;/li>
&lt;li>
&lt;h3 id="3负载均衡方式">
 3.负载均衡方式
 &lt;a class="anchor" href="#3%e8%b4%9f%e8%bd%bd%e5%9d%87%e8%a1%a1%e6%96%b9%e5%bc%8f">#&lt;/a>
&lt;/h3>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>name&lt;/th>
&lt;th>explain&lt;/th>
&lt;th>feature&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>轮询&lt;/td>
&lt;td>默认方式&lt;/td>
&lt;td>&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>weight&lt;/td>
&lt;td>权重方式&lt;/td>
&lt;td>根据权重分发请求,权重大的分配到请求的概率大&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>ip_hash&lt;/td>
&lt;td>ip 分配&lt;/td>
&lt;td>根据客户端请求的IP地址计算hash值， 根据hash值来分发请求, 同一个IP发起的请求, 会发转发到同一个服务器上&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>url_hash&lt;/td>
&lt;td>url 分配&lt;/td>
&lt;td>根据客户端请求url的hash值，来分发请求, 同一个url请求, 会发转发到同一个服务器上&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>fair&lt;/td>
&lt;td>智能响应&lt;/td>
&lt;td>优先把请求分发给处理请求时间短的服务器&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>least_conn&lt;/td>
&lt;td>最少连接&lt;/td>
&lt;td>哪个服务器当前处理的连接少, 请求优先转发到这台服务器&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/li>
&lt;/ul>
&lt;/li>
&lt;li>
&lt;h2 id="编译安装">
 编译安装
 &lt;a class="anchor" href="#%e7%bc%96%e8%af%91%e5%ae%89%e8%a3%85">#&lt;/a>
&lt;/h2>
&lt;div class="alert callout tip">&lt;p class="title">&lt;span class="icon icon-tip">&lt;/span> Tip &lt;/p>&lt;p> 官方源码下载 


 &lt;a href="https://nginx.org/download/nginx-1.16.1.tar.gz" rel="noopener" target="_blank">1.16.1&lt;/a> 、


 &lt;a href="https://nginx.org/download/nginx-1.26.2.tar.gz" rel="noopener" target="_blank">1.26.2&lt;/a>。
&lt;br>（可选）编译用的 openssl 源码库，主要为了支持 


 &lt;a href="https://nginx.org/en/CHANGES-1.14#:~:text=Feature:%20the%20%22TLSv1.3%22,directive." rel="noopener" target="_blank">TLSv1.3&lt;/a>。
&lt;br>&lt;br>&lt;img src="https://archive-w.netlify.app/.images/devops/nginx/nginx-build-info-01.png" alt="" width="70%">&lt;/p>
&lt;/p>&lt;/div>
&lt;div class="alert callout attention">&lt;p class="title">&lt;span class="icon icon-attention">&lt;/span> Attention &lt;/p>&lt;p> 切换完依赖的 openssl 库后记得重启服务器，要不然可能会存在配置的 TLSv1.3 的功能，即使通过&lt;code>-s reload&lt;/code>但依然死活不生效，误以为配置出问题了。&lt;/p></description></item><item><title/><link>https://archive-w.netlify.app/devops/docker/docker/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://archive-w.netlify.app/devops/docker/docker/</guid><description>&lt;ul>
&lt;li>
&lt;h2 id="基本命令">
 基本命令
 &lt;a class="anchor" href="#%e5%9f%ba%e6%9c%ac%e5%91%bd%e4%bb%a4">#&lt;/a>
&lt;/h2>
&lt;ul>
&lt;li>
&lt;h3 id="base">
 BASE
 &lt;a class="anchor" href="#base">#&lt;/a>
&lt;/h3>
&lt;p class="warn"> 提交镜像
&lt;br>&lt;code>docker commit -a &amp;quot;xhsgg12302@gmail.com&amp;quot; -m &amp;quot;with requirements.txt&amp;quot; 44f357ee68bc eli/anaconda3:v1.0&lt;/code>
&lt;br>标签镜像
&lt;br>&lt;code>docker tag bad7184c3c60 gitlab.pixdaddy.com:5050/library/eclipse-temurin:17.0.2_8-jre-3.8.18-python-alpine3.17-with-pip-deps&lt;/code>
&lt;br>加载镜像
&lt;br>&lt;code>docker build -t me/venvs:v1.0 -f DK-venv .&lt;/code>
&lt;br>&lt;code>docker save me/venvs:v1.0 -o ./venvs.tar&lt;/code> 、 &lt;code>docker save me/venvs:v1.0 &amp;gt; ./venvs.tar&lt;/code>
&lt;br>&lt;code>docker load -i /path/tmp/docker-build.tar&lt;/code>
&lt;br>删除容器
&lt;br>&lt;code>docker ps -qa | xargs -n 1 docker rm -f&lt;/code>
&lt;br>&lt;br>这将列出所有没有被任何标签或容器引用的镜像。这些镜像通常被称为悬空镜像，因为它们没有被命名或引用，而且也没有被垃圾回收机制删除。
&lt;br>


 &lt;a href="https://docs.docker.com/engine/reference/commandline/images/#filter" rel="noopener" target="_blank">https://docs.docker.com/engine/reference/commandline/images/#filter&lt;/a>
&lt;br>&lt;code>docker image ls -f &amp;quot;dangling=true&amp;quot;&lt;/code>
&lt;br>删除所有没有被标记或容器引用的悬空镜像
&lt;br>&lt;code>docker image prune&lt;/code>
&lt;br>查找标记为 NONE 的镜像。运行以下命令：
&lt;br>&lt;code>docker images | grep '&amp;lt;none&amp;gt;' | awk '{print $3}'&lt;/code>
&lt;br>删除标记为 NONE 的镜像。使用以下命令删除这些镜像：
&lt;br>&lt;code>docker rmi $(docker images | grep '&amp;lt;none&amp;gt;' | awk '{print $3}')&lt;/code>
&lt;br>&lt;br>启动时


 &lt;a href="https://stackoverflow.com/questions/40122152/how-to-remove-entrypoint-from-parent-image-on-dockerfile" rel="noopener" target="_blank">去除基础镜像的entryponit&lt;/a> 或者在Dockerfile中 写入 ENTRYPOINT []
&lt;br>&lt;code>docker run -d --entrypoint='' ff3b94479b5d /bin/sh -c &amp;quot;npm i; xvfb-run --server-args='-screen 0 1280x800x24 -ac -nolisten tcp -dpi 96 +extension RANDR' npm run dev&amp;quot;&lt;/code>
&lt;br>&lt;br>docker 不使用缓存构建镜像
&lt;br>&lt;code>docker build -t **:1.0 --no-cache -f Dockerfile . &lt;/code>
&lt;br>docker 清理构建缓存
&lt;br>&lt;code>docker builder prune&lt;/code>、或者更深层次的&lt;code>docker system prune -a&lt;/code>
&lt;br>&lt;br>docker 进入内核查看 MacOSX 本地挂载卷 /var/lib/docker/volume
&lt;br>&lt;code>docker run -it --privileged --pid=host debian nsenter -t 1 -m -u -n -i sh&lt;/code>
&lt;br>&lt;/p></description></item><item><title/><link>https://archive-w.netlify.app/devops/git/git/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://archive-w.netlify.app/devops/git/git/</guid><description>&lt;ul>
&lt;li>
&lt;h2 id="代理设置">
 代理设置
 &lt;a class="anchor" href="#%e4%bb%a3%e7%90%86%e8%ae%be%e7%bd%ae">#&lt;/a>
&lt;/h2>
&lt;div class="alert callout note">&lt;p class="title">&lt;span class="icon icon-note">&lt;/span> Note &lt;/p>&lt;p> 有些时候需要搞明白代理如何生效，以致 clone、fetch 等远程操作纵享丝滑。
&lt;br>参考文档： 


 &lt;a href="https://git-scm.com/docs/git-config#Documentation/git-config.txt-httpproxy" rel="noopener" target="_blank">http.proxy&lt;/a> 、 


 &lt;a href="https://gist.github.com/evantoli/f8c23a37eb3558ab8765" rel="noopener" target="_blank">Configure Git to use a proxy&lt;/a>&lt;/p>
&lt;/p>&lt;/div>
&lt;div class="outer yosemite">&lt;div class="dot red">&lt;/div>&lt;div class="dot amber">&lt;/div>&lt;div class="dot green">&lt;/div>&lt;/div>
&lt;div class="code-toolbar">&lt;pre data-lang="shell" data-line="1,6" class="language-shell line-numbers" style="max-height: none">&lt;code class="language-shell">http.proxy
	Override the HTTP proxy, normally configured using the http_proxy, https_proxy, and all_proxy environment variables (see curl(1)). In addition to the syntax understood by curl, it is possible to specify a proxy string with a user name but no password, in which case git will attempt to acquire one in the same way it does for other credentials. See gitcredentials[7] for more information. The syntax thus is [protocol://][user[:password]@]proxyhost[:port][/path]. This can be overridden on a per-remote basis; see remote.&amp;lt;name&amp;gt;.proxy
	【译：】可以通过`http.proxy`覆写 curl 可识别的环境变量：http_proxy, https_proxy, all_proxy 等。
	除了 curl 可识别的语法之外，还可以给代理字符串指定用户名，不需要密码，git 会通过`凭据管理`自动获取密码填充。语法形如：[protocol://][user[:password]@]proxyhost[:port][/path]

http.&amp;lt;url&amp;gt;.proxy
	给某个 URL 单独配置代理。

# 【添加代理】
git config --global http.proxy http://proxyUsername:proxyPassword@proxy.server.com:port
git config --global http.https://domain.com.proxy http://proxyUsername:proxyPassword@proxy.server.com:port

# 【删除代理】
git config --global --unset http.proxy
git config --global --unset http.https://domain.com.proxy
&lt;/code>&lt;/pre>&lt;/div>
&lt;/li>
&lt;li>
&lt;h2 id="凭据管理">
 凭据管理
 &lt;a class="anchor" href="#%e5%87%ad%e6%8d%ae%e7%ae%a1%e7%90%86">#&lt;/a>
&lt;/h2>
&lt;ul>
&lt;li>
&lt;h3 id="1基本操作">
 1.基本操作
 &lt;a class="anchor" href="#1%e5%9f%ba%e6%9c%ac%e6%93%8d%e4%bd%9c">#&lt;/a>
&lt;/h3>
&lt;div class="alert callout attention">&lt;p class="title">&lt;span class="icon icon icon-attention">&lt;/span> Caution &lt;/p></description></item></channel></rss>