Skip to content

Commit 097cfb4

Browse files
committed
update docs and scripts
1 parent db7bccd commit 097cfb4

31 files changed

Lines changed: 634 additions & 388 deletions

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@
5959
- [Nodejs 安装](docs/linux/soft/nodejs-install.md)
6060
- 开发工具
6161
- [Nexus 运维](docs/linux/soft/nexus-ops.md)
62-
- [Gitlab 运维](docs/linux/soft/kafka-install.md)
63-
- [Jenkins 运维](docs/linux/soft/jenkins.md)
62+
- [Gitlab 运维](docs/linux/soft/gitlab-ops.md)
63+
- [Jenkins 运维](docs/linux/soft/jenkins-ops.md)
6464
- [Svn 运维](docs/linux/soft/svn-ops.md)
6565
- [YApi 运维](docs/linux/soft/yapi-ops.md)
6666
- 中间件服务

codes/linux/lib/mysql.sh

Lines changed: 0 additions & 154 deletions
This file was deleted.

codes/linux/soft/config/mysql/my.cnf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ collation_server = utf8mb4_0900_ai_ci
1818

1919
# LOG
2020
# -------------------------------------------------------------------------------
21-
log_error = /var/log/mysql/mysql-error.log
21+
log_error = /var/log/mysql/mysql.log
2222
slow_query_log = 1
23-
slow_query_log_file = /var/log/mysql/mysql-slow.log
23+
slow_query_log_file = /var/log/mysql/mysql_slow_query_log.log
2424
long_query_time = 3
2525
min_examined_row_limit = 100
2626
expire_logs_days = 7

codes/linux/soft/gitlab-install.sh

Lines changed: 103 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,112 @@
11
#!/usr/bin/env bash
22

3-
###################################################################################
3+
# -----------------------------------------------------------------------------------------------------
44
# 安装 Gitlab 脚本
55
# 仅适用于 CentOS7 发行版本
66
# @author: Zhang Peng
7-
###################################################################################
7+
# -----------------------------------------------------------------------------------------------------
88

9-
echo -e "\n>>>>>>>>> install gitlab"
9+
# ------------------------------------------------------------------------------ env
1010

11-
echo -e "\n>>>>>>>>> 安装和配置必要依赖"
12-
sudo yum install -y curl policycoreutils-python openssh-server
13-
sudo systemctl enable sshd
14-
sudo systemctl start sshd
15-
sudo firewall-cmd --permanent --add-service=http
16-
sudo systemctl reload firewalld
11+
# Regular Color
12+
export ENV_COLOR_BLACK="\033[0;30m"
13+
export ENV_COLOR_RED="\033[0;31m"
14+
export ENV_COLOR_GREEN="\033[0;32m"
15+
export ENV_COLOR_YELLOW="\033[0;33m"
16+
export ENV_COLOR_BLUE="\033[0;34m"
17+
export ENV_COLOR_MAGENTA="\033[0;35m"
18+
export ENV_COLOR_CYAN="\033[0;36m"
19+
export ENV_COLOR_WHITE="\033[0;37m"
20+
# Bold Color
21+
export ENV_COLOR_B_BLACK="\033[1;30m"
22+
export ENV_COLOR_B_RED="\033[1;31m"
23+
export ENV_COLOR_B_GREEN="\033[1;32m"
24+
export ENV_COLOR_B_YELLOW="\033[1;33m"
25+
export ENV_COLOR_B_BLUE="\033[1;34m"
26+
export ENV_COLOR_B_MAGENTA="\033[1;35m"
27+
export ENV_COLOR_B_CYAN="\033[1;36m"
28+
export ENV_COLOR_B_WHITE="\033[1;37m"
29+
# Reset Color
30+
export ENV_COLOR_RESET="$(tput sgr0)"
1731

18-
echo -e "\n>>>>>>>>> 安装和配置邮件服务"
19-
sudo yum install postfix
20-
sudo systemctl enable postfix
21-
sudo systemctl start postfix
32+
# status
33+
export ENV_YES=0
34+
export ENV_NO=1
35+
export ENV_SUCCEED=0
36+
export ENV_FAILED=1
2237

23-
echo -e "\n>>>>>>>>> 通过 yum 安装 gitlab"
24-
curl -o- https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
25-
sudo EXTERNAL_URL="http://gitlab.example.com" yum install -y gitlab-ce
38+
# ------------------------------------------------------------------------------ functions
39+
40+
# 显示打印日志的时间
41+
SHELL_LOG_TIMESTAMP=$(date "+%Y-%m-%d %H:%M:%S")
42+
# 那个用户在操作
43+
USER=$(whoami)
44+
45+
redOutput() {
46+
echo -e "${ENV_COLOR_RED} $@${ENV_COLOR_RESET}"
47+
}
48+
49+
greenOutput() {
50+
echo -e "${ENV_COLOR_B_GREEN} $@${ENV_COLOR_RESET}"
51+
}
52+
53+
yellowOutput() {
54+
echo -e "${ENV_COLOR_YELLOW} $@${ENV_COLOR_RESET}"
55+
}
56+
57+
blueOutput() {
58+
echo -e "${ENV_COLOR_BLUE} $@${ENV_COLOR_RESET}"
59+
}
60+
61+
magentaOutput() {
62+
echo -e "${ENV_COLOR_MAGENTA} $@${ENV_COLOR_RESET}"
63+
}
64+
65+
cyanOutput() {
66+
echo -e "${ENV_COLOR_CYAN} $@${ENV_COLOR_RESET}"
67+
}
68+
69+
whiteOutput() {
70+
echo -e "${ENV_COLOR_WHITE} $@${ENV_COLOR_RESET}"
71+
}
72+
73+
printInfo() {
74+
echo -e "${ENV_COLOR_B_GREEN}[INFO] $@${ENV_COLOR_RESET}"
75+
}
76+
77+
printWarn() {
78+
echo -e "${ENV_COLOR_B_YELLOW}[WARN] $@${ENV_COLOR_RESET}"
79+
}
80+
81+
printError() {
82+
echo -e "${ENV_COLOR_B_RED}[ERROR] $@${ENV_COLOR_RESET}"
83+
}
84+
85+
callAndLog () {
86+
$*
87+
if [[ $? -eq ${ENV_SUCCEED} ]]; then
88+
printInfo "$@"
89+
return ${ENV_SUCCEED}
90+
else
91+
printError "$@ EXECUTE FAILED"
92+
return ${ENV_FAILED}
93+
fi
94+
}
95+
96+
# ------------------------------------------------------------------------------ main
97+
98+
printInfo ">>>> 安装 gitlab"
99+
printInfo ">>>> 安装和配置必要依赖"
100+
yum install -y curl policycoreutils-python openssh-server
101+
systemctl enable sshd
102+
systemctl start sshd
103+
printInfo ">>>> 关闭防火墙"
104+
firewall-cmd --permanent --add-service=http
105+
systemctl reload firewalld
106+
printInfo ">>>> 安装和配置邮件服务"
107+
yum install postfix
108+
systemctl enable postfix
109+
systemctl start postfix
110+
printInfo ">>>> 通过 yum 安装 gitlab"
111+
curl -o- https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | bash
112+
EXTERNAL_URL="http://gitlab.transwarp.io" yum install -y gitlab-ce

0 commit comments

Comments
 (0)