-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathatom.xml
146 lines (90 loc) · 38.9 KB
/
atom.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>TaeRoen's Blog</title>
<link href="/atom.xml" rel="self"/>
<link href="https://blog.taeroen.com/"/>
<updated>2020-01-29T12:29:51.667Z</updated>
<id>https://blog.taeroen.com/</id>
<author>
<name>TaeRoen</name>
</author>
<generator uri="https://hexo.io/">Hexo</generator>
<entry>
<title>helm私有charts仓库进阶</title>
<link href="https://blog.taeroen.com/post/2018-09-kube-helm-repo.html"/>
<id>https://blog.taeroen.com/post/2018-09-kube-helm-repo.html</id>
<published>2018-09-30T02:31:32.000Z</published>
<updated>2020-01-29T12:29:51.667Z</updated>
<content type="html"><![CDATA[<h1 id="helm私有charts仓库进阶"><a href="#helm私有charts仓库进阶" class="headerlink" title="helm私有charts仓库进阶"></a>helm私有charts仓库进阶</h1><h2 id="镜像官方仓库"><a href="#镜像官方仓库" class="headerlink" title="镜像官方仓库"></a>镜像官方仓库</h2><p>在了解了chart的基本组成结构之后,自己开始动手开始写chart,这时候还是想找一些官方项目看看。官方仓库里面有很多参考,把官方仓库的熟悉项目的chart都看一遍,跑一遍,再尝试修改一遍,其实也就对chart实际上了解的差不多了,剩下的就是到实际项目中实践了。</p><p>然而官方仓库托管在了google上,这就带来了一个科学上网的问题。本机的还好说,可是服务器上,工具链上就麻烦了,还涉及到内网的问题,所以一开始就想把官方仓库拖下来。</p><p>首先看一下官方仓库的结构,就一个index.yaml,里面是实际tgz包的地址,对托仓库实在是太友好了。</p><p>先把yaml文件下载下来:</p><p class="code-caption" data-lang="shell" data-line_number="frontend" data-trim_indent="backend" data-label_position="outer" data-labels_left="Code" data-labels_right=":" data-labels_copy="Copy Code"><span class="code-caption-label"></span></p><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#</span><span class="bash"> ADDR_PORT为可以科学上网的http代理的地址 </span></span><br><span class="line">export https_proxy=http://${ADDR_PORT}/</span><br><span class="line">mkdir helm-mirror && cd helm-mirror</span><br><span class="line">wget https://kubernetes-charts.storage.googleapis.com/index.yaml -O offical-index.yaml</span><br></pre></td></tr></table></figure><p>看一下yaml文件中chart的下载路径在哪:</p><p class="code-caption" data-lang="yaml" data-line_number="frontend" data-trim_indent="backend" data-label_position="outer" data-labels_left="Code" data-labels_right=":" data-labels_copy="Copy Code"><span class="code-caption-label"></span></p><figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">apiVersion:</span> <span class="string">v1</span></span><br><span class="line"><span class="attr">entries:</span></span><br><span class="line"> <span class="attr">acs-engine-autoscaler:</span></span><br><span class="line"> <span class="bullet">-</span> <span class="attr">apiVersion:</span> <span class="string">v1</span></span><br><span class="line"> <span class="attr">appVersion:</span> <span class="number">2.1</span><span class="number">.1</span></span><br><span class="line"> <span class="attr">created:</span> <span class="number">2018</span><span class="number">-09</span><span class="string">-30T01:26:39.918358983Z</span></span><br><span class="line"> <span class="attr">description:</span> <span class="string">Scales</span> <span class="string">worker</span> <span class="string">nodes</span> <span class="string">within</span> <span class="string">agent</span> <span class="string">pools</span></span><br><span class="line"> <span class="attr">digest:</span> <span class="string">5904caae456eecd1fed0a5d58f4a6f46e1fe97f954c4467e49fc80f91d912a10</span></span><br><span class="line"> <span class="attr">home:</span> <span class="string">https://github.com/wbuchwalter/Kubernetes-acs-engine-autoscaler</span></span><br><span class="line"> <span class="attr">icon:</span> <span class="string">https://github.com/kubernetes/kubernetes/blob/master/logo/logo.png</span></span><br><span class="line"> <span class="attr">maintainers:</span></span><br><span class="line"> <span class="bullet">-</span> <span class="attr">email:</span> <span class="string">[email protected]</span></span><br><span class="line"> <span class="attr">name:</span> <span class="string">ritazh</span></span><br><span class="line"> <span class="bullet">-</span> <span class="attr">email:</span> <span class="string">[email protected]</span></span><br><span class="line"> <span class="attr">name:</span> <span class="string">wbuchwalter</span></span><br><span class="line"> <span class="attr">name:</span> <span class="string">acs-engine-autoscaler</span></span><br><span class="line"> <span class="attr">sources:</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">https://github.com/wbuchwalter/Kubernetes-acs-engine-autoscaler</span></span><br><span class="line"> <span class="attr">urls:</span></span><br><span class="line"> <span class="bullet">-</span> <span class="string">https://kubernetes-charts.storage.googleapis.com/acs-engine-autoscaler-2.2.0.tgz</span></span><br><span class="line"> <span class="attr">version:</span> <span class="number">2.2</span><span class="number">.0</span></span><br></pre></td></tr></table></figure><p>下载地址太容易定位了,连yaml解析都懒得弄了,直接grep解决吧:</p><p class="code-caption" data-lang="shell" data-line_number="frontend" data-trim_indent="backend" data-label_position="outer" data-labels_left="Code" data-labels_right=":" data-labels_copy="Copy Code"><span class="code-caption-label"></span></p><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#</span><span class="bash"> 将所有获取到地址保存到helm-repo.list</span></span><br><span class="line">cat offical-index.yaml | grep "tgz" | awk '{print $2}' >> helm-repo.list</span><br></pre></td></tr></table></figure><p>下载全部的chart:</p><p class="code-caption" data-lang="shell" data-line_number="frontend" data-trim_indent="backend" data-label_position="outer" data-labels_left="Code" data-labels_right=":" data-labels_copy="Copy Code"><span class="code-caption-label"></span></p><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">mkdir helm-repo</span><br><span class="line">cd helm-repo</span><br><span class="line">wget -c -t 3 -T 30 -i ../helm-repo.list</span><br></pre></td></tr></table></figure><p>helm自带命令可以生成index.yaml,这里就不需要使用sed来更改里面的地址了,当然,我这里指定的地址是我演示的地址,按需要换成实际的地址:</p><p class="code-caption" data-lang="shell" data-line_number="frontend" data-trim_indent="backend" data-label_position="outer" data-labels_left="Code" data-labels_right=":" data-labels_copy="Copy Code"><span class="code-caption-label"></span></p><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">helm repo index helm-repo --url http://127.0.0.1:8001/</span><br></pre></td></tr></table></figure><p>启动web服务,这里就直接使用docker启动了nginx服务器:</p><p class="code-caption" data-lang="shell" data-line_number="frontend" data-trim_indent="backend" data-label_position="outer" data-labels_left="Code" data-labels_right=":" data-labels_copy="Copy Code"><span class="code-caption-label"></span></p><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">docker run -d --name helm-mirror -v $(pwd)/helm-repo:/usr/share/nginx/html -p 8001:80 nginx</span><br></pre></td></tr></table></figure><p>最后,测试一下repo,如果执行成功就可以了:</p><p class="code-caption" data-lang="shell" data-line_number="frontend" data-trim_indent="backend" data-label_position="outer" data-labels_left="Code" data-labels_right=":" data-labels_copy="Copy Code"><span class="code-caption-label"></span></p><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">helm repo add mirror http://127.0.0.1:8001/</span><br><span class="line">helm repo update</span><br><span class="line">helm repo fect mirror/mysql</span><br></pre></td></tr></table></figure><p>同时,为了方便,下面贴出了上述命令汇总的获取脚本和更新脚本,更改部分变量即可:</p><p class="code-caption" data-lang="shell" data-line_number="frontend" data-trim_indent="backend" data-label_position="outer" data-labels_left="Code" data-labels_right=":" data-labels_copy="Copy Code"><span class="code-caption-label"></span></p><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#</span><span class="bash"> fetch.sh</span></span><br><span class="line"><span class="meta">#</span><span class="bash">!/bin/sh</span></span><br><span class="line">https_proxy=your proxy addr</span><br><span class="line">mkdir helm-mirror</span><br><span class="line">cd helm-mirror</span><br><span class="line">wget https://kubernetes-charts.storage.googleapis.com/index.yaml -O offical-index.yaml</span><br><span class="line">cat offical-index.yaml | grep "tgz" | awk '{print $2}' >> helm-repo.list</span><br><span class="line">mkdir helm-repo</span><br><span class="line">cd helm-repo</span><br><span class="line">wget -c -t 3 -T 30 -i ../helm-repo.list</span><br><span class="line">helm repo index helm-repo --url http://127.0.0.1:8001/</span><br><span class="line">docker run -d --name helm-mirror -v $(pwd)/helm-repo:/usr/share/nginx/html -p 8001:80 nginx</span><br><span class="line"></span><br><span class="line"><span class="meta">#</span><span class="bash">update.sh</span></span><br><span class="line"><span class="meta">#</span><span class="bash">!/bin/sh</span></span><br><span class="line">https_proxy=your proxy addr</span><br><span class="line">cd helm-mirror</span><br><span class="line">rm offical-index.yaml helm-repo.list</span><br><span class="line">wget https://kubernetes-charts.storage.googleapis.com/index.yaml -O offical-index.yaml</span><br><span class="line">cat offical-index.yaml | grep "tgz" | awk '{print $2}' >> helm-repo.list</span><br><span class="line">cd helm-repo</span><br><span class="line">wget -c -t 3 -T 30 -i ../helm-repo.list</span><br><span class="line">helm repo index helm-repo --url http://127.0.0.1:8001/</span><br><span class="line">docker restart helm-mirror</span><br></pre></td></tr></table></figure>]]></content>
<summary type="html">
<h1 id="helm私有charts仓库进阶"><a href="#helm私有charts仓库进阶" class="headerlink" title="helm私有charts仓库进阶"></a>helm私有charts仓库进阶</h1><h2 id="镜像官方仓库"><a href="#镜像官方仓库" class="headerlink" title="镜像官方仓库"></a>镜像官方仓库</h2><p>在了解了chart的基本组成结构之后,自己开始动手开始写chart,这时候还是想找一些官方项目看看。官方仓库里面有很多参考,把官方仓库的熟悉项目的chart都看一遍,跑一遍,再尝试修改一遍,其实也就对chart实际上了解的差不多了,剩下的就是到实际项目中实践了。</p>
<p>然而官方仓库托管在了google上,这就带来了一个科学上网的问题。本机的还好说,可是服务器上,工具链上就麻烦了,还涉及到内网的问题,所以一开始就想把官方仓库拖下来。</p>
<p>首先看一下官方仓库的结构,就一个index.yaml,里面是实际tgz包的地址,对托仓库实在是太友好了。</p>
<p>先把yaml文件下载下来:</p>
<p class="code-caption" data-lang="shell" data-line_number="frontend" data-trim_indent="backend" data-label_position="outer" data-labels_left="Code" data-labels_right=":" data-labels_copy="Copy Code"><span class="code-caption-label"></span></p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#</span><span class="bash"> ADDR_PORT为可以科学上网的http代理的地址 </span></span><br><span class="line">export https_proxy=http://$&#123;ADDR_PORT&#125;/</span><br><span class="line">mkdir helm-mirror &amp;&amp; cd helm-mirror</span><br><span class="line">wget https://kubernetes-charts.storage.googleapis.com/index.yaml -O offical-index.yaml</span><br></pre></td></tr></table></figure>
<p>看一下yaml文件中chart的下载路径在哪:</p>
<p class="code-caption" data-lang="yaml" data-line_number="frontend" data-trim_indent="backend" data-label_position="outer" data-labels_left="Code" data-labels_right=":" data-labels_copy="Copy Code"><span class="code-caption-label"></span></p>
</summary>
<category term="devops" scheme="https://blog.taeroen.com/categories/devops/"/>
<category term="kubernetes" scheme="https://blog.taeroen.com/tags/kubernetes/"/>
<category term="helm" scheme="https://blog.taeroen.com/tags/helm/"/>
</entry>
<entry>
<title>使用docker搭建gitlab服务</title>
<link href="https://blog.taeroen.com/post/2017-03-gitlab-docker.html"/>
<id>https://blog.taeroen.com/post/2017-03-gitlab-docker.html</id>
<published>2017-03-06T14:18:48.000Z</published>
<updated>2020-01-29T12:29:55.944Z</updated>
<content type="html"><![CDATA[<h2 id="Quick-start"><a href="#Quick-start" class="headerlink" title="Quick start"></a>Quick start</h2><p>这是官方文档中的运行命令</p><p class="code-caption" data-lang="bash" data-line_number="frontend" data-trim_indent="backend" data-label_position="outer" data-labels_left="Code" data-labels_right=":" data-labels_copy="Copy Code"><span class="code-caption-label"></span></p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">sudo docker run --detach \</span><br><span class="line"> --hostname gitlab.example.com \</span><br><span class="line"> --publish 443:443 --publish 80:80 --publish 22:22 \</span><br><span class="line"> --name gitlab \</span><br><span class="line"> --restart always \</span><br><span class="line"> --volume /srv/gitlab/config:/etc/gitlab:Z \</span><br><span class="line"> --volume /srv/gitlab/logs:/var/<span class="built_in">log</span>/gitlab:Z \</span><br><span class="line"> --volume /srv/gitlab/data:/var/opt/gitlab:Z \</span><br><span class="line"> gitlab/gitlab-ce:latest</span><br></pre></td></tr></table></figure>这是我自己搭建时使用的命令<p class="code-caption" data-lang="bash" data-line_number="frontend" data-trim_indent="backend" data-label_position="outer" data-labels_left="Code" data-labels_right=":" data-labels_copy="Copy Code"><span class="code-caption-label"></span></p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">sudo docker run --detach \</span><br><span class="line"> --hostname git.taeroen.xyz \</span><br><span class="line"> --publish 1443:443 --publish 1080:80 --publish 1022:22 \</span><br><span class="line"> --name gitlab-ce \</span><br><span class="line"> --restart unless-stopped \</span><br><span class="line"> --volume /data/gitlab/config:/etc/gitlab:Z \</span><br><span class="line"> --volume /data/gitlab/logs:/var/<span class="built_in">log</span>/gitlab:Z \</span><br><span class="line"> --volume /data/gitlab/data:/var/opt/gitlab:Z \</span><br><span class="line"> gitlab/gitlab-ce:8.17.2-ce.0</span><br></pre></td></tr></table></figure>两者区别的地方就是可以自定义配置的地方,hostname只是个实例,如果有域名的话可以配成自己的,也可以更改自己的hosts来指向;端口的话随意,内部端口正确即可以;restart策略我更习惯使用unless-stopped,如果我手动stop后不会在下一次开机后重启;挂载目录的话可以看自己的需求,我习惯都挂载/data目录下;最后的tag建议改成一个固定值,实际上就是latest指向的值,这样避免升级时由于版本问题带来可能的bug。<h2 id="进阶"><a href="#进阶" class="headerlink" title="进阶"></a>进阶</h2><p>实际使用时需要在启动时传一些额外的参数,例如lfs,external_url,可以在启动时添加额外的参数。</p><p>例如:</p><p class="code-caption" data-lang="bash" data-line_number="frontend" data-trim_indent="backend" data-label_position="outer" data-labels_left="Code" data-labels_right=":" data-labels_copy="Copy Code"><span class="code-caption-label"></span></p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">GITLAB_OMNIBUS_CONFIG=<span class="string">"external_url 'https://git.taeroen.xyz:1443/'; gitlab_rails['lfs_enabled'] = true; nginx['redirect_http_to_https'] = true; nginx['ssl_certificate'] = '/etc/letsencrypt/live/git.taeroen.xyz/fullchain.pem';</span></span><br><span class="line"><span class="string">nginx['ssl_certificate_key'] = '/etc/letsencrypt/live/git.taeroen.xyz/privkey.pem';</span></span><br></pre></td></tr></table></figure><h2 id="配置Let’s-Encrypt"><a href="#配置Let’s-Encrypt" class="headerlink" title="配置Let’s Encrypt"></a>配置Let’s Encrypt</h2><p class="code-caption" data-lang="bash" data-line_number="frontend" data-trim_indent="backend" data-label_position="outer" data-labels_left="Code" data-labels_right=":" data-labels_copy="Copy Code"><span class="code-caption-label"></span></p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">git <span class="built_in">clone</span> https://github.com/letsencrypt/letsencrypt</span><br><span class="line"><span class="built_in">cd</span> letsencrypt</span><br><span class="line">./letsencrypt-auto --agree-tos --email [email protected] certonly --webroot -w /usr/share/nginx/html/ -d git.taeroen.xyz</span><br></pre></td></tr></table></figure><h2 id="最终配置"><a href="#最终配置" class="headerlink" title="最终配置"></a>最终配置</h2><p class="code-caption" data-lang="bash" data-line_number="frontend" data-trim_indent="backend" data-label_position="outer" data-labels_left="Code" data-labels_right=":" data-labels_copy="Copy Code"><span class="code-caption-label"></span></p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line">sudo docker run --detach \</span><br><span class="line"> --hostname git.taeroen.xyz \</span><br><span class="line"> --publish 443:443 --publish 80:80 --publish 22:22 \</span><br><span class="line"> --name gitlab-ce \</span><br><span class="line"> --restart unless-stopped \</span><br><span class="line"> --volume /data/gitlab/config:/etc/gitlab:Z \</span><br><span class="line"> --volume /data/gitlab/logs:/var/<span class="built_in">log</span>/gitlab:Z \</span><br><span class="line"> --volume /data/gitlab/data:/var/opt/gitlab:Z \</span><br><span class="line"> --volume /data/git.taeroen.xyz/fullchain.pem:/etc/gitlab/ssl/git.taeroen.xyz.crt \</span><br><span class="line"> --volume /data/git.taeroen.xyz/privkey.pem:/etc/gitlab/ssl/git.taeroen.xyz.key \</span><br><span class="line"> --env GITLAB_OMNIBUS_CONFIG=<span class="string">"external_url 'https://git.taeroen.xyz/';gitlab_rails['lfs_enabled'] = true;"</span> \</span><br><span class="line"> gitlab/gitlab-ce:8.17.2-ce.0</span><br></pre></td></tr></table></figure>]]></content>
<summary type="html">
<h2 id="Quick-start"><a href="#Quick-start" class="headerlink" title="Quick start"></a>Quick start</h2><p>这是官方文档中的运行命令</p>
<p class="code-caption" data-lang="bash" data-line_number="frontend" data-trim_indent="backend" data-label_position="outer" data-labels_left="Code" data-labels_right=":" data-labels_copy="Copy Code"><span class="code-caption-label"></span></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">sudo docker run --detach \</span><br><span class="line"> --hostname gitlab.example.com \</span><br><span class="line"> --publish 443:443 --publish 80:80 --publish 22:22 \</span><br><span class="line"> --name gitlab \</span><br><span class="line"> --restart always \</span><br><span class="line"> --volume /srv/gitlab/config:/etc/gitlab:Z \</span><br><span class="line"> --volume /srv/gitlab/logs:/var/<span class="built_in">log</span>/gitlab:Z \</span><br><span class="line"> --volume /srv/gitlab/data:/var/opt/gitlab:Z \</span><br><span class="line"> gitlab/gitlab-ce:latest</span><br></pre></td></tr></table></figure>
这是我自己搭建时使用的命令
<p class="code-caption" data-lang="bash" data-line_number="frontend" data-trim_indent="backend" data-label_position="outer" data-labels_left="Code" data-labels_right=":" data-labels_copy="Copy Code"><span class="code-caption-label"></span></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">sudo docker run --detach \</span><br><span class="line"> --hostname git.taeroen.xyz \</span><br><span class="line"> --publish 1443:443 --publish 1080:80 --publish 1022:22 \</span><br><span class="line"> --name gitlab-ce \</span><br><span class="line"> --restart unless-stopped \</span><br><span class="line"> --volume /data/gitlab/config:/etc/gitlab:Z \</span><br><span class="line"> --volume /data/gitlab/logs:/var/<span class="built_in">log</span>/gitlab:Z \</span><br><span class="line"> --volume /data/gitlab/data:/var/opt/gitlab:Z \</span><br><span class="line"> gitlab/gitlab-ce:8.17.2-ce.0</span><br></pre></td></tr></table></figure>
两者区别的地方就是可以自定义配置的地方,hostname只是个实例,如果有域名的话可以配成自己的,也可以更改自己的hosts来指向;端口的话随意,内部端口正确即可以;restart策略我更习惯使用unless-stopped,如果我手动stop后不会在下一次开机后重启;挂载目录的话可以看自己的需求,我习惯都挂载/data目录下;最后的tag建议改成一个固定值,实际上就是latest指向的值,这样避免升级时由于版本问题带来可能的bug。
<h2 id="进阶"><a href="#进阶" class="headerlink" title="进阶"></a>进阶</h2><p>实际使用时需要在启动时传一些额外的参数,例如lfs,external_url,可以在启动时添加额外的参数。</p>
<p>例如:</p>
<p class="code-caption" data-lang="bash" data-line_number="frontend" data-trim_indent="backend" data-label_position="outer" data-labels_left="Code" data-labels_right=":" data-labels_copy="Copy Code"><span class="code-caption-label"></span></p>
</summary>
<category term="git" scheme="https://blog.taeroen.com/categories/git/"/>
<category term="docker" scheme="https://blog.taeroen.com/tags/docker/"/>
</entry>
<entry>
<title>Linux下常见压缩文件的相关操作</title>
<link href="https://blog.taeroen.com/post/2017-03-linux-misc-command.html"/>
<id>https://blog.taeroen.com/post/2017-03-linux-misc-command.html</id>
<published>2017-03-06T06:11:45.000Z</published>
<updated>2020-01-29T15:09:09.220Z</updated>
<content type="html"><![CDATA[<p>Linux常见的打包及压缩文件格式有tar,tar.gz,tar.xz,tar.bz2,zip,虽然命令不多,但是经常容器弄混,在这里用表格整理一下,方便记忆及操作。</p><p>源文件:src.xxx</p><p>目标文件:dest.xxx</p><p>解压到指定目录:/tmp</p><hr><table><thead><tr><th align="center">扩展文件名</th><th align="center">解压缩</th><th align="center">解压缩到指定目录</th><th align="center">压缩</th><th align="center">可选参数</th></tr></thead><tbody><tr><td align="center">zip</td><td align="center">unzip src.zip</td><td align="center"></td><td align="center">unzip src.zip dest</td><td align="center"></td></tr><tr><td align="center">gz</td><td align="center">gnuzip src.gz</td><td align="center"></td><td align="center">gzip src</td><td align="center"></td></tr><tr><td align="center">tar</td><td align="center">tar xf src.tar</td><td align="center">tar xf src.tar -C /tmp</td><td align="center">tar cf dest.tar src</td><td align="center">-v 显示过程</td></tr><tr><td align="center">tar.gz/tgz</td><td align="center">tar zxf src.tar.gz</td><td align="center">tar zxf dest.tar.gz -C /tmp</td><td align="center">tar zcf dest.tar.gz src</td><td align="center">-v 显示过程</td></tr><tr><td align="center">tar.bz2</td><td align="center">tar jxf src.tar.bz2</td><td align="center">tar jxf dest.tar.bz2 -C /tmp</td><td align="center">tar jcf dest.tar.bz2 src</td><td align="center">-v 显示过程</td></tr></tbody></table>]]></content>
<summary type="html">
<p>Linux常见的打包及压缩文件格式有tar,tar.gz,tar.xz,tar.bz2,zip,虽然命令不多,但是经常容器弄混,在这里用表格整理一下,方便记忆及操作。</p>
<p>源文件:src.xxx</p>
<p>目标文件:dest.xxx</p>
<p>解压到指定目
</summary>
<category term="linux" scheme="https://blog.taeroen.com/categories/linux/"/>
<category term="linux" scheme="https://blog.taeroen.com/tags/linux/"/>
</entry>
<entry>
<title>Debian8 内核编译</title>
<link href="https://blog.taeroen.com/post/2016-12-linux-kernel-compile-debian.html"/>
<id>https://blog.taeroen.com/post/2016-12-linux-kernel-compile-debian.html</id>
<published>2016-12-17T05:30:48.000Z</published>
<updated>2020-01-29T12:30:01.566Z</updated>
<content type="html"><![CDATA[<h1 id="Debian8-内核编译"><a href="#Debian8-内核编译" class="headerlink" title="Debian8 内核编译"></a>Debian8 内核编译</h1><p>本文介绍两种编译linux内核的方式,一种是debian发行版打过补丁和更改过配置的内核,一种是linux的原版内核。</p><h2 id="1-准备编译环境"><a href="#1-准备编译环境" class="headerlink" title="1 准备编译环境"></a>1 准备编译环境</h2><p>安装编译工具链</p><p class="code-caption" data-lang="bash" data-line_number="frontend" data-trim_indent="backend" data-label_position="outer" data-labels_left="Code" data-labels_right=":" data-labels_copy="Copy Code"><span class="code-caption-label"></span></p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># apt-get install build-essential kernel-package libncurses5-dev -y</span></span><br></pre></td></tr></table></figure><h2 id="2-下载Debian发行版内核源码"><a href="#2-下载Debian发行版内核源码" class="headerlink" title="2 下载Debian发行版内核源码"></a>2 下载Debian发行版内核源码</h2><p class="code-caption" data-lang="bash" data-line_number="frontend" data-trim_indent="backend" data-label_position="outer" data-labels_left="Code" data-labels_right=":" data-labels_copy="Copy Code"><span class="code-caption-label"></span></p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># apt-get install linux-source-3.16 -y</span></span><br></pre></td></tr></table></figure><p>内核源码包安装完成后下载到/user/src目录下</p><p class="code-caption" data-lang="bash" data-line_number="frontend" data-trim_indent="backend" data-label_position="outer" data-labels_left="Code" data-labels_right=":" data-labels_copy="Copy Code"><span class="code-caption-label"></span></p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">$ ls /usr/src -al | grep linux-source-3.16</span><br><span class="line">rw-r--r-- 1 root root 81957884 - - - linux-source-3.16.tar.xz</span><br></pre></td></tr></table></figure><p>解压源码包</p><p class="code-caption" data-lang="bash" data-line_number="frontend" data-trim_indent="backend" data-label_position="outer" data-labels_left="Code" data-labels_right=":" data-labels_copy="Copy Code"><span class="code-caption-label"></span></p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">$ mkdir -p ~/build/kernel</span><br><span class="line">$ <span class="built_in">cd</span> ~/build/kernel</span><br><span class="line">$ tar -Jxvf /user/src/linux-source-3.16.tar.xz</span><br></pre></td></tr></table></figure><h2 id="3-内核编译"><a href="#3-内核编译" class="headerlink" title="3 内核编译"></a>3 内核编译</h2><p>按需求更改配置,如果不想更改配置,直接双击ESC保存.config退出即可</p><p class="code-caption" data-lang="bash" data-line_number="frontend" data-trim_indent="backend" data-label_position="outer" data-labels_left="Code" data-labels_right=":" data-labels_copy="Copy Code"><span class="code-caption-label"></span></p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ make menuconfig</span><br></pre></td></tr></table></figure><p>编译内核</p><p class="code-caption" data-lang="bash" data-line_number="frontend" data-trim_indent="backend" data-label_position="outer" data-labels_left="Code" data-labels_right=":" data-labels_copy="Copy Code"><span class="code-caption-label"></span></p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ make deb-pjg</span><br></pre></td></tr></table></figure>]]></content>
<summary type="html">
<h1 id="Debian8-内核编译"><a href="#Debian8-内核编译" class="headerlink" title="Debian8 内核编译"></a>Debian8 内核编译</h1><p>本文介绍两种编译linux内核的方式,一种是debian发行版打过补丁和更改过配置的内核,一种是linux的原版内核。</p>
<h2 id="1-准备编译环境"><a href="#1-准备编译环境" class="headerlink" title="1 准备编译环境"></a>1 准备编译环境</h2><p>安装编译工具链</p>
<p class="code-caption" data-lang="bash" data-line_number="frontend" data-trim_indent="backend" data-label_position="outer" data-labels_left="Code" data-labels_right=":" data-labels_copy="Copy Code"><span class="code-caption-label"></span></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># apt-get install build-essential kernel-package libncurses5-dev -y</span></span><br></pre></td></tr></table></figure>
<h2 id="2-下载Debian发行版内核源码"><a href="#2-下载Debian发行版内核源码" class="headerlink" title="2 下载Debian发行版内核源码"></a>2 下载Debian发行版内核源码</h2><p class="code-caption" data-lang="bash" data-line_number="frontend" data-trim_indent="backend" data-label_position="outer" data-labels_left="Code" data-labels_right=":" data-labels_copy="Copy Code"><span class="code-caption-label"></span></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># apt-get install linux-source-3.16 -y</span></span><br></pre></td></tr></table></figure>
<p>内核源码包安装完成后下载到/user/src目录下</p>
</summary>
<category term="linux" scheme="https://blog.taeroen.com/categories/linux/"/>
<category term="linux" scheme="https://blog.taeroen.com/tags/linux/"/>
</entry>
</feed>