Gitlab- 多实例搭建
操作系统:CentOS
所有服务如下:
节点 A:OpenResty、grafana-server
节点 B:PGSQL、Redis
节点 C:Gitlab_1
节点 D:Gitlab_2
节点 E:Gitlab_3
..............
节点 N:Gitlab_n
节点 A
OpenResty
装置参考 https://openresty.org/cn/inst…
# 装置相干依赖
yum install pcre-devel openssl-devel gcc curl
# 下载源码包
wget https://openresty.org/download/openresty-1.19.9.1.tar.gz
# 装置源码包,VERSION=1.19.9.1
tar -xzvf openresty-VERSION.tar.gz
cd openresty-VERSION/
./configure --prefix=/opt/openresty \
--with-luajit \
--without-http_redis2_module \
--with-http_iconv_module \
--with-http_postgres_module
make
sudo make install
# 启动 openresty
# 重启服务 sudo /opt/openresty/bin/openresty -s reload
# 进行服务 sudo /opt/openresty/bin/openresty -s stop
sudo /opt/openresty/bin/openresty
grafana-server
装置参考 https://grafana.com/docs/graf…
# 装置,这里的 <rpm package url> 和 <local rpm package>
# 替换成所需版本的包
sudo yum install initscripts urw-fonts wget
wget <rpm package url>
sudo rpm -Uvh <local rpm package>
# 启动
sudo systemctl daemon-reload
sudo systemctl start grafana-server
sudo systemctl status grafana-server
sudo systemctl enable grafana-server
节点 B
搭建 redis
参考 https://hub.docker.com/_/redis
# 拉取最新的 redis 镜像
docker pull redis
# 启动 redis 服务
docker run \
-v <your_conf>:/usr/local/etc/redis \
--name <your_redis> redis \
redis-server \
/usr/local/etc/redis/redis.conf
搭建 PGSQL
参考 https://hub.docker.com/_/post…
# 拉取最新的 PGSQL 镜像
docker pull postgres
# 启动 redis 服务
docker run \
--name postgresql -p 15432:5432 \
-e POSTGRES_USER=<your_pg_user> \
-e POSTGRES_DB=<your_pg_db> \
-e POSTGRES_PASSWORD=<your_pg_passwd> \
-d postgres
节点 C~N
搭建 gitlab
参考 https://docs.gitlab.com/ee/up…
# 装置依赖
yum -y install policycoreutils openssh-server openssh-clients postfix
# 开启 postfix 反对 gitlab 发信性能
# postfix 启动过程会报错:fatal: parameter inet_interfaces: no local interface found for ::1
# 须要批改 /etc/postfix/main.cf 里的 inet_interfaces = localhost 改为 inet_interfaces = all 保留配置后重启 postfix 即可
systemctl enable postfix && systemctl start postfix
# 装置 gitlab
# 手动下载安装包
# 国内镜像源网址 https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/
rpm -ivh <package_name>