验证是否开启 ipv6

1
2
3
4
# ifconfig -a | grep inet6
inet6 fe80::42:b8ff:feb5:4214 prefixlen 64 scopeid 0x20<link>
inet6 fe80::5054:ff:fec3:d3bb prefixlen 64 scopeid 0x20<link>
inet6 ::1 prefixlen 128 scopeid 0x10<host>

出现 inet6 相关即为开启 ipv6

修改内核模块配置

编辑 /etc/default/grub 文件并在 GRUB_CMDLINE_LINUX 中添加 ipv6.disable=1

如果是 Ubuntu 可能还有 GRUB_CMDLINE_LINUX_DEFAULT,同样也需要添加 ipv6.disable=1

1
2
3
4
# cat /etc/default/grub
......
GRUB_CMDLINE_LINUX="crashkernel=auto console=ttyS0 console=tty0 panic=5 net.ifnames=0 biosdevname=0 intel_idle.max_cstate=1 intel_pstate=disable"
......

修改后为

1
2
3
4
# cat /etc/default/grub
......
GRUB_CMDLINE_LINUX="crashkernel=auto console=ttyS0 console=tty0 panic=5 net.ifnames=0 biosdevname=0 intel_idle.max_cstate=1 intel_pstate=disable ipv6.disable=1"
......

应用更改

1
2
3
4
# CentOS
grub2-mkconfig -o /boot/grub2/grub.cfg
# Ubuntu
update-grub

重启

1
shutdown -r now

部署

1
2
3
4
5
6
7
8
docker run -d \
--name teamspeak \
--restart always \
-p 9987:9987/udp \
-v /opt/docker/teamspeak:/var/ts3server \
-e TS3SERVER_LICENSE=accept \
-e TS3SERVER_SERVERADMIN_PASSWORD=PLACEHOLD \
teamspeak:latest

日志

使用以下命令查看 Query Admin Account 相关登录用户密码以及 Privilege Key

1
docker logs teamspeak

脚本

1
2
3
4
5
6
7
8
9
10
11
12
13
~/.acme.sh/acme.sh \
--debug \
--issue \
--dns dns_dp \
-d *.starudream.cn

~/.acme.sh/acme.sh \
--debug \
--install-cert \
-d *.starudream.cn \
--fullchain-file '/usr/local/openresty/nginx/conf/ssl/*.starudream.cn.crt' \
--key-file '/usr/local/openresty/nginx/conf/ssl/*.starudream.cn.key' \
--reloadcmd 'service nginx reload'

