Gitlab-multi-instance construction

Time:2022-8-5

Gitlab-multi-instance construction


Operating system: CentOS
All services are as follows:

Node A: OpenResty, grafana-server
Node B: PGSQL, Redis
Node C: Gitlab_1
Node D: Gitlab_2
Node E: Gitlab_3
..............
Node N: Gitlab_n
Node A

OpenResty

Installation referencehttps://openresty.org/cn/inst…

# Install related dependencies
yum install pcre-devel openssl-devel gcc curl

# Download source package
wget https://openresty.org/download/openresty-1.19.9.1.tar.gz

# Install the source package, 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

# start openresty
# Restart the service sudo /opt/openresty/bin/openresty -s reload
# Stop the service sudo /opt/openresty/bin/openresty -s stop
sudo /opt/openresty/bin/openresty

grafana-server

Installation referencehttps://grafana.com/docs/graf…

# install, here<rpm package url> and<local rpm package>
# Replace with the required version of the package
sudo yum install initscripts urw-fonts wget
wget <rpm package url>
sudo rpm -Uvh <local rpm package>

# start up
sudo systemctl daemon-reload
sudo systemctl start grafana-server
sudo systemctl status grafana-server
sudo systemctl enable grafana-server

NodeB

build redis

referencehttps://hub.docker.com/_/redis

# Pull the latest redis image
docker pull redis

# Start the redis service
docker run \
    -v <your_conf>:/usr/local/etc/redis \
    --name <your_redis> redis \
    redis-server \
    /usr/local/etc/redis/redis.conf

Build PGSQL

referencehttps://hub.docker.com/_/post…

# Pull the latest PGSQL image
docker pull postgres

# Start the redis service
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

Node C~N

build gitlab

referencehttps://docs.gitlab.com/ee/up…

# install dependencies
yum -y install policycoreutils openssh-server openssh-clients postfix

# Enable postfix to support gitlab sending function
# The postfix startup process will report an error: fatal: parameter inet_interfaces: no local interface found for ::1 
# Need to modify inet_interfaces = localhost in /etc/postfix/main.cf to inet_interfaces = all Save the configuration and restart postfix
systemctl enable postfix && systemctl start postfix 

# install gitlab
# Manually download the installation package
# Domestic mirror source URL https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/
rpm -ivh <package_name>