yum update -y
yum install -y java-1.8.0-openjdk.x86_64 java-1.8.0-openjdk-devel.x86_64 \
    lrzsz lsof net-tools bind-utils iputils traceroute telnet curl wget vim \
    gzip tar zip unzip git htop perf gcc gcc-c++ openssl openssl-devel patch tree \
    tcpdump iftop iotop sysstat nethogs

修改/etc/resolv.conf

chattr -i /etc/resolv.conf
sed -i '1i nameserver 8.8.8.8' /etc/resolv.conf
chattr +i /etc/resolv.conf

修改/etc/security/limits.conf

cat >>/etc/security/limits.conf<<EOF

root soft nofile 100001
root hard nofile 100002
* soft nofile 100001
* hard nofile 100002
* soft memlock unlimited
* hard memlock unlimited
EOF

修改/etc/sysctl.conf

sysctl -p

安装命令

sudo yum install -y yum-utils device-mapper-persistent-data lvm2
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo yum install docker-ce docker-ce-cli containerd.io
sudo systemctl start docker
sudo systemctl enable docker

设置registry-mirrors

vim /etc/docker/daemon.json,添加以下内容:

{
    "registry-mirrors": [
        "https://xxx.mirror.xxx.com"
    ]
}

重启服务

sudo systemctl daemon-reload
sudo systemctl restart docker

gitlab配置文件:/etc/gitlab/gitlab.rb

启动服务 sudo gitlab-ctl start
停止服务 sudo gitlab-ctl stop
重启服务 sudo gitlab-ctl restart

修改配置后,执行以下命令:

sudo gitlab-ctl reconfigure
sudo gitlab-ctl restart(可选,建议执行)

备份gitlab

sudo gitlab-rake gitlab:backup:create
备份目录:/var/opt/gitlab/backups/

恢复gitlab备份

把备份文件放到/var/opt/gitlab/backups/

sudo gitlab-ctl stop
sudo gitlab-rake gitlab:backup:restore BACKUP=备份文件名称
sudo gitlab-ctl start

配置:

back_log    1000
character_set_server    utf8mb4
collation_server    utf8mb4_general_ci
interactive_timeout 3600
max_connections 1000
wait_timeout    3600

创建数据库和用户:

CREATE DATABASE abc CHARACTER SET utf8mb4;
CREATE USER 'user1'@'localhost' IDENTIFIED BY 'xxx';
GRANT ALL PRIVILEGES ON abc.* TO 'user1'@'localhost';
FLUSH PRIVILEGES;

# Building the binary of the App
FROM golang:1.19 AS build

# `boilerplate` should be replaced with your project name
WORKDIR /go/src/boilerplate

# Copy all the Code and stuff to compile everything
COPY . .

# Downloads all the dependencies in advance (could be left out, but it's more clear this way)
RUN go mod download

# Builds the application as a staticly linked one, to allow it to run on alpine
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -installsuffix cgo -o app .


# Moving the binary to the 'final Image' to make it smaller
FROM alpine:latest as release

WORKDIR /app

# Create the `public` dir and copy all the assets into it
RUN mkdir ./static
COPY ./static ./static

# `boilerplate` should be replaced here as well
COPY --from=build /go/src/boilerplate/app .

# Add packages
RUN apk -U upgrade \
    && apk add --no-cache dumb-init ca-certificates \
    && chmod +x /app/app

# Exposes port 3000 because our program listens on that port
EXPOSE 3000

ENTRYPOINT ["/usr/bin/dumb-init", "--", "sh", "-c", "/app/app"]