nginx 配置文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
server {
listen 80;
listen [::]:80;
listen 443 ssl http2;
listen [::]:443 ssl http2;
ssl_certificate /usr/local/openresty/nginx/conf/ssl/*.starudream.cn.crt;
ssl_certificate_key /usr/local/openresty/nginx/conf/ssl/*.starudream.cn.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
ssl_ciphers TLS13-AES-256-GCM-SHA384:TLS13-CHACHA20-POLY1305-SHA256:TLS13-AES-128-GCM-SHA256:TLS13-AES-128-CCM-8-SHA256:TLS13-AES-128-CCM-SHA256:EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
ssl_prefer_server_ciphers on;
ssl_session_timeout 10m;
ssl_session_cache builtin:1000 shared:SSL:10m;
ssl_buffer_size 1400;
add_header Strict-Transport-Security max-age=15768000;
ssl_stapling on;
ssl_stapling_verify on;
server_name test.starudream.cn;
access_log /data/wwwlogs/test.starudream.cn_nginx.log combined;
index index.html;
root /data/wwwroot/default;
if ($ssl_protocol = "") { return 301 https://$host$request_uri; }
}

参考

  • https://github.com/acmesh-official/acme.sh

首先需要在 GitHub 上建立两个仓库,一个 公有,一个 私有

公有 仓库用于存放 Hexo 生成的静态文件以部署 GitHub Pages

私有 仓库用于存放未经编译的 Hexo 文件。

示例:starudream/blog-page 为我的 公有 仓库,starudream/blog 是我的 私有 仓库。

然后在 https://github.com/settings/tokens 申请 PAT,并将其加入私有仓库的 Secrets

最后在 私有 仓库内创建文件 .github/workflows/deploy.yml,修改相应内容:

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
name: Deploy
on:
push:
branches:
- master
jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Checkout Page
uses: actions/checkout@v2
with:
fetch-depth: 1
repository: starudream/blog-page
path: .deploy_git
token: ${{ secrets.PAGE_PAT }}
- name: Cache
uses: actions/cache@v1
with:
path: node_modules
key: ${{ runner.os }}-${{ hashFiles('**/package.json') }}
- name: Node
uses: actions/setup-node@v1
with:
node-version: 12
- name: Build
run: |
npm install hexo-cli -g && npm install && npm run build
- name: Deploy
run: |
rm -rf .deploy_git/* && cp -rf public/* .deploy_git/
git config --global user.name starudream
git config --global user.email justwangsheng@qq.com
message=$(git log -1 --pretty=format:%s)
cd .deploy_git
git add -A
git commit -m "$message"
git push

基于 gitlab-ee:12.6.4-ee

创建 ruby docker 镜像

1
docker run -it --rm ruby /bin/bash

生成许可证

1
gem install gitlab-license
1
cat > license.rb
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
require "openssl"
require "gitlab/license"

key_pair = OpenSSL::PKey::RSA.generate(2048)
File.open("license_key", "w") { |f| f.write(key_pair.to_pem) }

public_key = key_pair.public_key
File.open("license_key.pub", "w") { |f| f.write(public_key.to_pem) }

private_key = OpenSSL::PKey::RSA.new File.read("license_key")
Gitlab::License.encryption_key = private_key

license = Gitlab::License.new
license.licensee = {
"Name" => "none",
"Company" => "none",
"Email" => "example@test.com",
}
license.starts_at = Date.new(2020, 1, 1) # 开始时间
license.expires_at = Date.new(2050, 1, 1) # 结束时间
license.notify_admins_at = Date.new(2049, 12, 1)
license.notify_users_at = Date.new(2049, 12, 1)
license.block_changes_at = Date.new(2050, 1, 1)
license.restrictions = {
active_user_count: 10000,
}

puts "License:"
puts license

data = license.export
puts "Exported license:"
puts data
File.open("GitLabBV.gitlab-license", "w") { |f| f.write(data) }

public_key = OpenSSL::PKey::RSA.new File.read("license_key.pub")
Gitlab::License.encryption_key = public_key

data = File.read("GitLabBV.gitlab-license")
$license = Gitlab::License.import(data)

puts "Imported license:"
puts $license

unless $license
raise "The license is invalid."
end

if $license.restricted?(:active_user_count)
active_user_count = 10000
if active_user_count > $license.restrictions[:active_user_count]
raise "The active user count exceeds the allowed amount!"
end
end

if $license.notify_admins?
puts "The license is due to expire on #{$license.expires_at}."
end

if $license.notify_users?
puts "The license is due to expire on #{$license.expires_at}."
end

module Gitlab
class GitAccess
def check(cmd, changes = nil)
if $license.block_changes?
return build_status_object(false, "License expired")
end
end
end
end

puts "This instance of GitLab Enterprise Edition is licensed to:"
$license.licensee.each do |key, value|
puts "#{key}: #{value}"
end

if $license.expired?
puts "The license expired on #{$license.expires_at}"
elsif $license.will_expire?
puts "The license will expire on #{$license.expires_at}"
else
puts "The license will never expire."
end
1
ruby license.rb

生成 GitLabBV.gitlab-license license_key license_key.pub 这三个文件。

使用许可证

license_key.pub 文件替换 /opt/gitlab/embedded/service/gitlab-rails/.license_encryption_key.pub

GitLabBV.gitlab-license 即是许可证,填入 ${address}/admin/license 地址并重启。

修改等级

1
2
3
4
5
6
7
8
9
10
11
--- /opt/gitlab/embedded/service/gitlab-rails/ee/app/models/license.rb
+++ /opt/gitlab/embedded/service/gitlab-rails/ee/app/models/license.rb
@@ -367,7 +367,7 @@
end

def plan
- restricted_attr(:plan).presence || STARTER_PLAN
+ restricted_attr(:plan).presence || ULTIMATE_PLAN
end

def edition

修改完成后使用 gitlab-ctl reconfigure 重新加载配置。

参考

  • https://www.rubydoc.info/gems/gitlab-license/1.0.0/file/README.md